Class AESCipher


  • public class AESCipher
    extends java.lang.Object
    Creates an AES Cipher with CBC and padding PKCS5/7.
    • Constructor Summary

      Constructors 
      Constructor Description
      AESCipher​(boolean forEncryption, byte[] key, byte[] iv)
      Creates a new instance of AESCipher
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      byte[] doFinal()  
      byte[] update​(byte[] inp, int inpOff, int inpLen)  
      • Methods inherited from class java.lang.Object

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

      • LOGGER

        private static final org.slf4j.Logger LOGGER
      • CIPHER_WITH_PKCS5_PADDING

        private static final java.lang.String CIPHER_WITH_PKCS5_PADDING
        See Also:
        Constant Field Values
      • cipher

        private final javax.crypto.Cipher cipher
    • Constructor Detail

      • AESCipher

        public AESCipher​(boolean forEncryption,
                         byte[] key,
                         byte[] iv)
        Creates a new instance of AESCipher
        Parameters:
        forEncryption - if true the cipher is initialised for encryption, if false for decryption
        key - the key to be used in the cipher
        iv - initialization vector to be used in cipher
    • Method Detail

      • update

        public byte[] update​(byte[] inp,
                             int inpOff,
                             int inpLen)
      • doFinal

        public byte[] doFinal()