Wrapper class around the digest of public keys used as a publisher identifier in ContentObjects. More...
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 |
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).
org.ccnx.ccn.protocol.PublisherPublicKeyDigest.PublisherPublicKeyDigest | ( | PublicKey | key | ) |
Create a PublisherPublicKeyDigest from a PublicKey.
key | the key |
org.ccnx.ccn.protocol.PublisherPublicKeyDigest.PublisherPublicKeyDigest | ( | byte[] | publisherPublicKeyDigest | ) |
Create a PublisherPublicKeyDigest from an existing digest.
publisherPublicKeyDigest | the key |
org.ccnx.ccn.protocol.PublisherPublicKeyDigest.PublisherPublicKeyDigest | ( | String | publisherPublicKeyDigest | ) | throws IOException |
Expects the equivalent of publisherKeyID.toString.
publisherPublicKeyDigest | the string representation of the digest. |
IOException |
int org.ccnx.ccn.protocol.PublisherPublicKeyDigest.compareTo | ( | PublisherPublicKeyDigest | o | ) |
Implement Comparable.
o | the other thing to compare to |
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.
buf | input stream to read from |
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. |
buf | input stream to read from | |
codec | the codec to use; must be recognized by XMLCodecFactory |
ContentDecodingException | if there is an error decoding the content |
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.
byte [] org.ccnx.ccn.protocol.PublisherPublicKeyDigest.digest | ( | ) |
Return the digest.
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.
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.
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.
URISyntaxException | ||
DotDotComponent |
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.
Implements org.ccnx.ccn.impl.encoding.GenericXMLEncodable.
String org.ccnx.ccn.protocol.PublisherPublicKeyDigest.shortFingerprint | ( | ) |
A short string representation of the key.
Really want PGP fingerprints.
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.
Implements org.ccnx.ccn.impl.encoding.GenericXMLEncodable.