org.ccnx.ccn.protocol.PublisherID Class Reference

Helper wrapper class for publisher IDs. More...

List of all members.

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

Detailed Description

Helper wrapper class for publisher IDs.

This encodes and decodes as one of 4 inline options, one of which also appears separately as the PublisherPublicKeyDigest.


Member Enumeration Documentation

Encoded as an inline choice.

Have to map from the type field to the encoding value.


Constructor & Destructor Documentation

org.ccnx.ccn.protocol.PublisherID.PublisherID ( PublicKey  key,
boolean  isIssuer 
)

Create a PublisherID specifying a public key as a signer or issuer.

Parameters:
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.

Parameters:
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.

Parameters:
publisherID the digest
publisherType the type
org.ccnx.ccn.protocol.PublisherID.PublisherID ( PublisherPublicKeyDigest  keyID  ) 

Create a signer PublisherID from an existing PublisherPublicKeyDigest.

Parameters:
keyID the key digest

Member Function Documentation

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.

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.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.

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.

static byte [] org.ccnx.ccn.protocol.PublisherID.generateCertificateDigest ( String  digestAlg,
X509Certificate  cert 
) throws CertificateEncodingException, NoSuchAlgorithmException [static]

Helper method to generate a certificate digest.

Parameters:
digestAlg the digest algorithm to use
cert the certificate to digest
Returns:
the digest
Exceptions:
CertificateEncodingException 
NoSuchAlgorithmException 
static byte [] org.ccnx.ccn.protocol.PublisherID.generateCertificateDigest ( X509Certificate  cert  )  throws CertificateEncodingException [static]

Helper method to generate a certificate digest.

Parameters:
cert the certificate to digest
Returns:
the digest
Exceptions:
CertificateEncodingException 
static byte [] org.ccnx.ccn.protocol.PublisherID.generatePublicKeyDigest ( PublicKey  key  )  [static]

Helper method to generate a public key digest.

Parameters:
key the key to digest
Returns:
the digest
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.

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

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

byte [] org.ccnx.ccn.protocol.PublisherID.id (  ) 

Get the id.

Returns:
id
boolean org.ccnx.ccn.protocol.PublisherID.isCertifier (  ) 

Type classification methods.

Returns:
static boolean org.ccnx.ccn.protocol.PublisherID.isPublisherType ( String  name  )  [static]

Type classification methods.

Returns:
boolean org.ccnx.ccn.protocol.PublisherID.isSigner (  ) 

Type classification methods.

Returns:
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.

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.

PublisherType org.ccnx.ccn.protocol.PublisherID.type (  ) 

Get the type.

Returns:
type
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.

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.


The documentation for this class was generated from the following file:
Generated on Fri May 13 16:27:50 2011 for Content-Centric Networking in Java by  doxygen 1.6.3