Class CryptoHelper
java.lang.Object
com.amilesend.client.crypto.CryptoHelper
Helper that encrypts and decrypts content for the configured cipher algorithm and key.
Note: See Java Security Standard Algorithm Names for a list of available ciphers and be aware of which are applicable to comply with your local geographic laws and/or policies.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCryptoHelper(String cipherAlgorithm, @NonNull SecretKey key) Creates a newCryptoHelperinstance. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]decrypt(@NonNull EncryptedEnvelope envelope) Decrypts the givenEncryptedEnvelopeand returns the contents as a byte array.Encrypts the given bytes and returns anEncryptedEnvelope.
-
Constructor Details
-
CryptoHelper
-
-
Method Details
-
encrypt
public EncryptedEnvelope encrypt(byte @NonNull [] content, String description) throws CryptoHelperException Encrypts the given bytes and returns anEncryptedEnvelope.- Parameters:
content- the content to encryptdescription- a description of the content- Returns:
- the
EncryptedEnvelopecontaining the encrypted bytes - Throws:
CryptoHelperException- if an error occurred while encrypting the contents
-
decrypt
Decrypts the givenEncryptedEnvelopeand returns the contents as a byte array.- Parameters:
envelope- the envelope to decrypt- Returns:
- the decrypted contents
- Throws:
CryptoHelperException- if an error occurred while decrypting the envelope's contents
-