Class EncryptingOutputStream

java.lang.Object
java.io.OutputStream
org.alfresco.encryption.EncryptingOutputStream
All Implemented Interfaces:
Closeable, Flushable, AutoCloseable

public class EncryptingOutputStream extends OutputStream
An output stream that encrypts data to another output stream. A lightweight yet secure hybrid encryption scheme is used. A random symmetric key is generated and encrypted using the receiver's public key. The supplied data is then encrypted using the symmetric key and sent to the underlying stream on a streaming basis. An HMAC checksum is also computed on an ongoing basis and appended to the output when the stream is closed. This class can be used in conjunction with DecryptingInputStream to transport data securely.