public class DecryptingInputStream extends InputStream
EncryptingOutputStream
. A lightweight yet secure hybrid
encryption scheme is used. A random symmetric key is decrypted using the receiver's private key. The supplied data is
then decrypted using the symmetric key and read on a streaming basis. When the end of the stream is reached or the
stream is closed, a HMAC checksum of the entire stream contents is validated.Constructor and Description |
---|
DecryptingInputStream(InputStream wrapped,
PrivateKey privKey)
Constructs a DecryptingInputStream using default symmetric encryption parameters.
|
DecryptingInputStream(InputStream wrapped,
PrivateKey privKey,
String algorithm,
String mode,
String padding)
Constructs a DecryptingInputStream.
|
Modifier and Type | Method and Description |
---|---|
int |
available() |
void |
close() |
int |
read() |
int |
read(byte[] b) |
int |
read(byte[] b,
int off,
int len) |
mark, markSupported, reset, skip
public DecryptingInputStream(InputStream wrapped, PrivateKey privKey) throws IOException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException, InvalidAlgorithmParameterException, NoSuchProviderException
wrapped
- the input stream to decryptprivKey
- the receiver's private key for decrypting the symmetric keyIOException
- Signals that an I/O exception has occurred.NoSuchAlgorithmException
- the no such algorithm exceptionNoSuchPaddingException
- the no such padding exceptionInvalidKeyException
- the invalid key exceptionIllegalBlockSizeException
- the illegal block size exceptionBadPaddingException
- the bad padding exceptionInvalidAlgorithmParameterException
- the invalid algorithm parameter exceptionNoSuchProviderException
- the no such provider exceptionpublic DecryptingInputStream(InputStream wrapped, PrivateKey privKey, String algorithm, String mode, String padding) throws IOException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException, InvalidAlgorithmParameterException, NoSuchProviderException
wrapped
- the input stream to decryptprivKey
- the receiver's private key for decrypting the symmetric keyalgorithm
- encryption algorithm (e.g. "AES")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 exceptionIllegalBlockSizeException
- the illegal block size exceptionBadPaddingException
- the bad padding exceptionInvalidAlgorithmParameterException
- the invalid algorithm parameter exceptionNoSuchProviderException
- the no such provider exceptionpublic int read() throws IOException
read
in class InputStream
IOException
public int read(byte[] b) throws IOException
read
in class InputStream
IOException
public int read(byte[] b, int off, int len) throws IOException
read
in class InputStream
IOException
public int available() throws IOException
available
in class InputStream
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class InputStream
IOException
Copyright © 2005–2020 Alfresco Software. All rights reserved.