Rice Pastry API

org.mpisws.p2p.transport.peerreview.identity
Class IdentityTransportLayerImpl<Identifier,I>

java.lang.Object
  extended by org.mpisws.p2p.transport.table.TableTransprotLayerImpl<Identifier,I,java.security.cert.X509Certificate>
      extended by org.mpisws.p2p.transport.peerreview.identity.IdentityTransportLayerImpl<Identifier,I>
All Implemented Interfaces:
HashProvider, CertificateManager<Identifier,I>, IdentityTransport<Identifier,I>, PeerReviewConstants, StatusConstants, TableTransportLayer<Identifier,I,java.security.cert.X509Certificate>, TransportLayer<Identifier,java.nio.ByteBuffer>, TransportLayerCallback<Identifier,java.nio.ByteBuffer>, Destructable

public class IdentityTransportLayerImpl<Identifier,I>
extends TableTransprotLayerImpl<Identifier,I,java.security.cert.X509Certificate>
implements IdentityTransport<Identifier,I>

TODO: make it store known certs to a file, make it periodically check the revocation server. Extends the TableTLi, but uses Certs rather than general objects. Also, sends huge messages by opening temp tcp-socket.

Author:
Jeff Hoye

Field Summary
static java.lang.String DEFAULT_SIGNATURE_ALGORITHM
           
static short DEFAULT_SIGNATURE_SIZE
           
 
Fields inherited from class org.mpisws.p2p.transport.table.TableTransprotLayerImpl
callback, errorHandler, keySerializer, knownValues, logger, PASSTHROUGH, REQUEST, RESPONSE_FAILED, RESPONSE_SUCCESS, tl, valueSerializer
 
Fields inherited from interface org.mpisws.p2p.transport.peerreview.PeerReviewConstants
AUTH_CACHE_INTERVAL, CERT_MISSING, CHAL_AUDIT, CHAL_SEND, DEFAULT_AUDIT_INTERVAL_MILLIS, DEFAULT_AUTH_PUSH_INTERVAL_MILLIS, DEFAULT_CHECKPOINT_INTERVAL_MILLIS, DEFAULT_LOG_DOWNLOAD_TIMEOUT, DEFAULT_TIME_TOLERANCE_MILLIS, EVT_ACK, EVT_CHECKPOINT, EVT_CHOOSE_Q, EVT_CHOOSE_RAND, EVT_INIT, EVT_MAX_RESERVED, EVT_MAX_SOCKET_EVT, EVT_MIN_SOCKET_EVT, EVT_RECV, EVT_SEND, EVT_SENDSIGN, EVT_SIGN, EVT_SOCKET_CAN_READ, EVT_SOCKET_CAN_RW, EVT_SOCKET_CAN_WRITE, EVT_SOCKET_CLOSE, EVT_SOCKET_CLOSED, EVT_SOCKET_EXCEPTION, EVT_SOCKET_OPEN_INCOMING, EVT_SOCKET_OPEN_OUTGOING, EVT_SOCKET_OPENED_OUTGOING, EVT_SOCKET_READ, EVT_SOCKET_SHUTDOWN_OUTPUT, EVT_SOCKET_WRITE, EVT_VRF, EX_TYPE_ClosedChannel, EX_TYPE_IO, EX_TYPE_Unknown, FLAG_FULL_MESSAGES_ALL, FLAG_FULL_MESSAGES_SENDER, FLAG_INCLUDE_CHECKPOINT, INVALID, INVESTIGATION_INTERVAL_MILLIS, MAINTENANCE_INTERVAL_MILLIS, MAX_ACTIVE_AUDITS, MAX_ACTIVE_INVESTIGATIONS, MAX_ENTRIES_BETWEEN_CHECKPOINTS, MAX_STATUS_INFO, MAX_WITNESSED_NODES, MSG_ACCUSATION, MSG_ACK, MSG_AUTHPUSH, MSG_AUTHREQ, MSG_AUTHRESP, MSG_CHALLENGE, MSG_RESPONSE, MSG_USERDATA, MSG_USERDGRAM, NO_CERTIFICATE, PROGRESS_INTERVAL_MILLIS, PROOF_INCONSISTENT, PROOF_NONCONFORMANT, RESP_AUDIT, RESP_SEND, SIGNATURE_BAD, SIGNATURE_OK, STATE_SEND_AUDIT, STATE_WAIT_FOR_LOG, TI_AUTH_PUSH, TI_CHECKPOINT, TI_MAINTENANCE, TI_MAKE_PROGRESS, TI_MAX_RESERVED, TI_START_AUDITS, TI_STATUS_INFO, VALID
 
Fields inherited from interface org.mpisws.p2p.transport.peerreview.StatusConstants
STATUS_EXPOSED, STATUS_SUSPECTED, STATUS_TRUSTED
 
