org.ccnx.ccn.protocol.SignedInfo Class Reference

SignedInfo is the metadata portion of a ContentObject that contains information about that object which is signed by the publisher. More...

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

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

List of all members.

Public Types

enum  ContentType {
  DATA, ENCR, GONE, KEY,
  LINK, NACK
}

Public Member Functions

 SignedInfo (PublisherPublicKeyDigest publisher, KeyLocator locator)
 Constructor.
 SignedInfo (PublisherPublicKeyDigest publisher, ContentType type, KeyLocator locator)
 Constructor.
 SignedInfo (PublisherPublicKeyDigest publisher, CCNTime timestamp, ContentType type, KeyLocator locator)
 Constructor.
 SignedInfo (PublisherPublicKeyDigest publisher, ContentType type, KeyLocator locator, Integer freshnessSeconds, byte[] finalBlockID)
 Constructor.
 SignedInfo (PublisherPublicKeyDigest publisher, CCNTime timestamp, ContentType type, KeyLocator locator, Integer freshnessSeconds, byte[] finalBlockID)
 Constructor.
 SignedInfo (SignedInfo other)
 Copy constructor.
 SignedInfo ()
 For decoders.
SignedInfo clone ()
 Implement Cloneable.
boolean emptyPublisher ()
 Do we have a publisher?
boolean defaultContentType ()
 True if we're using the default content type.
boolean emptyTimestamp ()
 Do we have a timestamp?
boolean emptyKeyLocator ()
 Do we have a key locator.
final byte[] getPublisher ()
 Return the publisher.
final PublisherPublicKeyDigest getPublisherKeyID ()
final CCNTime getTimestamp ()
 Get the timestamp.
final KeyLocator getKeyLocator ()
 Get the KeyLocator.
final int getFreshnessSeconds ()
 Get the freshness seconds.
boolean emptyFreshnessSeconds ()
 Do we have a value for freshnessSeconds?
final byte[] getFinalBlockID ()
 Get the finalBlockID as binary.
boolean emptyFinalBlockID ()
 Do we have a finalBlockID set?
void setFinalBlockID (byte[] finalBlockID)
 Set the finalBlockID for this set of content segments.
void setType (ContentType type)
 Set the content type for this content object.
final ContentType getType ()
 Get our content type.
String getTypeName ()
 Get the String representation of our content type.
byte[] getTypeValue ()
 Get our type as a binary value.
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 hashCode ()
boolean equals (Object obj)
String toString ()
 Default toString() implementation simply prints the text encoding of the object.

Static Public Member Functions

static final String typeToName (ContentType type)
 String/enum conversions, unnecessary, will be removed.
static final ContentType nameToType (String name)
 String/enum conversions, unnecessary, will be removed.
static final byte[] typeToValue (ContentType type)
 Convert between ContentType and its binary representation.
static final ContentType valueToType (byte[] value)
 Convert between ContentType and its binary representation.

Static Public Attributes

static final byte[] DATA_VAL = new byte[]{(byte)0x0c, (byte)0x04, (byte)0xc0}
static final byte[] ENCR_VAL = new byte[]{(byte)0x10, (byte)0xd0, (byte)0x91}
static final byte[] GONE_VAL = new byte[]{(byte)0x18, (byte)0xe3, (byte)0x44}
static final byte[] KEY_VAL = new byte[]{(byte)0x28, (byte)0x46, (byte)0x3f}
static final byte[] LINK_VAL = new byte[]{(byte)0x2c, (byte)0x83, (byte)0x4a}
static final byte[] NACK_VAL = new byte[]{(byte)0x34, (byte)0x00, (byte)0x8a}

Protected Attributes

PublisherPublicKeyDigest _publisher
CCNTime _timestamp
ContentType _type
KeyLocator _locator
Integer _freshnessSeconds
byte[] _finalBlockID

Static Protected Attributes

static final HashMap
< ContentType, String > 
ContentTypeNames = new HashMap<ContentType, String>()
static final HashMap< String,
ContentType > 
ContentNameTypes = new HashMap<String, ContentType>()
static final HashMap
< ContentType, byte[]> 
ContentTypeValues = new HashMap<ContentType, byte[]>()
static final HashMap< byte[],
ContentType > 
ContentValueTypes = new HashMap<byte[], ContentType>()

Static Package Functions

 [static initializer]


Detailed Description

SignedInfo is the metadata portion of a ContentObject that contains information about that object which is signed by the publisher.

It incluedes a timestamp, which doesn't imply a certified notion of time -- it requires loose consistency within that publisher only. It lets you order things with the same name, or signed by the same publisher. From the security point of view it acts primarily as a nonce, and we use a timestamp for it to make it slightly more useful than a random nonce.

