|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.OutputStream
java.io.FilterOutputStream
org.logi.crypto.io.EncryptStream
This OutputStream encrypts everything written to it using the specified EncryptMode. It optionally first executes a non-interactive key-exchange protocol.
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.
DecryptStream
,
EncryptMode
Field Summary |
Fields inherited from class java.io.FilterOutputStream |
out |
Constructor Summary | |
EncryptStream(java.io.OutputStream out,
NoninterKeyExClient kex,
EncryptMode emode)
Create a new EncryptStream. |
Method Summary | |
void |
close()
Closes this output stream and releases any system resources associated with this stream. |
void |
execute(NoninterProtocolClient prot)
Executes a non-interactive protocol through the encrypted channel. |
void |
execute(NoninterProtocolClient prot,
boolean encrypt)
Executes a non-interactive protocol. |
void |
flush()
Flushes this output stream and forces any buffered output bytes to be written out to the stream. |
void |
write(byte[] buf,
int off,
int len)
Writes len bytes from the specified byte array starting at offset off to this output stream. |
void |
write(int b)
Writes the specified byte to this output stream. |
Methods inherited from class java.io.FilterOutputStream |
write |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public EncryptStream(java.io.OutputStream out, NoninterKeyExClient kex, EncryptMode emode) throws CryptoProtocolException, java.io.IOException
out
,
emode
is used for encryption and if kex
is not null it will be used to generate a session key and/or send it
to the server. See the various key-exchange client classes for
details.
Note that if kex
is not null, it controls which
session key is used and emode
receives the session key
when it has been decided. If kex
is null, then
emode
must be initialized with a key, and the same symmetric
key or matching asymmetric key must be used on the server.
CryptoProtocolException
- if a problem arises with the key-exchange protocol.
java.io.IOException
- if problems arise with the underlying OutputStream.Method Detail |
public void execute(NoninterProtocolClient prot, boolean encrypt) throws java.io.IOException, CryptoProtocolException
CryptoProtocolException
- if there is a problem with the protocol.
java.io.IOException
- if there is a problem with the underlying streams.public void execute(NoninterProtocolClient prot) throws java.io.IOException, CryptoProtocolException
CryptoProtocolException
- if there is a problem with the protocol.
java.io.IOException
- if there is a problem with the underlying streams.public void write(int b) throws java.io.IOException
java.io.IOException
public void write(byte[] buf, int off, int len) throws java.io.IOException
java.io.IOException
public void flush() throws java.io.IOException
It is possible to get rid of the random bytes by calling
drain()
in the DecryptStream
object at
the corresponding time.
java.io.IOException
DecryptStream.drain()
public void close() throws java.io.IOException
java.io.IOException
- if an I/O error occurs.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |