Class OpenStegoCrypto


  • public class OpenStegoCrypto
    extends java.lang.Object
    This is the class for providing cryptography support to OpenStego.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String ALGO_AES128
      Constant for algorithm - AES128
      static java.lang.String ALGO_AES256
      Constant for algorithm - AES256
      static java.lang.String ALGO_DES
      Constant for algorithm - DES
    • Constructor Summary

      Constructors 
      Constructor Description
      OpenStegoCrypto​(java.lang.String password, java.lang.String algorithm)
      Default constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      byte[] decrypt​(byte[] input)
      Method to decrypt the data
      byte[] encrypt​(byte[] input)
      Method to encrypt the data
      • Methods inherited from class java.lang.Object

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

      • ALGO_DES

        public static final java.lang.String ALGO_DES
        Constant for algorithm - DES
        See Also:
        Constant Field Values
      • ALGO_AES128

        public static final java.lang.String ALGO_AES128
        Constant for algorithm - AES128
        See Also:
        Constant Field Values
      • ALGO_AES256

        public static final java.lang.String ALGO_AES256
        Constant for algorithm - AES256
        See Also:
        Constant Field Values
    • Constructor Detail

      • OpenStegoCrypto

        public OpenStegoCrypto​(java.lang.String password,
                               java.lang.String algorithm)
                        throws OpenStegoException
        Default constructor
        Parameters:
        password - Password to use for encryption
        algorithm - Cryptography algorithm to use. If null or blank value is provided, then it defaults to AES128
        Throws:
        OpenStegoException
    • Method Detail

      • encrypt

        public byte[] encrypt​(byte[] input)
                       throws OpenStegoException
        Method to encrypt the data
        Parameters:
        input - Data to be encrypted
        Returns:
        Encrypted data
        Throws:
        OpenStegoException
      • decrypt

        public byte[] decrypt​(byte[] input)
                       throws OpenStegoException
        Method to decrypt the data
        Parameters:
        input - Data to be decrypted
        Returns:
        Decrypted data (returns null if password is invalid)
        Throws:
        OpenStegoException