public class SecureInputStream
extends java.io.FilterInputStream
Constructor and Description |
---|
SecureInputStream(java.io.InputStream in,
AESSymmetricKey key,
HMACSymmetricKey signKey,
byte[] iv)
Creates a new AESInputStream with the given keys.
|
Modifier and Type | Method and Description |
---|---|
int |
read()
Reads a single byte.
|
int |
read(byte[] b)
Reads a number of bytes and fills an array.
|
int |
read(byte[] b,
int off,
int len)
Reads an encrypted stream.
|
public SecureInputStream(java.io.InputStream in, AESSymmetricKey key, HMACSymmetricKey signKey, byte[] iv)
in
- The InputStream that should be decryptedkey
- The key that was used for the encryption (symmetric)signKey
- The key that was used to create the signature (symmetric)iv
- The initialization vector that was used to initialize the encryptionpublic int read() throws java.io.IOException
read
in class java.io.FilterInputStream
java.io.IOException
- Thrown by the underlying stream.public int read(byte[] b) throws java.io.IOException
read
in class java.io.FilterInputStream
b
- The byte array to fill.java.io.IOException
- Thrown by the underlying stream.public int read(byte[] b, int off, int len) throws java.io.IOException
read
in class java.io.FilterInputStream
b
- buffer to write tooff
- offset in bufferlen
- length of bufferjava.io.IOException
- Thrown by the underlying stream, if the signature is invalid or if the cipher text cannot be decrypted successfully