You can think of the SignedInfo as
a) the stuff "about" a piece of CCN data that it is legal to expect routers to understand and use (as opposed to names, which are opaque), which is
b) pulled out as metadata rather than baked into the names both to allow this opaqueness and to deal with the fact that name matching is strictly component-wise ordered (you can't look for /parc/foo/&#42;/bar for reasons of routing efficiency, except through a slower search style interaction), and these items want to be matched in any order -- in other words, sometimes you want to find /obj/timestamp and sometimes /obj/publisher and you can't decide which should go first in the name.


Constructor & Destructor Documentation

org.ccnx.ccn.protocol.SignedInfo.SignedInfo ( PublisherPublicKeyDigest  publisher,
KeyLocator  locator 
)

Constructor.

Parameters:
publisher 
locator 

org.ccnx.ccn.protocol.SignedInfo.SignedInfo ( PublisherPublicKeyDigest  publisher,
ContentType  type,
KeyLocator  locator 
)

Constructor.

Parameters:
publisher 
type 
locator 

org.ccnx.ccn.protocol.SignedInfo.SignedInfo ( PublisherPublicKeyDigest  publisher,
CCNTime  timestamp,
ContentType  type,
KeyLocator  locator 
)

Constructor.

Parameters:
publisher 
timestamp 
type 
locator 

org.ccnx.ccn.protocol.SignedInfo.SignedInfo ( PublisherPublicKeyDigest  publisher,
ContentType  type,
KeyLocator  locator,
Integer  freshnessSeconds,
byte[]  finalBlockID 
)

Constructor.

Parameters:
publisher 
type 
locator 
freshnessSeconds 
finalBlockID 

org.ccnx.ccn.protocol.SignedInfo.SignedInfo ( PublisherPublicKeyDigest  publisher,
CCNTime  timestamp,
ContentType  type,
KeyLocator  locator,
Integer  freshnessSeconds,
byte[]  finalBlockID 
)

Constructor.

Parameters:
publisher 
timestamp 
type 
locator 
freshnessSeconds 
finalBlockID 

org.ccnx.ccn.protocol.SignedInfo.SignedInfo ( SignedInfo  other  ) 

Copy constructor.

Parameters:
other 


Member Function Documentation

boolean org.ccnx.ccn.protocol.SignedInfo.emptyPublisher (  ) 

Do we have a publisher?

Returns:
True if the publisher is empty

boolean org.ccnx.ccn.protocol.SignedInfo.defaultContentType (  ) 

True if we're using the default content type.

Returns:
true if we're using the default content type

boolean org.ccnx.ccn.protocol.SignedInfo.emptyTimestamp (  ) 

Do we have a timestamp?

Returns:
true if timestamp is empty, false if we have one

boolean org.ccnx.ccn.protocol.SignedInfo.emptyKeyLocator (  ) 

Do we have a key locator.

Returns:
true if KeyLocator is empty, false if we have one

final byte [] org.ccnx.ccn.protocol.SignedInfo.getPublisher (  ) 

Return the publisher.

Returns:
the publisher

final CCNTime org.ccnx.ccn.protocol.SignedInfo.getTimestamp (  ) 

Get the timestamp.

Returns:
the timestamp

final KeyLocator org.ccnx.ccn.protocol.SignedInfo.getKeyLocator (  ) 

Get the KeyLocator.

This is optional in encoding, and can be null

Returns:
the KeyLocator

final int org.ccnx.ccn.protocol.SignedInfo.getFreshnessSeconds (  ) 

Get the freshness seconds.

Returns:
the freshnessSeconds

boolean org.ccnx.ccn.protocol.SignedInfo.emptyFreshnessSeconds (  ) 

Do we have a value for freshnessSeconds?

Returns:
true if the freshnessSeconds is emtpy, false if it is set

final byte [] org.ccnx.ccn.protocol.SignedInfo.getFinalBlockID (  ) 

Get the finalBlockID as binary.

Returns:
the finalBlockID

boolean org.ccnx.ccn.protocol.SignedInfo.emptyFinalBlockID (  ) 

Do we have a finalBlockID set?

Returns:
true if the finalBlockID is empty, false if we have one set

void org.ccnx.ccn.protocol.SignedInfo.setFinalBlockID ( byte[]  finalBlockID  ) 

Set the finalBlockID for this set of content segments.

Parameters:
finalBlockID the new finalBlockID as binary

void org.ccnx.ccn.protocol.SignedInfo.setType ( ContentType  type  ) 

Set the content type for this content object.

Parameters:
type 

final ContentType org.ccnx.ccn.protocol.SignedInfo.getType (  ) 

Get our content type.

Returns:

String org.ccnx.ccn.protocol.SignedInfo.getTypeName (  ) 

Get the String representation of our content type.

Returns:

static final String org.ccnx.ccn.protocol.SignedInfo.typeToName ( ContentType  type  )  [static]

String/enum conversions, unnecessary, will be removed.

Parameters:
type 
Returns:

static final ContentType org.ccnx.ccn.protocol.SignedInfo.nameToType ( String  name  )  [static]

String/enum conversions, unnecessary, will be removed.

Parameters:
name 
Returns:

byte [] org.ccnx.ccn.protocol.SignedInfo.getTypeValue (  ) 

Get our type as a binary value.

Returns:
the binary value of our type

static final byte [] org.ccnx.ccn.protocol.SignedInfo.typeToValue ( ContentType  type  )  [static]

Convert between ContentType and its binary representation.

Unfortunately, straight hash table lookup doesn't work right on byte array keys. Have to do straight comparison. Could speed it up from linear search, but for 5 types, might not matter.

Parameters:
type 
Returns:
the binary value

static final ContentType org.ccnx.ccn.protocol.SignedInfo.valueToType ( byte[]  value  )  [static]

Convert between ContentType and its binary representation.

Unfortunately, straight hash table lookup doesn't work right on byte array keys. Have to do straight comparison. Could speed it up from linear search, but for 5 types, might not matter.

Parameters:
value 
Returns:
the ContentType

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

String org.ccnx.ccn.protocol.SignedInfo.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.


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