org.ccnx.ccn.impl.security.crypto.MerklePath Class Reference

A representation of a path through a MerkleTree. More...

List of all members.

Public Member Functions

 MerklePath (int leafNodeIndex, DEROctetString[] path)
 Create a MerklePath for a given leaf.
 MerklePath (byte[] derEncodedPath) throws CertificateEncodingException
 Decode a DER encoded MerklePath.
byte[] root (byte[] nodeContent, boolean isDigest)
 Take the content block for which this is the MerklePath, and compute the root digest for verification.
DEROctetString entry (int i)
 Get an in the path, where i is the index into the path array.
int leafNodeIndex ()
 Return the leaf node this path is for.
int pathLength ()
byte[] derEncodedPath ()
 DER-encode the path.
int hashCode ()
boolean equals (Object obj)

Static Public Member Functions

static boolean isMerklePath (DigestInfo info)
 Determine whether a given DigestInfo contains a MerklePath.

Protected Member Functions

byte[] computeParent (int node, int length, byte[] pathDigest)
 Compute the parent digest of the current node.

Package Attributes

int _leafNodeIndex
DEROctetString[] _path = null


Detailed Description

A representation of a path through a MerkleTree.

Constructor & Destructor Documentation

org.ccnx.ccn.impl.security.crypto.MerklePath.MerklePath ( int  leafNodeIndex,
DEROctetString[]  path 
)

Create a MerklePath for a given leaf.

Parameters:
leafNodeIndex the leaf index
path the node digests necessary to verify that leaf

org.ccnx.ccn.impl.security.crypto.MerklePath.MerklePath ( byte[]  derEncodedPath  )  throws CertificateEncodingException

Decode a DER encoded MerklePath.

Parameters:
derEncodedPath the encoded path
Exceptions:
CertificateEncodingException if there is a decoding error


Member Function Documentation

byte [] org.ccnx.ccn.impl.security.crypto.MerklePath.computeParent ( int  node,
int  length,
byte[]  pathDigest 
) [protected]

Compute the parent digest of the current node.

Parameters:
node the current node
length the length of the path at this point
pathDigest the previously computed digest along this path
Returns:
the parent digest

byte [] org.ccnx.ccn.impl.security.crypto.MerklePath.root ( byte[]  nodeContent,
boolean  isDigest 
)

Take the content block for which this is the MerklePath, and compute the root digest for verification.

The caller then needs to check whether it matches the root, and the root is authentic (signed by a trusted key).

Parameters:
nodeContent either the content of the block or its digest. If a subclass of MerkleTree overrides computeBlockDigest, a caller must hand in the digest, as this uses the MerkleTree default.
isDigest was this node already digested, or do we need to digest it
Returns:
the computed root digest

DEROctetString org.ccnx.ccn.impl.security.crypto.MerklePath.entry ( int  i  ) 

Get an in the path, where i is the index into the path array.

Parameters:
i the entry we want
Returns:
the entry

int org.ccnx.ccn.impl.security.crypto.MerklePath.leafNodeIndex (  ) 

Return the leaf node this path is for.

Returns:
the leaf node index

byte [] org.ccnx.ccn.impl.security.crypto.MerklePath.derEncodedPath (  ) 

DER-encode the path.

Embed it in a DigestInfo with the appropriate algorithm identifier.

Returns:
the DER-encoded path

Sequence of OCTET STRING

Sequence of INTEGER, SEQUENCE OF OCTET STRING

static boolean org.ccnx.ccn.impl.security.crypto.MerklePath.isMerklePath ( DigestInfo  info  )  [static]

Determine whether a given DigestInfo contains a MerklePath.

Parameters:
info the DigestInfo
Returns:
true if this is a MerklePath, false otherwise


The documentation for this class was generated from the following file:

Generated on Thu Feb 16 00:44:57 2012 for Content-Centric Networking in Java by  doxygen 1.5.6