|
Rice Pastry API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.mpisws.p2p.transport.signature.CertificateTransprotLayerImpl<Identifier>
public class CertificateTransprotLayerImpl<Identifier>
TODO: make it store known certs to a file, make it periodically check the revocation server.
Field Summary | |
---|---|
static byte |
CERT_REQUEST
|
static byte |
CERT_RESPONSE
|
static byte |
CERT_RESPONSE_FAILED
|
static java.lang.String |
DEFAULT_SIGNATURE_ALGORITHM
|
static byte |
PASSTHROUGH
|
Constructor Summary | |
---|---|
CertificateTransprotLayerImpl(IdentifierSerializer<Identifier> iSerializer,
X509Serializer cSerializer,
java.security.cert.X509Certificate localCert,
java.security.PrivateKey localPrivate,
TransportLayer<Identifier,java.nio.ByteBuffer> tl,
Environment env)
|
Method Summary | |
---|---|
void |
acceptMessages(boolean b)
Toggle accepting incoming messages. |
void |
acceptSockets(boolean b)
Toggle accepting new sockets. |
void |
destroy()
|
Identifier |
getLocalIdentifier()
The local node. |
java.security.Signature |
getVerifier(Identifier i)
Returns null if we don't know the cert for the identifier. |
void |
handleCertRequest(P2PSocket<Identifier> sock)
|
boolean |
hasCertificate(Identifier i)
|
void |
incomingSocket(P2PSocket<Identifier> sock)
Notification of a new socket. |
void |
messageReceived(Identifier i,
java.nio.ByteBuffer m,
java.util.Map<java.lang.String,java.lang.Object> options)
Called when a new message is received. |
SocketRequestHandle<Identifier> |
openSocket(Identifier i,
SocketCallback<Identifier> deliverSocketToMe,
java.util.Map<java.lang.String,java.lang.Object> options)
Open a socket to the Identifier |
Cancellable |
requestCertificate(Identifier source,
Identifier 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 |
MessageRequestHandle<Identifier,java.nio.ByteBuffer> |
sendMessage(Identifier i,
java.nio.ByteBuffer m,
MessageCallback<Identifier,java.nio.ByteBuffer> deliverAckToMe,
java.util.Map<java.lang.String,java.lang.Object> options)
Send the message to the identifier |
void |
setCallback(TransportLayerCallback<Identifier,java.nio.ByteBuffer> callback)
Set the callback for incoming sockets/messages |
void |
setErrorHandler(ErrorHandler<Identifier> handler)
To be notified of problems not related to an outgoing messaage/socket. |
byte[] |
sign(byte[] bytes)
|
void |
verify(Identifier id,
byte[] msg,
int moff,
int mlen,
byte[] signature,
int soff,
int slen)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final byte PASSTHROUGH
public static final byte CERT_REQUEST
public static final byte CERT_RESPONSE
public static final byte CERT_RESPONSE_FAILED
public static final java.lang.String DEFAULT_SIGNATURE_ALGORITHM
Constructor Detail |
---|
public CertificateTransprotLayerImpl(IdentifierSerializer<Identifier> iSerializer, X509Serializer cSerializer, java.security.cert.X509Certificate localCert, java.security.PrivateKey localPrivate, TransportLayer<Identifier,java.nio.ByteBuffer> tl, Environment env) throws java.security.InvalidKeyException, java.security.NoSuchAlgorithmException, java.security.NoSuchProviderException
java.security.InvalidKeyException
java.security.NoSuchAlgorithmException
java.security.NoSuchProviderException
Method Detail |
---|
public Cancellable requestCertificate(Identifier source, Identifier principal, Continuation<java.security.cert.X509Certificate,java.lang.Exception> c, java.util.Map<java.lang.String,java.lang.Object> options)
requestCertificate
in interface CertificateManager<Identifier>
requestCertificate
in interface CertificateTransportLayer<Identifier,java.nio.ByteBuffer>
public SocketRequestHandle<Identifier> openSocket(Identifier i, SocketCallback<Identifier> deliverSocketToMe, java.util.Map<java.lang.String,java.lang.Object> options)
TransportLayer
openSocket
in interface TransportLayer<Identifier,java.nio.ByteBuffer>
i
- who to open the socket todeliverSocketToMe
- the callback when the socket is openedoptions
- options on how to open the socket (don't source route, encrypt etc) (may not be respected if layer cannot provide service)
public void incomingSocket(P2PSocket<Identifier> sock) throws java.io.IOException
TransportLayerCallback
incomingSocket
in interface TransportLayerCallback<Identifier,java.nio.ByteBuffer>
sock
- the incoming socket
java.io.IOException
public void handleCertRequest(P2PSocket<Identifier> sock)
public boolean hasCertificate(Identifier i)
hasCertificate
in interface CertificateManager<Identifier>
public void acceptMessages(boolean b)
TransportLayer
acceptMessages
in interface TransportLayer<Identifier,java.nio.ByteBuffer>
public void acceptSockets(boolean b)
TransportLayer
acceptSockets
in interface TransportLayer<Identifier,java.nio.ByteBuffer>
public Identifier getLocalIdentifier()
TransportLayer
getLocalIdentifier
in interface TransportLayer<Identifier,java.nio.ByteBuffer>
public MessageRequestHandle<Identifier,java.nio.ByteBuffer> sendMessage(Identifier i, java.nio.ByteBuffer m, MessageCallback<Identifier,java.nio.ByteBuffer> deliverAckToMe, java.util.Map<java.lang.String,java.lang.Object> options)
TransportLayer
sendMessage
in interface TransportLayer<Identifier,java.nio.ByteBuffer>
i
- the destinationm
- the messagedeliverAckToMe
- layer dependent notification when the message is sent (can indicate placed on the wire, point-to-point acknowledgment, or end-to-end acknowledgement)options
- delivery options (don't source route, encrypt etc) (may not be respected if layer cannot provide service)
public void setCallback(TransportLayerCallback<Identifier,java.nio.ByteBuffer> callback)
TransportLayer
setCallback
in interface TransportLayer<Identifier,java.nio.ByteBuffer>
callback
- the callback for incoming sockets/messagespublic void setErrorHandler(ErrorHandler<Identifier> handler)
TransportLayer
setErrorHandler
in interface TransportLayer<Identifier,java.nio.ByteBuffer>
handler
- to be notified of problems not related to a specific messaage/socket.public void destroy()
destroy
in interface Destructable
public void messageReceived(Identifier i, java.nio.ByteBuffer m, java.util.Map<java.lang.String,java.lang.Object> options) throws java.io.IOException
TransportLayerCallback
messageReceived
in interface TransportLayerCallback<Identifier,java.nio.ByteBuffer>
i
- The node it is coming fromm
- the messageoptions
- describe how the message arrived (udp/tcp, encrypted etc)
java.io.IOException
- if there is a problem decoding the messagepublic byte[] sign(byte[] bytes) throws java.security.SignatureException
sign
in interface CertificateManager<Identifier>
java.security.SignatureException
public void verify(Identifier id, byte[] msg, int moff, int mlen, byte[] signature, int soff, int slen) throws java.security.InvalidKeyException, java.security.NoSuchAlgorithmException, java.security.NoSuchProviderException, java.security.SignatureException, UnknownCertificateException
verify
in interface CertificateManager<Identifier>
java.security.InvalidKeyException
java.security.NoSuchAlgorithmException
java.security.NoSuchProviderException
java.security.SignatureException
UnknownCertificateException
public java.security.Signature getVerifier(Identifier i) throws java.security.NoSuchAlgorithmException, java.security.NoSuchProviderException, java.security.InvalidKeyException
i
-
java.security.NoSuchAlgorithmException
java.security.NoSuchProviderException
java.security.InvalidKeyException
|
Rice Pastry API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |