org.ccnx.ccn.protocol.Signature Class Reference

A class to encapsulate Signature data within a ContentObject. More...

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

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

 Signature (String digestAlgorithm, byte[] witness, byte[] signature)
 Build a Signature.
 Signature (byte[] witness, byte[] signature)
 Builds a Signature using the default digest algorithm.
 Signature (byte[] signature)
 Builds a Signature with the default digest algorithm and no witness.
 Signature ()
 For use by decoders.
final byte[] signature ()
 Get the signature.
final byte[] witness ()
 Get the witness.
String digestAlgorithm ()
 Get the digest algorithm.
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.
Signature clone ()
 Implement Cloneable.
int compareTo (Signature o)
 Implement Comparable.
int hashCode ()
boolean equals (Object obj)
byte[] computeProxy (byte[] nodeContent, boolean isDigest) throws CertificateEncodingException
 Compute the content proxy for a given node.

Package Attributes

byte[] _witness
byte[] _signature
String _digestAlgorithm


Detailed Description

A class to encapsulate Signature data within a ContentObject.

A Signature contains three components: the digestAlgorithm used to generate the digest, the bits of the signature itself, and an optional "witness" which is used in the verification of aggregated signatures -- signatures that are generated over multiple objects at once. Each object in such a signature group has its own witness, which is necessary to verify that object with respect to that signature. For example, if a set of content objects is digested into a Merkle hash tree, the signature bits for each member of set would contain the same public key signature on the root of the hash tree, and the witness would contain a representation of the path through the Merkle tree that one needs to traverse to verify that individual block.

For an explanation of why we separate the digest algorithm in the signature (rather than no algorithm at all, or a composite signature algorithm), see ccnx.xsd.


Constructor & Destructor Documentation

org.ccnx.ccn.protocol.Signature.Signature ( String  digestAlgorithm,
byte[]  witness,
byte[]  signature 
)

Build a Signature.

Parameters:
digestAlgorithm if null, will use default
witness can be null
signature 

org.ccnx.ccn.protocol.Signature.Signature ( byte[]  witness,
byte[]  signature 
)

Builds a Signature using the default digest algorithm.

Parameters:
witness can be null
signature 

org.ccnx.ccn.protocol.Signature.Signature ( byte[]  signature  ) 

Builds a Signature with the default digest algorithm and no witness.

Parameters:
signature 


Member Function Documentation

final byte [] org.ccnx.ccn.protocol.Signature.signature (  ) 

Get the signature.

Returns:
the signature

final byte [] org.ccnx.ccn.protocol.Signature.witness (  ) 

Get the witness.

Returns:
the witness

String org.ccnx.ccn.protocol.Signature.digestAlgorithm (  ) 

Get the digest algorithm.

Returns:
the digest algorithm

void org.ccnx.ccn.protocol.Signature.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.Signature.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.Signature.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.Signature.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.

byte [] org.ccnx.ccn.protocol.Signature.computeProxy ( byte[]  nodeContent,
boolean  isDigest 
) throws CertificateEncodingException

Compute the content proxy for a given node.

This should likely move somewhere else

Parameters:
nodeContent the content stored at this node
isDigest is the content already digested
Returns:
the proxy digest (for example, the computed root of the Merkle hash tree) for this node
Exceptions:
CertificateEncodingException if we cannot decode the witness


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