Class AbstractCipherLayer

    • Constructor Summary

      Constructors 
      Constructor Description
      AbstractCipherLayer​(java.lang.Class<?> cClass, java.lang.String layerName)
      Constructor of abstract class.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void decStream​(java.io.InputStream inputStream, java.io.OutputStream outputStream)
      decode Stream function.
      void encodeAndDecode​(java.io.InputStream inputStream, java.io.OutputStream outputStream)
      Local encode Stream function which does the real thing for Random Layer.
      void encStream​(java.io.InputStream inputStream, java.io.OutputStream outputStream)
      encode Stream function.
      protected void getIv()
      store IV bytes.
      protected abstract java.lang.String getMyAlg()
      Abstract base method for getting algorithm name back.
      protected abstract int getMyCount()
      Abstract base method for getting a counter back.
      protected abstract int getMyIvLen()
      Abstract base method for getting IV length back.
      protected abstract java.lang.String getMyKeyAlg()
      Abstract base method for getting key algorithm name back.
      protected abstract int getMyKeysize()
      Abstract base method for getting key size back.
      protected abstract int getMySaltLen()
      Abstract base method for getting salt len back.
      protected void getSalt()
      Generate random salt.
      protected void init()
      Set base values via own getters, which are defined in child classes.
      protected abstract void setupPbe()
      Generate Keys from plain password.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface org.jastacry.layer.Layer

        init
    • Field Detail

      • BITSPERBYTE

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

        protected javax.crypto.spec.PBEKeySpec pbeKeySpec
        PBEKeySpec.
      • keyFac

        protected javax.crypto.SecretKeyFactory keyFac
        SecretKeyFactory.
      • pbeKey

        protected javax.crypto.SecretKey pbeKey
        SecretKey.
      • pbeSecretKeySpec

        protected javax.crypto.spec.SecretKeySpec pbeSecretKeySpec
        SecretKeySpec.
      • strAlg

        protected java.lang.String strAlg
        ALG for the data.
      • strKeyAlg

        protected java.lang.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.
      • currentIvLen

        protected int currentIvLen
        IV length.
      • ivBytes

        protected byte[] ivBytes
        IV bytes.
      • currentSaltLen

        protected int currentSaltLen
        Salt length.
      • salt

        protected byte[] salt
        salt.
    • Constructor Detail

      • AbstractCipherLayer

        public AbstractCipherLayer​(java.lang.Class<?> cClass,
                                   java.lang.String layerName)
        Constructor of abstract class.
        Parameters:
        cClass - class name of calling class
        layerName - name of real layer
    • Method Detail

      • getMyAlg

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

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

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

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

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

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

        protected final void getSalt()
        Generate random salt.
      • getIv

        protected final void getIv()
        store IV bytes.
      • init

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

        public final void encStream​(java.io.InputStream inputStream,
                                    java.io.OutputStream outputStream)
                             throws JastacryException
        encode Stream function.
        Parameters:
        inputStream - incoming data
        outputStream - outgoing data
        Throws:
        JastacryException - thrown on error
      • decStream

        public final void decStream​(java.io.InputStream inputStream,
                                    java.io.OutputStream outputStream)
                             throws JastacryException
        decode Stream function.
        Parameters:
        inputStream - incoming data
        outputStream - outgoing data
        Throws:
        JastacryException - thrown on error
      • encodeAndDecode

        public final void encodeAndDecode​(java.io.InputStream inputStream,
                                          java.io.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