All Packages Class Hierarchy This Package Previous Next Index
Class IS.hi.logir.cryptonite.DecryptStream
java.lang.Object
|
+----java.io.InputStream
|
+----java.io.FilterInputStream
|
+----IS.hi.logir.cryptonite.DecryptStream
- public final class DecryptStream
- extends FilterInputStream
This class is a FilterInputStream that decrypts a stream of bytes similar to that
generated by EncryptStream. The format of the encrypted stream is shown in the
documantation for EncryptStream.
- Author:
- Logi Ragnarsson (logir@hi.is)
- See Also:
- Key, EncryptStream
-
blockSize
-
-
blockType
-
-
DATA
-
-
data
-
-
dataPos
-
-
EOF
-
-
key
-
-
KEY
-
-
keyRing
-
-
SESSION_KEY
-
-
sKey
-
-
source
-
-
UNKNOWN
-
-
DecryptStream(InputStream, Key, KeyRing)
- Create a new stream which decrypts data from in.
-
available()
-
Returns the number of bytes that can be read from
this input stream without blocking.
-
close()
- Closes this input stream and releases any system resources associated with the stream.
-
getBlock(boolean)
- Reads the next block of encrypted data from the input stream.
-
mark(int)
- Marks the current position in this input stream: NOT SUPPORTED.
-
markSupported()
- Returns false, signifying that mark and reset is not supported.
-
read()
- Reads the next byte of data from this input stream.
-
read(byte[])
- Reads up to b.length bytes of data from this input stream into an array of bytes.
-
read(byte[], int, int)
- Reads up to len bytes of data from this input stream into an array of bytes.
-
reset()
- Repositions this stream to the position at the time the mark
method was last called on this input stream.: NOT SUPPRTED
data
private Data data
source
private Data source
dataPos
private int dataPos
blockSize
private int blockSize
blockType
private int blockType
UNKNOWN
private final int UNKNOWN
EOF
private final int EOF
SESSION_KEY
private final int SESSION_KEY
KEY
private final int KEY
DATA
private final int DATA
key
private Key key
sKey
private Key sKey
keyRing
private KeyRing keyRing
DecryptStream
public DecryptStream(InputStream in,
Key key,
KeyRing keyRing)
- Create a new stream which decrypts data from in. If a key is specified, it will be
used to decrypt the data. If the encrypted stream contains a key identifier for another
key, then keyRing is used to find the key.
If key is null, then the encrypted data is assumed to contain a key identifier
to specify a key in keyRing.
If keyRing is null, then the encrypted data is assumed to be incrypted with the
specified key.
Setting both key and keyRing to null is an error.
close
public synchronized void close() throws IOException
- Closes this input stream and releases any system resources associated with the stream.
- Overrides:
- close in class FilterInputStream
available
public synchronized int available() throws IOException
- Returns the number of bytes that can be read from
this input stream without blocking.
- Overrides:
- available in class FilterInputStream
getBlock
private synchronized void getBlock(boolean waitIfBlocked) throws IOException, BadKeyClassException
- Reads the next block of encrypted data from the input stream.
If waitIfBlocked is true the method will block if data can
not be read from the underlying stream immediately.
read
public synchronized int read() throws IOException
- Reads the next byte of data from this input stream.
- Overrides:
- read in class FilterInputStream
read
public synchronized int read(byte b[]) throws IOException
- Reads up to b.length bytes of data from this input stream into an array of bytes.
- Overrides:
- read in class FilterInputStream
read
public synchronized int read(byte b[],
int off,
int len) throws IOException, CryptoException
- Reads up to len bytes of data from this input stream into an array of bytes.
- Overrides:
- read in class FilterInputStream
markSupported
public synchronized boolean markSupported()
- Returns false, signifying that mark and reset is not supported.
- Overrides:
- markSupported in class FilterInputStream
mark
public synchronized void mark(int readLimit)
- Marks the current position in this input stream: NOT SUPPORTED.
- Overrides:
- mark in class FilterInputStream
reset
public synchronized void reset()
- Repositions this stream to the position at the time the mark
method was last called on this input stream.: NOT SUPPRTED
- Overrides:
- reset in class FilterInputStream
All Packages Class Hierarchy This Package Previous Next Index