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] |
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/*/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.
org.ccnx.ccn.protocol.SignedInfo.SignedInfo | ( | PublisherPublicKeyDigest | publisher, | |
KeyLocator | locator | |||
) |
Constructor.
publisher | ||
locator |
org.ccnx.ccn.protocol.SignedInfo.SignedInfo | ( | PublisherPublicKeyDigest | publisher, | |
ContentType | type, | |||
KeyLocator | locator | |||
) |
Constructor.
publisher | ||
type | ||
locator |
org.ccnx.ccn.protocol.SignedInfo.SignedInfo | ( | PublisherPublicKeyDigest | publisher, | |
CCNTime | timestamp, | |||
ContentType | type, | |||
KeyLocator | locator | |||
) |
Constructor.
publisher | ||
timestamp | ||
type | ||
locator |
org.ccnx.ccn.protocol.SignedInfo.SignedInfo | ( | PublisherPublicKeyDigest | publisher, | |
ContentType | type, | |||
KeyLocator | locator, | |||
Integer | freshnessSeconds, | |||
byte[] | finalBlockID | |||
) |
Constructor.
publisher | ||
type | ||
locator | ||
freshnessSeconds | ||
finalBlockID |
org.ccnx.ccn.protocol.SignedInfo.SignedInfo | ( | PublisherPublicKeyDigest | publisher, | |
CCNTime | timestamp, | |||
ContentType | type, | |||
KeyLocator | locator, | |||
Integer | freshnessSeconds, | |||
byte[] | finalBlockID | |||
) |
Constructor.
publisher | ||
timestamp | ||
type | ||
locator | ||
freshnessSeconds | ||
finalBlockID |
org.ccnx.ccn.protocol.SignedInfo.SignedInfo | ( | SignedInfo | other | ) |
Copy constructor.
other |
boolean org.ccnx.ccn.protocol.SignedInfo.emptyPublisher | ( | ) |
Do we have a publisher?
boolean org.ccnx.ccn.protocol.SignedInfo.defaultContentType | ( | ) |
True if we're using the default content type.
boolean org.ccnx.ccn.protocol.SignedInfo.emptyTimestamp | ( | ) |
Do we have a timestamp?
boolean org.ccnx.ccn.protocol.SignedInfo.emptyKeyLocator | ( | ) |
final byte [] org.ccnx.ccn.protocol.SignedInfo.getPublisher | ( | ) |
Return the publisher.
final CCNTime org.ccnx.ccn.protocol.SignedInfo.getTimestamp | ( | ) |
Get the timestamp.
final KeyLocator org.ccnx.ccn.protocol.SignedInfo.getKeyLocator | ( | ) |
final int org.ccnx.ccn.protocol.SignedInfo.getFreshnessSeconds | ( | ) |
Get the freshness seconds.
boolean org.ccnx.ccn.protocol.SignedInfo.emptyFreshnessSeconds | ( | ) |
Do we have a value for freshnessSeconds?
final byte [] org.ccnx.ccn.protocol.SignedInfo.getFinalBlockID | ( | ) |
Get the finalBlockID as binary.
boolean org.ccnx.ccn.protocol.SignedInfo.emptyFinalBlockID | ( | ) |
Do we have a finalBlockID set?
void org.ccnx.ccn.protocol.SignedInfo.setFinalBlockID | ( | byte[] | finalBlockID | ) |
Set the finalBlockID for this set of content segments.
finalBlockID | the new finalBlockID as binary |
void org.ccnx.ccn.protocol.SignedInfo.setType | ( | ContentType | type | ) |
Set the content type for this content object.
type |
final ContentType org.ccnx.ccn.protocol.SignedInfo.getType | ( | ) |
Get our content type.
String org.ccnx.ccn.protocol.SignedInfo.getTypeName | ( | ) |
Get the String representation of our content type.
static final String org.ccnx.ccn.protocol.SignedInfo.typeToName | ( | ContentType | type | ) | [static] |
String/enum conversions, unnecessary, will be removed.
type |
static final ContentType org.ccnx.ccn.protocol.SignedInfo.nameToType | ( | String | name | ) | [static] |
String/enum conversions, unnecessary, will be removed.
name |
byte [] org.ccnx.ccn.protocol.SignedInfo.getTypeValue | ( | ) |
Get our type as a binary value.
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.
type |
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.
value |
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.
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.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.
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.
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.
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.