public class AEADInputStream
extends java.io.FilterInputStream
| Constructor and Description |
|---|
AEADInputStream(java.io.InputStream is,
byte[] key,
org.bouncycastle.crypto.BlockCipher hashCipher,
org.bouncycastle.crypto.BlockCipher mainCipher)
Create a decrypting, authenticating InputStream.
|
| Modifier and Type | Method and Description |
|---|---|
int |
available() |
void |
close() |
static AEADInputStream |
createAES(java.io.InputStream is,
byte[] key) |
int |
getIVSize() |
void |
mark(int readlimit) |
boolean |
markSupported() |
int |
read() |
int |
read(byte[] buf) |
int |
read(byte[] buf,
int offset,
int length) |
void |
reset() |
long |
skip(long n) |
public AEADInputStream(java.io.InputStream is,
byte[] key,
org.bouncycastle.crypto.BlockCipher hashCipher,
org.bouncycastle.crypto.BlockCipher mainCipher)
throws java.io.IOException
is - The underlying InputStream.key - The encryption key.nonce - The nonce. This serves the function of an IV. As a nonce, this MUST be unique.
We will write it to the stream so the other side can pick it up, like an IV.mainCipher - The BlockCipher for encrypting data. E.g. AES; not a block mode. This will
be used for encrypting a fairly large amount of data so could be any of the 3 BC AES impl's.hashCipher - The BlockCipher for the final hash. E.g. AES, not a block mode. This will
not be used very much so should be e.g. an AESLightEngine.java.io.IOExceptionpublic final int getIVSize()
public int read()
throws java.io.IOException
read in class java.io.FilterInputStreamjava.io.IOExceptionpublic int read(byte[] buf)
throws java.io.IOException
read in class java.io.FilterInputStreamjava.io.IOExceptionpublic int read(byte[] buf,
int offset,
int length)
throws java.io.IOException
read in class java.io.FilterInputStreamjava.io.IOExceptionpublic int available()
throws java.io.IOException
available in class java.io.FilterInputStreamjava.io.IOExceptionpublic long skip(long n)
throws java.io.IOException
skip in class java.io.FilterInputStreamjava.io.IOExceptionpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.FilterInputStreamjava.io.IOExceptionpublic boolean markSupported()
markSupported in class java.io.FilterInputStreampublic void mark(int readlimit)
mark in class java.io.FilterInputStreampublic void reset()
throws java.io.IOException
reset in class java.io.FilterInputStreamjava.io.IOExceptionpublic static AEADInputStream createAES(java.io.InputStream is, byte[] key) throws java.io.IOException
java.io.IOException