net.sourceforge.blowfishj
Class BlowfishOutputStream

java.lang.Object
  extended byjava.io.OutputStream
      extended bynet.sourceforge.blowfishj.BlowfishOutputStream

public class BlowfishOutputStream
extends java.io.OutputStream

An output stream that encrypts data using the Blowfish algorithm in CBC mode, padded with PCKS7. Provided key material is hashed to a 160bit final key using SHA-1.

Author:
original version by Dale Anson

Constructor Summary
BlowfishOutputStream(byte[] key, int nOfs, int nLen, java.io.OutputStream os)
          Default constructor.
BlowfishOutputStream(java.lang.String sPassPhrase, java.io.OutputStream os)
          Deprecated. due to the restrictions in usage and the discarding of some original key material it is highly recommended not to use it anymore
 
Method Summary
 void close()
           
 void flush()
           
 void write(int nByte)
           
 
Methods inherited from class java.io.OutputStream
write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BlowfishOutputStream

public BlowfishOutputStream(byte[] key,
                            int nOfs,
                            int nLen,
                            java.io.OutputStream os)
                     throws java.io.IOException
Default constructor. The key material gets transformed to a final 160bit key using SHA-1.

Parameters:
key - key buffer
nOfs - where the key material starts
nLen - size of the key material (in bytes)
os - the output stream to which bytes will be written
Throws:
java.io.IOException - if the IV couldn't be written

BlowfishOutputStream

public BlowfishOutputStream(java.lang.String sPassPhrase,
                            java.io.OutputStream os)
                     throws java.io.IOException
Deprecated. due to the restrictions in usage and the discarding of some original key material it is highly recommended not to use it anymore

Constructor using a string. The ASCII character values of the string are hashed with SHA-1, the digest is used as the final key.

Parameters:
sPassPhrase - the passphrase
os - the output stream to which bytes will be written
Throws:
java.io.IOException - if the IV couldn't be written
Method Detail

write

public void write(int nByte)
           throws java.io.IOException
Throws:
java.io.IOException
See Also:
OutputStream.write(int)

close

public void close()
           throws java.io.IOException
Throws:
java.io.IOException
See Also:
InputStream.close()

flush

public void flush()
           throws java.io.IOException
Throws:
java.io.IOException
See Also:
OutputStream.flush()


Copyright © 2004-2005 Sourceforge. All Rights Reserved.