public class EncryptingOutputStream extends OutputStream
DecryptingInputStream
to transport data securely.Constructor and Description |
---|
EncryptingOutputStream(OutputStream wrapped,
PublicKey receiverKey,
SecureRandom rand)
Constructs an EncryptingOutputStream using default symmetric encryption parameters.
|
EncryptingOutputStream(OutputStream wrapped,
PublicKey receiverKey,
String algorithm,
SecureRandom rand,
int strength,
String mode,
String padding)
Constructs an EncryptingOutputStream.
|
public EncryptingOutputStream(OutputStream wrapped, PublicKey receiverKey, SecureRandom rand) throws IOException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException
wrapped
- outputstream to store the encrypted datareceiverKey
- the receiver's public key for encrypting the symmetric keyrand
- a secure source of randomnessIOException
- Signals that an I/O exception has occurred.NoSuchAlgorithmException
- the no such algorithm exceptionNoSuchPaddingException
- the no such padding exceptionInvalidKeyException
- the invalid key exceptionBadPaddingException
- the bad padding exceptionIllegalBlockSizeException
- the illegal block size exceptionpublic EncryptingOutputStream(OutputStream wrapped, PublicKey receiverKey, String algorithm, SecureRandom rand, int strength, String mode, String padding) throws IOException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException
wrapped
- outputstream to store the encrypted datareceiverKey
- the receiver's public key for encrypting the symmetric keyalgorithm
- symmetric encryption algorithm (e.g. "AES")rand
- a secure source of randomnessstrength
- the key size in bits (e.g. 128)mode
- encryption mode (e.g. "CBC")padding
- padding scheme (e.g. "PKCS5PADDING")IOException
- Signals that an I/O exception has occurred.NoSuchAlgorithmException
- the no such algorithm exceptionNoSuchPaddingException
- the no such padding exceptionInvalidKeyException
- the invalid key exceptionBadPaddingException
- the bad padding exceptionIllegalBlockSizeException
- the illegal block size exceptionpublic void write(int b) throws IOException
write
in class OutputStream
IOException
public void write(byte[] b) throws IOException
write
in class OutputStream
IOException
public void write(byte[] b, int off, int len) throws IOException
write
in class OutputStream
IOException
public void flush() throws IOException
flush
in interface Flushable
flush
in class OutputStream
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class OutputStream
IOException
Copyright © 2005–2015 Alfresco Software. All rights reserved.