public class DecryptingInputStream
extends java.io.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(java.io.InputStream wrapped,
java.security.PrivateKey privKey)
Constructs a DecryptingInputStream using default symmetric encryption parameters.
|
DecryptingInputStream(java.io.InputStream wrapped,
java.security.PrivateKey privKey,
java.lang.String algorithm,
java.lang.String mode,
java.lang.String padding)
Constructs a DecryptingInputStream.
|
public DecryptingInputStream(java.io.InputStream wrapped, java.security.PrivateKey privKey) throws java.io.IOException, java.security.NoSuchAlgorithmException, javax.crypto.NoSuchPaddingException, java.security.InvalidKeyException, javax.crypto.IllegalBlockSizeException, javax.crypto.BadPaddingException, java.security.InvalidAlgorithmParameterException, java.security.NoSuchProviderException
wrapped
- the input stream to decryptprivKey
- the receiver's private key for decrypting the symmetric keyjava.io.IOException
- Signals that an I/O exception has occurred.java.security.NoSuchAlgorithmException
- the no such algorithm exceptionjavax.crypto.NoSuchPaddingException
- the no such padding exceptionjava.security.InvalidKeyException
- the invalid key exceptionjavax.crypto.IllegalBlockSizeException
- the illegal block size exceptionjavax.crypto.BadPaddingException
- the bad padding exceptionjava.security.InvalidAlgorithmParameterException
- the invalid algorithm parameter exceptionjava.security.NoSuchProviderException
- the no such provider exceptionpublic DecryptingInputStream(java.io.InputStream wrapped, java.security.PrivateKey privKey, java.lang.String algorithm, java.lang.String mode, java.lang.String padding) throws java.io.IOException, java.security.NoSuchAlgorithmException, javax.crypto.NoSuchPaddingException, java.security.InvalidKeyException, javax.crypto.IllegalBlockSizeException, javax.crypto.BadPaddingException, java.security.InvalidAlgorithmParameterException, java.security.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")java.io.IOException
- Signals that an I/O exception has occurred.java.security.NoSuchAlgorithmException
- the no such algorithm exceptionjavax.crypto.NoSuchPaddingException
- the no such padding exceptionjava.security.InvalidKeyException
- the invalid key exceptionjavax.crypto.IllegalBlockSizeException
- the illegal block size exceptionjavax.crypto.BadPaddingException
- the bad padding exceptionjava.security.InvalidAlgorithmParameterException
- the invalid algorithm parameter exceptionjava.security.NoSuchProviderException
- the no such provider exceptionpublic int read() throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
public int read(byte[] b) throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
public int read(byte[] b, int off, int len) throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
public int available() throws java.io.IOException
available
in class java.io.InputStream
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.InputStream
java.io.IOException
Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.