Package org.refcodes.security.alt.chaos
Class ChaosEncryptionOutputStream
java.lang.Object
java.io.OutputStream
org.refcodes.security.EncryptionOutputStream
org.refcodes.security.alt.chaos.ChaosEncryptionOutputStream
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable,org.refcodes.mixin.Disposable
public class ChaosEncryptionOutputStream
extends org.refcodes.security.EncryptionOutputStream
A
ChaosEncryptionOutputStream wraps an OutputStream and
produces output bytes by applying a ChaosEncrypter on each byte to be
written before delegating the processed vale to the given
OutputStream. The output of the ChaosEncryptionOutputStream
can be converted back by the according ChaosDecryptionInputStream.
In case salting is enabled, then the ChaosEncryptionOutputStream
initially encrypts heading bytes of an OutputStream with a random
salt ChaosKey which then is used as initially encrypting the plan
data (being reversed using the ChaosDecryptionInputStream with
salting enabled).-
Constructor Summary
ConstructorsConstructorDescriptionChaosEncryptionOutputStream(OutputStream aOutputStream, ChaosKey aKey) Constructs theChaosEncryptionOutputStreamusing the givenChaosKeyfor encrypting.ChaosEncryptionOutputStream(OutputStream aOutputStream, ChaosKey aKey, boolean isVerify) Constructs theChaosEncryptionOutputStreamusing the givenChaosKeyfor encrypting. -
Method Summary
Methods inherited from class org.refcodes.security.EncryptionOutputStream
close, dispose, equals, flush, hashCode, toString, write, write, writeMethods inherited from class java.io.OutputStream
nullOutputStream
-
Constructor Details
-
ChaosEncryptionOutputStream
Constructs theChaosEncryptionOutputStreamusing the givenChaosKeyfor encrypting.- Parameters:
aOutputStream- TheOutputStreamto be wrapped.aKey- TheChaosKeyto use for encrypting.- Throws:
IOException- Signals that an I/O exception has occurred while applying salting.
-
ChaosEncryptionOutputStream
public ChaosEncryptionOutputStream(OutputStream aOutputStream, ChaosKey aKey, boolean isVerify) throws IOException Constructs theChaosEncryptionOutputStreamusing the givenChaosKeyfor encrypting.- Parameters:
aOutputStream- TheOutputStreamto be wrapped.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.- Throws:
IOException- Signals that an I/O exception has occurred while applying salting.
-