Constructor Summary
IdentityTransportLayerImpl(Serializer<I> iSerializer, X509Serializer cSerializer, I localId, java.security.cert.X509Certificate localCert, java.security.PrivateKey localPrivate, TransportLayer<Identifier,java.nio.ByteBuffer> tl, HashProvider hasher, Environment env)
           
 
Method Summary
 byte[] getEmptyHash()
           
 Environment getEnvironment()
           
 short getHashSizeBytes()
           
 short getSignatureSizeBytes()
           
 java.security.Signature getVerifier(I i)
          Returns null if we don't know the cert for the identifier.
 boolean hasCertificate(I i)
           
 byte[] hash(java.nio.ByteBuffer... hashMe)
           
 byte[] hash(long seq, short type, byte[] nodeHash, byte[] contentHash)
           
 Cancellable requestCertificate(Identifier source, I principal, Continuation<java.security.cert.X509Certificate,java.lang.Exception> c, java.util.Map<java.lang.String,java.lang.Object> options)
          CERT_REQUEST, int requestId, Identifier
 void setCallback(TransportLayerCallback<Identifier,java.nio.ByteBuffer> callback)
          Set the callback for incoming sockets/messages
 byte[] sign(byte[] bytes)
           
 int verify(I id, byte[] msg, byte[] signature)
           
 
Methods inherited from class org.mpisws.p2p.transport.table.TableTransprotLayerImpl
acceptMessages, acceptSockets, destroy, getLocalIdentifier, handleValueRequest, hasKey, incomingSocket, messageReceived, openSocket, requestValue, sendMessage, setErrorHandler
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.mpisws.p2p.transport.TransportLayer
acceptMessages, acceptSockets, getLocalIdentifier, openSocket, sendMessage, setErrorHandler
 
Methods inherited from interface rice.Destructable
destroy
 

Field Detail

DEFAULT_SIGNATURE_ALGORITHM

public static final java.lang.String DEFAULT_SIGNATURE_ALGORITHM
See Also:
Constant Field Values

DEFAULT_SIGNATURE_SIZE

public static final short DEFAULT_SIGNATURE_SIZE
See Also:
Constant Field Values
Constructor Detail

IdentityTransportLayerImpl

public IdentityTransportLayerImpl(Serializer<I> iSerializer,
                                  X509Serializer cSerializer,
                                  I localId,
                                  java.security.cert.X509Certificate localCert,
                                  java.security.PrivateKey localPrivate,
                                  TransportLayer<Identifier,java.nio.ByteBuffer> tl,
                                  HashProvider hasher,
                                  Environment env)
                           throws java.security.InvalidKeyException,
                                  java.security.NoSuchAlgorithmException,
                                  java.security.NoSuchProviderException
Throws:
java.security.InvalidKeyException
java.security.NoSuchAlgorithmException
java.security.NoSuchProviderException
Method Detail

setCallback

public void setCallback(TransportLayerCallback<Identifier,java.nio.ByteBuffer> callback)
Description copied from interface: TransportLayer
Set the callback for incoming sockets/messages

Specified by:
setCallback in interface TransportLayer<Identifier,java.nio.ByteBuffer>
Overrides:
setCallback in class TableTransprotLayerImpl<Identifier,I,java.security.cert.X509Certificate>
Parameters:
callback - the callback for incoming sockets/messages

requestCertificate

public Cancellable requestCertificate(Identifier source,
                                      I principal,
                                      Continuation<java.security.cert.X509Certificate,java.lang.Exception> c,
                                      java.util.Map<java.lang.String,java.lang.Object> options)
CERT_REQUEST, int requestId, Identifier

Specified by:
requestCertificate in interface CertificateManager<Identifier,I>

hasCertificate

public boolean hasCertificate(I i)
Specified by:
hasCertificate in interface CertificateManager<Identifier,I>

sign

public byte[] sign(byte[] bytes)
Specified by:
sign in interface CertificateManager<Identifier,I>

verify

public int verify(I id,
                  byte[] msg,
                  byte[] signature)
Specified by:
verify in interface CertificateManager<Identifier,I>

getVerifier

public java.security.Signature getVerifier(I i)
Returns null if we don't know the cert for the identifier.

Parameters:
i -
Returns:
Throws:
java.security.NoSuchAlgorithmException
java.security.NoSuchProviderException
java.security.InvalidKeyException

getSignatureSizeBytes

public short getSignatureSizeBytes()
Specified by:
getSignatureSizeBytes in interface CertificateManager<Identifier,I>

getEmptyHash

public byte[] getEmptyHash()
Specified by:
getEmptyHash in interface HashProvider

getHashSizeBytes

public short getHashSizeBytes()
Specified by:
getHashSizeBytes in interface HashProvider

hash

public byte[] hash(long seq,
                   short type,
                   byte[] nodeHash,
                   byte[] contentHash)
Specified by:
hash in interface HashProvider

hash

public byte[] hash(java.nio.ByteBuffer... hashMe)
Specified by:
hash in interface HashProvider

getEnvironment

public Environment getEnvironment()
Specified by:
getEnvironment in interface IdentityTransport<Identifier,I>

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection