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
ConstructorDescriptionChaosEncryptionOutputStream
(OutputStream aOutputStream, ChaosKey aKey) Constructs theChaosEncryptionOutputStream
using the givenChaosKey
for encrypting.ChaosEncryptionOutputStream
(OutputStream aOutputStream, ChaosKey aKey, boolean isVerify) Constructs theChaosEncryptionOutputStream
using the givenChaosKey
for encrypting. -
Method Summary
Methods inherited from class org.refcodes.security.EncryptionOutputStream
close, dispose, equals, flush, hashCode, toString, write, write, write
Methods inherited from class java.io.OutputStream
nullOutputStream
-
Constructor Details
-
ChaosEncryptionOutputStream
Constructs theChaosEncryptionOutputStream
using the givenChaosKey
for encrypting.- Parameters:
aOutputStream
- TheOutputStream
to be wrapped.aKey
- TheChaosKey
to 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 theChaosEncryptionOutputStream
using the givenChaosKey
for encrypting.- Parameters:
aOutputStream
- TheOutputStream
to be wrapped.aKey
- TheChaosKey
to use for encrypting.isVerify
- When true then the encryption is verified against an according live decryption to throw anIllegalStateException
in case encryption and decryption differ.- Throws:
IOException
- Signals that an I/O exception has occurred while applying salting.
-