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
AChaosEncryptionOutputStream
wraps anOutputStream
and produces output bytes by applying aChaosEncrypter
on each byte to be written before delegating the processed vale to the givenOutputStream
. The output of theChaosEncryptionOutputStream
can be converted back by the accordingChaosDecryptionInputStream
. In case salting is enabled, then theChaosEncryptionOutputStream
initially encrypts heading bytes of anOutputStream
with a random saltChaosKey
which then is used as initially encrypting the plan data (being reversed using theChaosDecryptionInputStream
with salting enabled).
-
-
Constructor Summary
Constructors Constructor Description ChaosEncryptionOutputStream(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 Detail
-
ChaosEncryptionOutputStream
public ChaosEncryptionOutputStream(OutputStream aOutputStream, ChaosKey aKey) throws IOException
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.
-
-