Class AesCtrLayer

  • All Implemented Interfaces:
    Runnable, Layer

    public class AesCtrLayer
    extends AbstractBasicLayer
    AES Layer class.

    SPDX-License-Identifier: MIT

    Author:
    Kai Kretschmann
    • Field Detail

      • BITSPERBYTE

        protected static final int BITSPERBYTE
        How many bits in a byte.
        See Also:
        Constant Field Values
      • pbeKeySpec

        protected PBEKeySpec pbeKeySpec
        PBEKeySpec.
      • pbeKey

        protected SecretKey pbeKey
        SecretKey.
      • pbeSecretKeySpec

        protected SecretKeySpec pbeSecretKeySpec
        SecretKeySpec.
      • strKeyAlg

        protected String strKeyAlg
        Algorithm for the key.
      • chPasswd

        protected char[] chPasswd
        char array of password.
      • iterCount

        protected int iterCount
        Iterations count as defined by child class.
      • currentKeysize

        protected int currentKeysize
        Key size as defined by child class.
      • salt

        protected byte[] salt
        salt.
    • Constructor Detail

      • AesCtrLayer

        public AesCtrLayer()
        Constructor of AesLayer.
    • Method Detail

      • init

        public final void init​(String data)
        init function. Overrides base init but uses it for setting base values.
        Parameters:
        data - to initialize the crypt value.
      • getMyAlg

        protected final String getMyAlg()
        Abstract base method for getting algorithm name back.
        Returns:
        String
      • getMyKeyAlg

        protected final String getMyKeyAlg()
        Abstract base method for getting key algorithm name back.
        Returns:
        String
      • getMySaltLen

        protected int getMySaltLen()
        Abstract base method for getting salt len back.
        Returns:
        int length
      • getMyIvLen

        protected int getMyIvLen()
        Abstract base method for getting IV length back.
        Returns:
        int length
      • getMyCount

        protected int getMyCount()
        Abstract base method for getting a counter back.
        Returns:
        int
      • getMyKeysize

        protected int getMyKeysize()
        Abstract base method for getting key size back.
        Returns:
        int length
      • equals

        public boolean equals​(Object o)
        Override equals method from object class.
        Overrides:
        equals in class Object
        Parameters:
        o - object to compare with
        Returns:
        true or false
      • hashCode

        public int hashCode()
        Override equals method from object class.
        Overrides:
        hashCode in class Object
        Returns:
        hash of properties
      • init

        protected final void init()
        Set base values via own getters, which are defined in child classes.
      • encodeAndDecode

        public final void encodeAndDecode​(InputStream inputStream,
                                          OutputStream outputStream)
                                   throws JastacryException
        Description copied from interface: Layer
        Local encode Stream function which does the real thing for Random Layer.
        Parameters:
        inputStream - incoming data
        outputStream - outgoing data
        Throws:
        JastacryException - thrown on error