Package com.mku.salmon.text
Class TextDecryptor
java.lang.Object
com.mku.salmon.text.TextDecryptor
Utility class that decrypts text strings.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringdecryptString(String text, byte[] key) Decrypts a text String using AES256 with the key using the embedded nonce.static StringdecryptString(String text, byte[] key, byte[] nonce) Decrypts a text String using AES256 with the key and nonce provided.static StringdecryptString(String text, byte[] key, byte[] nonce, EncryptionFormat format) Decrypts a text String using AES256 with the key and nonce provided.static StringdecryptString(String text, byte[] key, byte[] nonce, EncryptionFormat format, boolean integrity, byte[] hashKey, int chunkSize) Decrypts a text String using AES256 with the key and nonce provided.
-
Constructor Details
-
TextDecryptor
public TextDecryptor()
-
-
Method Details
-
decryptString
Decrypts a text String using AES256 with the key using the embedded nonce.- Parameters:
text- Text to be decrypted.key- The encryption key to be used.- Returns:
- The decrypted text.
- Throws:
IOException- Thrown if there is an IO error.SecurityException- Thrown if there is a security exceptionIntegrityException- Thrown if the data are corrupt or tampered with.
-
decryptString
Decrypts a text String using AES256 with the key and nonce provided.- Parameters:
text- Text to be decrypted.key- The encryption key to be used.nonce- The nonce to be used, set only if header=false.- Returns:
- The decrypted text.
- Throws:
IOException- Thrown if there is an IO error.SecurityException- Thrown if there is a security exceptionIntegrityException- Thrown if the data are corrupt or tampered with.
-
decryptString
public static String decryptString(String text, byte[] key, byte[] nonce, EncryptionFormat format) throws IOException Decrypts a text String using AES256 with the key and nonce provided.- Parameters:
text- Text to be decrypted.key- The encryption key to be used.nonce- The nonce to be used, set only if header=false.format- The format to use, seeEncryptionFormat- Returns:
- The decrypted text.
- Throws:
IOException- Thrown if there is an IO error.SecurityException- Thrown if there is a security exceptionIntegrityException- Thrown if the data are corrupt or tampered with.
-
decryptString
public static String decryptString(String text, byte[] key, byte[] nonce, EncryptionFormat format, boolean integrity, byte[] hashKey, int chunkSize) throws IOException Decrypts a text String using AES256 with the key and nonce provided.- Parameters:
text- Text to be decrypted.key- The encryption key to be used.nonce- The nonce to be used, set only if header=false.format- The format to use, seeEncryptionFormatintegrity- True if you want to calculate and store hash signatures for each chunkSizehashKey- Hash key to be used for all chunks.chunkSize- The chunk size.- Returns:
- The decrypted text.
- Throws:
IOException- Thrown if there is an IO error.SecurityException- Thrown if there is a security exceptionIntegrityException- Thrown if the data are corrupt or tampered with.
-