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 Summary
ConstructorsModifierConstructorDescriptionChaosEncrypter(ChaosKey aKey) Instantiates a newChaosEncrypterusing the givenChaosKeyfor encrypting.ChaosEncrypter(ChaosKey aKey, boolean isVerify) Instantiates a newChaosEncrypterusing the givenChaosKeyfor encrypting.ChaosEncrypter(ChaosKey aKey, int aChildDepth) Instantiates a newChaosEncrypterusing the givenChaosKeyfor encrypting.ChaosEncrypter(ChaosKey aKey, int aChildDepth, boolean isVerify) Instantiates a newChaosEncrypterusing the givenChaosKeyfor encrypting.protectedChaosEncrypter(ChaosKey aKey, int aChildDepth, ChaosEncrypter aChildEncrypter, boolean isVerify) Instantiates a newChaosEncrypterusing the givenChaosKeyfor encrypting and the givenChaosEncrypteras child encrypter: TheChaosKeymust therefore have no childChaosKeyas the childChaosEncrypterthen cannot unambiguously be determined! -
Method Summary
Modifier and TypeMethodDescriptionvoiddispose()intencrypt(byte[] aBuffer) intencrypt(byte[] aBuffer, int aOffset, int aLength) byte[]toEncrypted(byte[] aDecrypted) inttoEncrypted(byte[] aBuffer, int aOffset, int aLength, byte[] aOutBuffer, int aOutOffset) toString()
-
Constructor Details
-
ChaosEncrypter
Instantiates a newChaosEncrypterusing the givenChaosKeyfor encrypting.- Parameters:
aKey- TheChaosKeyto use for encrypting.
-
ChaosEncrypter
Instantiates a newChaosEncrypterusing the givenChaosKeyfor encrypting.- Parameters:
aKey- TheChaosKeyto use for encrypting.aChildDepth- The number of children to consider when creating theChaosDecrypter.
-
ChaosEncrypter
Instantiates a newChaosEncrypterusing the givenChaosKeyfor encrypting.- Parameters:
aKey- TheChaosKeyto use for encrypting.isVerify- When true then the encryption is verified against an according live decryption to throw anIllegalStateExceptionin case encryption and decryption differ.
-
ChaosEncrypter
Instantiates a newChaosEncrypterusing the givenChaosKeyfor encrypting.- Parameters:
aKey- TheChaosKeyto use for encrypting.aChildDepth- The number of children to consider when creating theChaosDecrypter.isVerify- When true then the encryption is verified against an according live decryption to throw anIllegalStateExceptionin case encryption and decryption differ.
-
ChaosEncrypter
protected ChaosEncrypter(ChaosKey aKey, int aChildDepth, ChaosEncrypter aChildEncrypter, boolean isVerify) Instantiates a newChaosEncrypterusing the givenChaosKeyfor encrypting and the givenChaosEncrypteras child encrypter: TheChaosKeymust therefore have no childChaosKeyas the childChaosEncrypterthen cannot unambiguously be determined! Attention: This constructor usually only is used by libraries which retrieve the various keys in different processing steps (seeChaosEncryptionOutputStream).- Parameters:
aKey- TheChaosKeyto use for encrypting.aChildDepth- The number of children to consider when creating theChaosDecrypter.aChildEncrypter- TheChaosEncrypterto be used as child encrypter.isVerify- When true then the encryption is verified against an according live decryption to throw anIllegalStateExceptionin 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:
toEncryptedin interfaceorg.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:
toEncryptedin interfaceorg.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:
encryptin interfaceorg.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:
encryptin interfaceorg.refcodes.security.Encrypter<byte[],byte[], org.refcodes.security.EncryptionException> - Throws:
org.refcodes.security.EncryptionException
-
dispose
public void dispose()- Specified by:
disposein interfaceorg.refcodes.mixin.Disposable
-
toString
-