All Packages Class Hierarchy This Package Previous Next Index
Class is.logi.crypto.io.DecryptStream
java.lang.Object
|
+----java.io.InputStream
|
+----java.io.FilterInputStream
|
+----is.logi.crypto.io.DecryptStream
- public class DecryptStream
- extends FilterInputStream
Decrypt a stream of data encrypted with a corresponding EncryptStream
ojbect.
The DecryptStream must be initialized with a NoninterKeyExServer
object complementing the NoninterKeyExClient object used in the
EncryptStream and a DecryptMode object complementing the EncryptMode
object used in the DecryptStream.
- Author:
- Logi Ragnarsson
(logir@hi.is)
- See Also:
- EncryptStream
-
DecryptStream(InputStream, NoninterKeyExServer, DecryptMode)
- Create a new DecryptStream.
-
available()
- Returns the number of bytes that can be read from this input stream without blocking.
-
execute(NoninterProtocolServer)
- Executes a non-interactive protocol.
-
markSupported()
- Returns false.
-
read()
- Reads the next byte of data from this input stream.
-
read(byte[], int, int)
- Reads up to len bytes of data from this input stream into an array of
bytes.
-
skip(long)
- Skips over and discards n bytes of data from the input stream.
DecryptStream
public DecryptStream(InputStream in,
NoninterKeyExServer kex,
DecryptMode dmode) throws ProtocolException, IOException
- Create a new DecryptStream. Plaintext is written to
out
,
dmode
is used for decryption and if kex
is not null it will be used to receive the session key from the client.
Note that if kex
is not null, it controls which
session key is used and dmode
receives the session key
when it has been decided. If kex
is null, then
dmode
must be initialized with a key, and the same symmetric
key or matching asymmetric key must be used on the client.
- Throws: ProtocolException
- if a problem arises with the key-exchange protocol.
- Throws: IOException
- if problems arise with the underlying OutputStream.
execute
public void execute(NoninterProtocolServer prot) throws IOException, ProtocolException
- Executes a non-interactive protocol.
- Throws: ProtocolException
- if there is a problem with the protocol.
- Throws: IOException
- if there is a problem with the underlying streams.
read
public synchronized int read() throws IOException
- Reads the next byte of data from this input stream. The value
byte is returned as an int in the range 0 to 255. If no byte is
available because the end of the stream has been reached, the
value -1 is returned. This method blocks until input data is
available, the end of the stream is detected, or an exception
is thrown.
- Overrides:
- read in class FilterInputStream
read
public synchronized int read(byte b[],
int off,
int len) throws IOException
- Reads up to len bytes of data from this input stream into an array of
bytes. This method blocks until some input is available.
- Overrides:
- read in class FilterInputStream
skip
public synchronized long skip(long n) throws IOException
- Skips over and discards n bytes of data from the input stream. The
skip method may, for a variety of reasons, end up skipping over some
smaller number of bytes, possibly 0. The actual number of bytes
skipped is returned.
- Overrides:
- skip 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
markSupported
public boolean markSupported()
- Returns false.
- Overrides:
- markSupported in class FilterInputStream
All Packages Class Hierarchy This Package Previous Next Index