Class TextDecryptor


  • public class TextDecryptor
    extends java.lang.Object
    Utility class that decrypts text strings.
    • Constructor Summary

      Constructors 
      Constructor Description
      TextDecryptor()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String decryptString​(java.lang.String text, byte[] key)
      Decrypts a text String using AES256 with the key using the embedded nonce.
      static java.lang.String decryptString​(java.lang.String text, byte[] key, byte[] nonce)
      Decrypts a text String using AES256 with the key and nonce provided.
      static java.lang.String decryptString​(java.lang.String text, byte[] key, byte[] nonce, EncryptionFormat format)
      Decrypts a text String using AES256 with the key and nonce provided.
      static java.lang.String decryptString​(java.lang.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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TextDecryptor

        public TextDecryptor()
    • Method Detail

      • decryptString

        public static java.lang.String decryptString​(java.lang.String text,
                                                     byte[] key)
                                              throws java.io.IOException
        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:
        java.io.IOException - Thrown if there is an IO error.
        SecurityException - Thrown if there is a security exception
        IntegrityException - Thrown if the data are corrupt or tampered with.
      • decryptString

        public static java.lang.String decryptString​(java.lang.String text,
                                                     byte[] key,
                                                     byte[] nonce)
                                              throws java.io.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.
        Returns:
        The decrypted text.
        Throws:
        java.io.IOException - Thrown if there is an IO error.
        SecurityException - Thrown if there is a security exception
        IntegrityException - Thrown if the data are corrupt or tampered with.
      • decryptString

        public static java.lang.String decryptString​(java.lang.String text,
                                                     byte[] key,
                                                     byte[] nonce,
                                                     EncryptionFormat format)
                                              throws java.io.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, see EncryptionFormat
        Returns:
        The decrypted text.
        Throws:
        java.io.IOException - Thrown if there is an IO error.
        SecurityException - Thrown if there is a security exception
        IntegrityException - Thrown if the data are corrupt or tampered with.
      • decryptString

        public static java.lang.String decryptString​(java.lang.String text,
                                                     byte[] key,
                                                     byte[] nonce,
                                                     EncryptionFormat format,
                                                     boolean integrity,
                                                     byte[] hashKey,
                                                     int chunkSize)
                                              throws java.io.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, see EncryptionFormat
        integrity - True if you want to calculate and store hash signatures for each chunkSize
        hashKey - Hash key to be used for all chunks.
        chunkSize - The chunk size.
        Returns:
        The decrypted text.
        Throws:
        java.io.IOException - Thrown if there is an IO error.
        SecurityException - Thrown if there is a security exception
        IntegrityException - Thrown if the data are corrupt or tampered with.