org.ccnx.ccn.protocol.PublisherPublicKeyDigest Class Reference

Wrapper class around the digest of public keys used as a publisher identifier in ContentObjects. More...

Inheritance diagram for org.ccnx.ccn.protocol.PublisherPublicKeyDigest:

org.ccnx.ccn.impl.encoding.GenericXMLEncodable org.ccnx.ccn.impl.encoding.XMLEncodable org.ccnx.ccn.impl.encoding.XMLEncodable

List of all members.

Public Member Functions

 PublisherPublicKeyDigest (PublicKey key)
 Create a PublisherPublicKeyDigest from a PublicKey.
 PublisherPublicKeyDigest (byte[] publisherPublicKeyDigest)
 Create a PublisherPublicKeyDigest from an existing digest.
 PublisherPublicKeyDigest (String publisherPublicKeyDigest) throws IOException
 Expects the equivalent of publisherKeyID.toString.
 PublisherPublicKeyDigest ()
 For use by decoders.
byte[] digest ()
 Return the digest.
int hashCode ()
boolean equals (PublisherID publisher)
boolean equals (Object obj)
void decode (XMLDecoder decoder) throws ContentDecodingException
 Decode this object as the top-level item in a new XML document, reading it from a network buffer.
void encode (XMLEncoder encoder) throws ContentEncodingException
 Encode this object during an ongoing encoding pass; this is what subclasses generally need to know how to implement.
long getElementLabel ()
 Allow the encoder/decoder to retrieve the top-level element name programmatically.
boolean validate ()
 Make sure all of the necessary fields are filled in prior to attempting to encode.
int compareTo (PublisherPublicKeyDigest o)
 Implement Comparable.
String toString ()
 The string representation is base64Binary (RFC 2045, section 6.8).
String shortFingerprint ()
 A short string representation of the key.

Static Public Member Functions

static PublisherPublicKeyDigest fromURIEncoded (String uriEncoded) throws DotDotComponent, URISyntaxException
 Parses a URI-encoded key ID, with an optional keyid: command marker.
static PublisherPublicKeyDigest fromCertificate (X509Certificate certificate)
 Gets a PublisherPublicKeyDigest for the public key in an X509Certificate.

Protected Attributes

byte[] _publisherPublicKeyDigest


Detailed Description

Wrapper class around the digest of public keys used as a publisher identifier in ContentObjects.

The digest algorithm used to compute publisherKeyIDs is specified by the CCNx protocol, and changes rarely with the CCNx protocol version (for example, now it is SHA-256, it will shift to SHA-3). As this is a convenience filtering mechanism to help consumers retrieve content signed by the specific publishers they want, failure in the digest algorithm used will only decrease the efficiency of this filtering method, or potentially help an attacker prevent a user from finding legitimate content. It will never cause the consumer to accept invalid content. We therefore opted to make this one of the small number of fixed-algorithm components in CCNx, to vastly simplify what is required of network routers that have to check and interpret this field.

To generate a PublisherPublicKeyDigest, we use the digest of the encoded PublicKey (the encoded SubjectPublicKeyInfo).


Constructor & Destructor Documentation

org.ccnx.ccn.protocol.PublisherPublicKeyDigest.PublisherPublicKeyDigest ( PublicKey  key  ) 

Create a PublisherPublicKeyDigest from a PublicKey.

Parameters:
key the key

org.ccnx.ccn.protocol.PublisherPublicKeyDigest.PublisherPublicKeyDigest ( byte[]  publisherPublicKeyDigest  ) 

Create a PublisherPublicKeyDigest from an existing digest.

Parameters:
publisherPublicKeyDigest the key

org.ccnx.ccn.protocol.PublisherPublicKeyDigest.PublisherPublicKeyDigest ( String  publisherPublicKeyDigest  )  throws IOException

Expects the equivalent of publisherKeyID.toString.

Parameters:
publisherPublicKeyDigest the string representation of the digest.
Exceptions:
IOException 


Member Function Documentation

static PublisherPublicKeyDigest org.ccnx.ccn.protocol.PublisherPublicKeyDigest.fromURIEncoded ( String  uriEncoded  )  throws DotDotComponent, URISyntaxException [static]

Parses a URI-encoded key ID, with an optional keyid: command marker.

Exceptions:
URISyntaxException 
DotDotComponent 

byte [] org.ccnx.ccn.protocol.PublisherPublicKeyDigest.digest (  ) 

Return the digest.

Returns:
the digest itself

void org.ccnx.ccn.protocol.PublisherPublicKeyDigest.decode ( XMLDecoder  decoder  )  throws ContentDecodingException [virtual]

Decode this object as the top-level item in a new XML document, reading it from a network buffer.

Reads document start and end. Assumes default encoding.

Parameters:
buf input stream to read from
Exceptions:
ContentDecodingException if there is an error decoding the content Decode this object as the top-level item in a new XML document, reading it from a network buffer. Reads document start and end.
Parameters:
buf input stream to read from
codec the codec to use; must be recognized by XMLCodecFactory
Exceptions:
ContentDecodingException if there is an error decoding the content
See also:
XMLCodecFactory Decode this object during an ongoing decoding pass; this is what subclasses generally need to know how to implement. Reads just the object itself, higher-level processes have handled start and end document if need be. Allows object to be read using the same code whether it is a top-level element written alone, or nested inside another element.
Parameters:
decoder the decoder being used; encapsulates state including the codec being used as well as the input source and current offset

Implements org.ccnx.ccn.impl.encoding.GenericXMLEncodable.

void org.ccnx.ccn.protocol.PublisherPublicKeyDigest.encode ( XMLEncoder  encoder  )  throws ContentEncodingException [virtual]

Encode this object during an ongoing encoding pass; this is what subclasses generally need to know how to implement.

Writes just the object itself, higher-level processes have handled start and end document if need be. Allows object to be written using the same code whether it is a top-level element written alone, or nested inside another element.

Parameters:
encoder the encoder being used; encapsulates state including the codec being used as well as the output destination and current offset

Implements org.ccnx.ccn.impl.encoding.GenericXMLEncodable.

long org.ccnx.ccn.protocol.PublisherPublicKeyDigest.getElementLabel (  )  [virtual]

Allow the encoder/decoder to retrieve the top-level element name programmatically.

This allows subclasses to rename elements without changing their encoder/decoders.

Returns:
the element label to use, as a key in a loaded encoding dictionary

Implements org.ccnx.ccn.impl.encoding.GenericXMLEncodable.

boolean org.ccnx.ccn.protocol.PublisherPublicKeyDigest.validate (  )  [virtual]

Make sure all of the necessary fields are filled in prior to attempting to encode.

All implementations of encode(XMLEncoder) should call this for their classes prior to encoding.

Returns:
true if object is valid and can be encoded, false if there is a problem; for example mandatory fields are uninitialized

Implements org.ccnx.ccn.impl.encoding.GenericXMLEncodable.

int org.ccnx.ccn.protocol.PublisherPublicKeyDigest.compareTo ( PublisherPublicKeyDigest  o  ) 

Implement Comparable.

Parameters:
o the other thing to compare to
Returns:
-1, 0 or 1 depending on whether we are before, equal to or lexicographically after o

String org.ccnx.ccn.protocol.PublisherPublicKeyDigest.shortFingerprint (  ) 

A short string representation of the key.

Really want PGP fingerprints.

Returns:


The documentation for this class was generated from the following file:

Generated on Thu Feb 16 00:45:07 2012 for Content-Centric Networking in Java by  doxygen 1.5.6