home *** CD-ROM | disk | FTP | other *** search
Java Source | 1996-05-23 | 1.2 KB | 65 lines |
- // CryptConnection.java
- // Streams for what will be encrypted communications
- import java.io.InputStream;
- import java.io.OutputStream;
- import java.io.IOException;
- import java.io.EOFException;
- import LineInputStream;
- import LineOutputStream;
-
- public class CryptConnection
- {
- CryptInputStream in;
- CryptOutputStream out;
-
- CryptConnection(InputStream is, OutputStream os)
- {
- // Should do some setting up of key / etc...
- //
- in = new CryptInputStream(is);
- out = new CryptOutputStream(os);
- }
-
- public CryptInputStream getInputStream()
- {
- return in;
- }
-
- public CryptOutputStream getOutputStream()
- {
- return out;
- }
- }
-
- // CryptInputStream
- // Has the functionality of LineInputStream, plus overrides read to do
- // encryption.
- class CryptInputStream extends LineInputStream
- {
- CryptInputStream(InputStream i)
- {
- super(i);
- }
-
- /* can later do stuff like this :
- * public int read(bytes b[])
- * {
- * in.read(some bytes);
- * decrypt some bytes
- * store plaintext into b[]
- * }
- */
- }
-
- // CryptOutputStream
- // A stream with the functionality of LineOutputStream, plus overloading of
- // write() to do encryption.
- class CryptOutputStream extends LineOutputStream
- {
- CryptOutputStream(OutputStream i)
- {
- super(i);
- }
- }
-
-