Rice Pastry API

org.mpisws.p2p.transport.rc4
Class EncryptedSocket<Identifier>

java.lang.Object
  extended by org.mpisws.p2p.transport.util.SocketWrapperSocket<Identifier,Identifier>
      extended by org.mpisws.p2p.transport.rc4.EncryptedSocket<Identifier>
All Implemented Interfaces:
P2PSocket<Identifier>, P2PSocketReceiver<Identifier>

public class EncryptedSocket<Identifier>
extends SocketWrapperSocket<Identifier,Identifier>


Field Summary
 javax.crypto.Cipher decryptCipher
           
 javax.crypto.Cipher encryptCipher
           
 
Fields inherited from class org.mpisws.p2p.transport.util.SocketWrapperSocket
errorHandler, identifier, logger, options, reader, socket, writer
 
Constructor Summary
EncryptedSocket(Identifier identifier, P2PSocket<Identifier> socket, Logger logger, ErrorHandler<Identifier> handler, java.util.Map<java.lang.String,java.lang.Object> options, javax.crypto.Cipher encryptCipher, javax.crypto.Cipher decryptCipher, int writeBufferSize)
           
 
Method Summary
 long read(java.nio.ByteBuffer output)
          Reads a sequence of bytes from this channel into a subsequence of the given buffer.
 void receiveSelectResult(P2PSocket<Identifier> socket, boolean canRead, boolean canWrite)
          Called when a socket is available for read/write
 long write(java.nio.ByteBuffer srcs)
          Writes a sequence of bytes to this channel from a subsequence of the given buffers.
protected  long writeHelper(java.nio.ByteBuffer srcs)
          Only to be called holding the encryptedWriteBuffer, probably should only be called from this.write()
 
Methods inherited from class org.mpisws.p2p.transport.util.SocketWrapperSocket
close, getIdentifier, getOptions, receiveException, register, shutdownOutput, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

encryptCipher

public javax.crypto.Cipher encryptCipher

decryptCipher

public javax.crypto.Cipher decryptCipher
Constructor Detail

EncryptedSocket

public EncryptedSocket(Identifier identifier,
                       P2PSocket<Identifier> socket,
                       Logger logger,
                       ErrorHandler<Identifier> handler,
                       java.util.Map<java.lang.String,java.lang.Object> options,
                       javax.crypto.Cipher encryptCipher,
                       javax.crypto.Cipher decryptCipher,
                       int writeBufferSize)
Method Detail

read

public long read(java.nio.ByteBuffer output)
          throws java.io.IOException
Description copied from interface: P2PSocket
Reads a sequence of bytes from this channel into a subsequence of the given buffer.

Specified by:
read in interface P2PSocket<Identifier>
Overrides:
read in class SocketWrapperSocket<Identifier,Identifier>
Returns:
Throws:
java.io.IOException

write

public long write(java.nio.ByteBuffer srcs)
           throws java.io.IOException
Description copied from interface: P2PSocket
Writes a sequence of bytes to this channel from a subsequence of the given buffers.

Specified by:
write in interface P2PSocket<Identifier>
Overrides:
write in class SocketWrapperSocket<Identifier,Identifier>
Throws:
java.io.IOException

writeHelper

protected long writeHelper(java.nio.ByteBuffer srcs)
                    throws java.io.IOException
Only to be called holding the encryptedWriteBuffer, probably should only be called from this.write()

Parameters:
srcs -
Returns:
Throws:
java.io.IOException

receiveSelectResult

public void receiveSelectResult(P2PSocket<Identifier> socket,
                                boolean canRead,
                                boolean canWrite)
                         throws java.io.IOException
Description copied from interface: P2PSocketReceiver
Called when a socket is available for read/write

Specified by:
receiveSelectResult in interface P2PSocketReceiver<Identifier>
Overrides:
receiveSelectResult in class SocketWrapperSocket<Identifier,Identifier>
Throws:
java.io.IOException

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection