public class CryptoHelper extends Object
| Constructor and Description |
|---|
CryptoHelper() |
| Modifier and Type | Method and Description |
|---|---|
static String |
decrypt(String base64Text,
String password)
Decrypt text with password.
|
static String |
decrypt(String base64Text,
String recipientId,
PrivateKey privateKey)
Decrypt text with private key.
|
static String |
decrypt(String base64Text,
String recipientId,
PrivateKey privateKey,
Password password)
Decrypt text with private key which protected with password.
|
static String |
encrypt(String text,
Map<String,String> recipients)
Encrypt text with public key for multiple recipients.
|
static String |
encrypt(String text,
String password)
Encrypt text with password.
|
static String |
encrypt(String text,
String recipientId,
PublicKey publicKey)
Encrypt text with public key.
|
static String |
sign(String text,
PrivateKey privateKey)
Sign text with private key.
|
static String |
sign(String text,
PrivateKey privateKey,
Password password)
Sign text with private key.
|
static boolean |
verify(String text,
String signature,
PublicKey publicKey)
Verify text with signature.
|
public static String encrypt(String text, String password) throws Exception
text - the text to be encrypted.password - the password used for encryption.Exceptionpublic static String encrypt(String text, String recipientId, PublicKey publicKey) throws Exception
text - the text to be encrypted.recipientId - the recipient ID.publicKey - the public key of recipient.Exceptionpublic static String encrypt(String text, Map<String,String> recipients) throws Exception
text - the text to be encrypted.recipients - the map of recipients. Key is recipient identifier, value is
Base64-encoded public key.Exceptionpublic static String decrypt(String base64Text, String password) throws Exception
base64Text - encrypted data as Base64 string.password - the password used for decryption.Exceptionpublic static String decrypt(String base64Text, String recipientId, PrivateKey privateKey) throws Exception
base64Text - encrypted data as Base64 string.recipientId - the recipient ID.privateKey - the private key of recipient.Exceptionpublic static String decrypt(String base64Text, String recipientId, PrivateKey privateKey, Password password) throws Exception
base64Text - encrypted data as Base64 string.recipientId - the recipient ID.privateKey - the private key of recipient.password - the private key's password.Exceptionpublic static String sign(String text, PrivateKey privateKey) throws Exception
text - the text to be signed.privateKey - the private key.Exceptionpublic static String sign(String text, PrivateKey privateKey, Password password) throws Exception
text - the text to be signed.privateKey - the private key.password - the private key's password.ExceptionCopyright © 2016. All rights reserved.