net.cnri.dobj
Class DESEncryption

java.lang.Object
  extended by net.cnri.dobj.ConnectionEncryption
      extended by net.cnri.dobj.DESEncryption

public class DESEncryption
extends ConnectionEncryption

DESEncryption objects are capable of encrypting/decrypting data based on a secret key.


Constructor Summary
DESEncryption(DOConnection conn)
           
 
Method Summary
 void initParameters(HeaderSet request, HeaderSet response)
          Set up the encryption mechanism and put the parameters into the given HeaderSet so that they can be communicated to the other side.
 void processIncomingChunk(java.nio.ByteBuffer buf)
          Decrypts the incoming chunk of bytes and puts the result back into the given ByteBuffer for reading.
 java.nio.ByteBuffer processOutgoingChunk(java.nio.ByteBuffer buf)
          Processes the outgoing chunk of bytes and returns the processed version.
 void setParameters(HeaderSet parameters)
          Set up the parameters for the encryption/decryption process.
 
Methods inherited from class net.cnri.dobj.ConnectionEncryption
constructInstance, getRandom
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DESEncryption

public DESEncryption(DOConnection conn)
Method Detail

initParameters

public void initParameters(HeaderSet request,
                           HeaderSet response)
                    throws java.lang.Exception
Set up the encryption mechanism and put the parameters into the given HeaderSet so that they can be communicated to the other side. The "cryptsecretkey" parameter is encrypted using the public key that is included in the request argument.

Specified by:
initParameters in class ConnectionEncryption
Throws:
java.lang.Exception

setParameters

public void setParameters(HeaderSet parameters)
                   throws java.lang.Exception
Set up the parameters for the encryption/decryption process. The parameters should include a hex-encoded "secretkey" value, as well as an optional "cipherparams" value to indicate the algorithm

Throws:
java.lang.Exception

processIncomingChunk

public void processIncomingChunk(java.nio.ByteBuffer buf)
                          throws java.security.GeneralSecurityException
Description copied from class: ConnectionEncryption
Decrypts the incoming chunk of bytes and puts the result back into the given ByteBuffer for reading.

Specified by:
processIncomingChunk in class ConnectionEncryption
Throws:
java.security.GeneralSecurityException

processOutgoingChunk

public java.nio.ByteBuffer processOutgoingChunk(java.nio.ByteBuffer buf)
                                         throws java.security.GeneralSecurityException
Processes the outgoing chunk of bytes and returns the processed version. Note: This implementation re-uses the returned value so this method should not be called from multiple threads.

Specified by:
processOutgoingChunk in class ConnectionEncryption
Throws:
java.security.GeneralSecurityException
See Also:
ConnectionEncryption.processOutgoingChunk(ByteBuffer)