|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.io.InputStream
org.cryptonode.jncryptor.AES256JNCryptorInputStream
public class AES256JNCryptorInputStream
Reads RNCryptor-format data in a stream fashion. This class only supports the v3 data format. The entire stream must be read in order to trigger the validation of the HMAC value.
| Constructor Summary | |
|---|---|
AES256JNCryptorInputStream(InputStream in,
char[] password)
Creates an input stream for password-encrypted data. |
|
AES256JNCryptorInputStream(InputStream in,
SecretKey decryptionKey,
SecretKey hmacKey)
Creates an input stream for key-encrypted data. |
|
| Method Summary | |
|---|---|
void |
close()
Closes the underlying input stream. |
boolean |
markSupported()
Mark and reset methods are not supported in this input stream. |
int |
read()
Reads the next byte from the input stream. |
int |
read(byte[] b)
The read(b) method for class AES256JNCryptorInputStream has
the same effect as: |
int |
read(byte[] b,
int off,
int len)
Reads a number of bytes into the byte array. |
| Methods inherited from class java.io.InputStream |
|---|
available, mark, reset, skip |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AES256JNCryptorInputStream(InputStream in,
char[] password)
in - the InputStream to readpassword - the password
public AES256JNCryptorInputStream(InputStream in,
SecretKey decryptionKey,
SecretKey hmacKey)
in - the InputStream to readdecryptionKey - the key to decrypt withhmacKey - the key to calculate the HMAC with| Method Detail |
|---|
public boolean markSupported()
markSupported in class InputStreamfalse
public int read()
throws IOException,
StreamIntegrityException
read in class InputStream-1 if the end of
the stream has been reached
IOException - if an I/O error occurs.
StreamIntegrityException - if the final byte has been read and the HMAC fails validation
public int read(byte[] b)
throws IOException,
StreamIntegrityException
read(b) method for class AES256JNCryptorInputStream has
the same effect as:
read(b, 0, b.length)
read in class InputStreamb - the buffer into which the data is read.
-1 if
there is no more data because the end of the stream has been
reached.
IOException - if an I/O error occurs.
StreamIntegrityException - if the final byte has been read and the HMAC fails validation
public int read(byte[] b,
int off,
int len)
throws IOException
read in class InputStreamb - the buffer into which the data is read.off - the start offset in array b at which the data is
written.len - the maximum number of bytes to read.
-1
if there is no more data because the end of the stream has been
reached.
IOException - If the first byte cannot be read for any reason other than end of
file, or if the input stream has been closed, or if some other
I/O error occurs.
NullPointerException - If b is null.
IndexOutOfBoundsException - If off is negative, len is negative, or
len is greater than b.length - off
StreamIntegrityException - if the final byte has been read and the HMAC fails validation
public void close()
throws IOException
close in interface Closeableclose in class InputStreamIOException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||