Public Types | |
enum | PublisherType { KEY = (CCNProtocolDTags.PublisherPublicKeyDigest), CERTIFICATE = (CCNProtocolDTags.PublisherCertificateDigest), ISSUER_KEY = (CCNProtocolDTags.PublisherIssuerKeyDigest), ISSUER_CERTIFICATE = (CCNProtocolDTags.PublisherIssuerCertificateDigest) } |
Encoded as an inline choice. More... | |
Public Member Functions | |
PublisherID (PublicKey key, boolean isIssuer) | |
Create a PublisherID specifying a public key as a signer or issuer. | |
PublisherID (X509Certificate cert, boolean isIssuer) throws CertificateEncodingException | |
Create a PublisherID specifying a public key in a certificate as a signer or issuer. | |
PublisherID (byte[] publisherID, PublisherType publisherType) | |
Create a PublisherID from a raw digest and a type. | |
PublisherID (PublisherPublicKeyDigest keyID) | |
Create a signer PublisherID from an existing PublisherPublicKeyDigest. | |
PublisherID () | |
For use by decoders. | |
byte[] | id () |
Get the id. | |
PublisherType | type () |
Get the type. | |
int | hashCode () |
boolean | equals (Object obj) |
boolean | isSigner () |
Type classification methods. | |
boolean | isCertifier () |
Type classification methods. | |
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 (PublisherID o) |
Implement Comparable. | |
String | toString () |
Default toString() implementation simply prints the text encoding of the object. | |
Static Public Member Functions | |
static boolean | isPublisherType (String name) |
Type classification methods. | |
static boolean | peek (XMLDecoder decoder) throws ContentDecodingException |
This is a choice. | |
static byte[] | generatePublicKeyDigest (PublicKey key) |
Helper method to generate a public key digest. | |
static byte[] | generateCertificateDigest (X509Certificate cert) throws CertificateEncodingException |
Helper method to generate a certificate digest. | |
static byte[] | generateCertificateDigest (String digestAlg, X509Certificate cert) throws CertificateEncodingException, NoSuchAlgorithmException |
Helper method to generate a certificate digest. | |
Static Public Attributes | |
static final String | PUBLISHER_ID_DIGEST_ALGORITHM = "SHA-256" |
Move this to a centralized configuration location. | |
static final int | PUBLISHER_ID_LEN = 256/8 |
Protected Attributes | |
byte[] | _publisherID |
PublisherType | _publisherType |
This encodes and decodes as one of 4 inline options, one of which also appears separately as the PublisherPublicKeyDigest.
Encoded as an inline choice.
Have to map from the type field to the encoding value.
org.ccnx.ccn.protocol.PublisherID.PublisherID | ( | PublicKey | key, | |
boolean | isIssuer | |||
) |
Create a PublisherID specifying a public key as a signer or issuer.
key | the key | |
isIssuer | false if it signed the content directly, true if it signed the key of the content signer |
org.ccnx.ccn.protocol.PublisherID.PublisherID | ( | X509Certificate | cert, | |
boolean | isIssuer | |||
) | throws CertificateEncodingException |
Create a PublisherID specifying a public key in a certificate as a signer or issuer.
cert | the certificate | |
isIssuer | false if it signed the content directly, true if it signed the key of the content signer |
org.ccnx.ccn.protocol.PublisherID.PublisherID | ( | byte[] | publisherID, | |
PublisherType | publisherType | |||
) |
Create a PublisherID from a raw digest and a type.
publisherID | the digest | |
publisherType | the type |
org.ccnx.ccn.protocol.PublisherID.PublisherID | ( | PublisherPublicKeyDigest | keyID | ) |
Create a signer PublisherID from an existing PublisherPublicKeyDigest.
keyID | the key digest |
byte [] org.ccnx.ccn.protocol.PublisherID.id | ( | ) |
Get the id.
PublisherType org.ccnx.ccn.protocol.PublisherID.type | ( | ) |
Get the type.
boolean org.ccnx.ccn.protocol.PublisherID.isSigner | ( | ) |
Type classification methods.
boolean org.ccnx.ccn.protocol.PublisherID.isCertifier | ( | ) |
Type classification methods.
static boolean org.ccnx.ccn.protocol.PublisherID.isPublisherType | ( | String | name | ) | [static] |
Type classification methods.
static boolean org.ccnx.ccn.protocol.PublisherID.peek | ( | XMLDecoder | decoder | ) | throws ContentDecodingException [static] |
This is a choice.
Make it possible for users of this class to peek it when it might be optional, without them having to know about the structure.
void org.ccnx.ccn.protocol.PublisherID.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.
void org.ccnx.ccn.protocol.PublisherID.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.
long org.ccnx.ccn.protocol.PublisherID.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.
boolean org.ccnx.ccn.protocol.PublisherID.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.
static byte [] org.ccnx.ccn.protocol.PublisherID.generatePublicKeyDigest | ( | PublicKey | key | ) | [static] |
Helper method to generate a public key digest.
key | the key to digest |
static byte [] org.ccnx.ccn.protocol.PublisherID.generateCertificateDigest | ( | X509Certificate | cert | ) | throws CertificateEncodingException [static] |
Helper method to generate a certificate digest.
cert | the certificate to digest |
CertificateEncodingException |
static byte [] org.ccnx.ccn.protocol.PublisherID.generateCertificateDigest | ( | String | digestAlg, | |
X509Certificate | cert | |||
) | throws CertificateEncodingException, NoSuchAlgorithmException [static] |
Helper method to generate a certificate digest.
digestAlg | the digest algorithm to use | |
cert | the certificate to digest |
CertificateEncodingException | ||
NoSuchAlgorithmException |
String org.ccnx.ccn.protocol.PublisherID.toString | ( | ) |
Default toString() implementation simply prints the text encoding of the object.
This demonstrates how to force use of the text encoding.
Reimplemented from org.ccnx.ccn.impl.encoding.GenericXMLEncodable.