Class SymCipherManagement


  • public class SymCipherManagement
    extends java.lang.Object
    Management for keying and maintaining the symmetric encryption.
    • Field Detail

      • CIPHERS

        protected static final java.lang.String[] CIPHERS
        Available cipher suites, order is important, only append please.
      • cipherclassid

        protected int cipherclassid
        ID of class used as cipher for symmetric encryption.
      • ciphercon

        protected java.lang.reflect.Constructor<?> ciphercon
        Constructor for creating new ISymCipher objects.
      • packetidcounter

        protected java.util.concurrent.atomic.AtomicLong packetidcounter
        Counters for packet IDs, must be greater than Long.MIN_VALUE to allow replay identification to work.
      • messageidcounter

        protected java.util.concurrent.atomic.AtomicLong messageidcounter
        Counters for message IDs.
      • remainingbytes

        protected long remainingbytes
        Bytes remaining before rekeying.
      • activesymcipher

        protected byte activesymcipher
        Currently active symcipher.
    • Constructor Detail

      • SymCipherManagement

        public SymCipherManagement​(int cipherclassid,
                                   KeyExchangeGenerator keyexgen)
        Creates the management object.
        Parameters:
        symcipherclass - The symmetric cipher class used for encryption.
        keyexgen - Generator for key exchange objects.
    • Method Detail

      • getCipherClassId

        public int getCipherClassId()
        Returns the ID of the selected cipher class.
        Returns:
        The ID.
      • getKx

        public IKeyExchange getKx()
        Returns current key exchange object.
        Returns:
        Current key exchange object.
      • createKx

        public void createKx()
        Creates a key exchange object.
      • destroyKx

        public void destroyKx()
        Destroys the key exchange object.
      • createSymCipherSuite

        public void createSymCipherSuite​(byte cipherid,
                                         byte[] symkey)
        Creates a symmetric cipher suite.
        Parameters:
        cipherid - ID of the key used by the cipher.
        symkey - The key.
      • getSymCipherSuite

        public SymCipherSuite getSymCipherSuite​(byte cipherid)
        Gets a symmetric cipher suite.
        Parameters:
        cipherid - ID of the key used by the cipher.
      • getActiveSymCipherSuite

        public SymCipherSuite getActiveSymCipherSuite()
        Gets the currently active symmetric cipher suite.
      • getActiveSymCipherId

        public byte getActiveSymCipherId()
        Gets the currently active symmetric cipher ID.
      • setActiveSymCipherId

        public void setActiveSymCipherId​(byte cipherid)
        Sets the currently active symmetric cipher ID.
        Parameters:
        cipherid - The ID.
      • destroySymCipherSuite

        public void destroySymCipherSuite​(byte cipherid)
        Destroys a symmetric cipher.
        Parameters:
        cipherid - ID of the key used by the cipher.
      • getRemainingBytes

        public long getRemainingBytes()
        Returns bytes remaining before rekeying.
        Returns:
        Bytes remaining before rekeying.
      • subtractRemainingBytes

        public void subtractRemainingBytes​(long bytes)
        Subtracts a number of bytes from the remaining bytes.
        Parameters:
        bytes - Bytes to subtract.
      • refreshRemainingBytes

        public void refreshRemainingBytes()
        Refreshes the remaining bytes after rekeying.