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

Variable Index

 o blockSize
 o blockType
 o DATA
 o data
 o dataPos
 o EOF
 o key
 o KEY
 o keyRing
 o SESSION_KEY
 o sKey
 o source
 o UNKNOWN

Constructor Index

 o DecryptStream(InputStream, Key, KeyRing)
Create a new stream which decrypts data from in.

Method Index

 o available()
Returns the number of bytes that can be read from this input stream without blocking.
 o close()
Closes this input stream and releases any system resources associated with the stream.
 o getBlock(boolean)
Reads the next block of encrypted data from the input stream.
 o mark(int)
Marks the current position in this input stream: NOT SUPPORTED.
 o markSupported()
Returns false, signifying that mark and reset is not supported.
 o read()
Reads the next byte of data from this input stream.
 o read(byte[])
Reads up to b.length bytes of data from this input stream into an array of bytes.
 o read(byte[], int, int)
Reads up to len bytes of data from this input stream into an array of bytes.
 o reset()
Repositions this stream to the position at the time the mark method was last called on this input stream.: NOT SUPPRTED

Variables

 o data
 private Data data
 o source
 private Data source
 o dataPos
 private int dataPos
 o blockSize
 private int blockSize
 o blockType
 private int blockType
 o UNKNOWN
 private final int UNKNOWN
 o EOF
 private final int EOF
 o SESSION_KEY
 private final int SESSION_KEY
 o KEY
 private final int KEY
 o DATA
 private final int DATA
 o key
 private Key key
 o sKey
 private Key sKey
 o keyRing
 private KeyRing keyRing

Constructors

 o 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.

Methods

 o 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
 o 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
 o 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.

 o read
 public synchronized int read() throws IOException
Reads the next byte of data from this input stream.

Overrides:
read in class FilterInputStream
 o 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
 o 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
 o markSupported
 public synchronized boolean markSupported()
Returns false, signifying that mark and reset is not supported.

Overrides:
markSupported in class FilterInputStream
 o mark
 public synchronized void mark(int readLimit)
Marks the current position in this input stream: NOT SUPPORTED.

Overrides:
mark in class FilterInputStream
 o 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