java.lang.Object
org.refcodes.security.alt.chaos.ChaosEncrypter
All Implemented Interfaces:
org.refcodes.mixin.Disposable, org.refcodes.security.Encrypter<byte[],byte[],org.refcodes.security.EncryptionException>

public class ChaosEncrypter extends Object implements org.refcodes.security.Encrypter<byte[],byte[],org.refcodes.security.EncryptionException>
The ChaosEncrypter will use byte arrays as input and output types.
  • Constructor Details

    • ChaosEncrypter

      public ChaosEncrypter(ChaosKey aKey)
      Instantiates a new ChaosEncrypter using the given ChaosKey for encrypting.
      Parameters:
      aKey - The ChaosKey to use for encrypting.
    • ChaosEncrypter

      public ChaosEncrypter(ChaosKey aKey, int aChildDepth)
      Instantiates a new ChaosEncrypter using the given ChaosKey for encrypting.
      Parameters:
      aKey - The ChaosKey to use for encrypting.
      aChildDepth - The number of children to consider when creating the ChaosDecrypter.
    • ChaosEncrypter

      public ChaosEncrypter(ChaosKey aKey, boolean isVerify)
      Instantiates a new ChaosEncrypter using the given ChaosKey for encrypting.
      Parameters:
      aKey - The ChaosKey to use for encrypting.
      isVerify - When true then the encryption is verified against an according live decryption to throw an IllegalStateException in case encryption and decryption differ.
    • ChaosEncrypter

      public ChaosEncrypter(ChaosKey aKey, int aChildDepth, boolean isVerify)
      Instantiates a new ChaosEncrypter using the given ChaosKey for encrypting.
      Parameters:
      aKey - The ChaosKey to use for encrypting.
      aChildDepth - The number of children to consider when creating the ChaosDecrypter.
      isVerify - When true then the encryption is verified against an according live decryption to throw an IllegalStateException in case encryption and decryption differ.
    • ChaosEncrypter

      protected ChaosEncrypter(ChaosKey aKey, int aChildDepth, ChaosEncrypter aChildEncrypter, boolean isVerify) throws IllegalArgumentException
      Instantiates a new ChaosEncrypter using the given ChaosKey for encrypting and the given ChaosEncrypter as child encrypter: The ChaosKey must therefore have no child ChaosKey as the child ChaosEncrypter then cannot unambiguously be determined! Attention: This constructor usually only is used by libraries which retrieve the various keys in different processing steps (see ChaosEncryptionOutputStream).
      Parameters:
      aKey - The ChaosKey to use for encrypting.
      aChildDepth - The number of children to consider when creating the ChaosDecrypter.
      aChildEncrypter - The ChaosEncrypter to be used as child encrypter.
      isVerify - When true then the encryption is verified against an according live decryption to throw an IllegalStateException in case encryption and decryption differ.
      Throws:
      IllegalArgumentException - thrown in case the chaos key has a child key and a child encrypter is provided as well (either the one or the other only is allowed).
  • Method Details

    • toEncrypted

      public byte[] toEncrypted(byte[] aDecrypted) throws org.refcodes.security.EncryptionException
      Specified by:
      toEncrypted in interface org.refcodes.security.Encrypter<byte[],byte[],org.refcodes.security.EncryptionException>
      Throws:
      org.refcodes.security.EncryptionException
    • toEncrypted

      public int toEncrypted(byte[] aBuffer, int aOffset, int aLength, byte[] aOutBuffer, int aOutOffset) throws org.refcodes.security.EncryptionException
      Specified by:
      toEncrypted in interface org.refcodes.security.Encrypter<byte[],byte[],org.refcodes.security.EncryptionException>
      Throws:
      org.refcodes.security.EncryptionException
    • encrypt

      public int encrypt(byte[] aBuffer, int aOffset, int aLength) throws org.refcodes.security.EncryptionException
      Specified by:
      encrypt in interface org.refcodes.security.Encrypter<byte[],byte[],org.refcodes.security.EncryptionException>
      Throws:
      org.refcodes.security.EncryptionException
    • encrypt

      public int encrypt(byte[] aBuffer) throws org.refcodes.security.EncryptionException
      Specified by:
      encrypt in interface org.refcodes.security.Encrypter<byte[],byte[],org.refcodes.security.EncryptionException>
      Throws:
      org.refcodes.security.EncryptionException
    • dispose

      public void dispose()
      Specified by:
      dispose in interface org.refcodes.mixin.Disposable
    • toString

      public String toString()
      Overrides:
      toString in class Object