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

CCN-specific helper methods for working with digests, primarily to support Merkle trees. More...

List of all members.

Public Member Functions

 CCNDigestHelper ()
 Make a CCNDigestHelper using the default digest algorithm (DEFAULT_DIGEST_ALGORITHM).
 CCNDigestHelper (String digestAlgorithm) throws NoSuchAlgorithmException
 Make a CCNDigestHelper that uses a specified algorithm.
String getDefaultDigest ()
 This method is non-static so subclasses can override it.

Static Public Member Functions

static byte[] digestLeaf (String digestAlgorithm, XMLEncodable[] toBeSigneds, byte[][] additionalToBeSigneds) throws ContentEncodingException, NoSuchAlgorithmException
 Same digest preparation algorithm as ContentObject.
static byte[] digest (byte[] content)
 Static digest helper.
static byte[] digest (String digestAlgorithm, byte[] content) throws NoSuchAlgorithmException
 Static digest helper.
static byte[] digest (byte[] content, int offset, int length)
 Static digest helper.
static byte[] digest (String digestAlgorithm, byte[] content, int offset, int length) throws NoSuchAlgorithmException
 Static digest helper.
static byte[] digest (byte[] content1, byte[] content2)
 Static digest helper; returns the digest of the concatenation of two byte arrays.
static byte[] digest (String digestAlgorithm, byte[] content1, byte[] content2) throws NoSuchAlgorithmException
 Static digest helper; returns the digest of the concatenation of two byte arrays.
static byte[] digest (byte contents[][])
 Static digest helper; returns the digest of the concatenation of any number of component byte arrays.
static byte[] digest (String digestAlgorithm, byte contents[][]) throws NoSuchAlgorithmException
 Static digest helper; returns the digest of the concatenation of any number of component byte arrays.
static byte[] digest (String digestAlgorithm, InputStream input) throws NoSuchAlgorithmException, IOException
static byte[] digest (InputStream input) throws IOException
static byte[] encodedDigest (String digestAlgorithm, byte[] content) throws CertificateEncodingException, NoSuchAlgorithmException
 Digests some data and wraps it in an encoded PKCS#1 DigestInfo, which contains a specification of the digestAlgorithm (as an Object Identifier, or OID wrapped in an AlgorithmIdentifier, which for a digest algorithm typically has null parameters), and the digest itself, all encoded in DER.
static byte[] encodedDigest (byte[] content) throws CertificateEncodingException
 Digests some data and wraps it in an encoded PKCS#1 DigestInfo, which contains a specification of the digestAlgorithm (as an Object Identifier, or OID wrapped in an AlgorithmIdentifier, which for a digest algorithm typically has null parameters), and the digest itself, all encoded in DER.

Static Public Attributes

static String DEFAULT_DIGEST_ALGORITHM = "SHA-256"
 Current default algorithm is SHA-256.
static int DEFAULT_DIGEST_LENGTH = 32

Detailed Description

CCN-specific helper methods for working with digests, primarily to support Merkle trees.


Constructor & Destructor Documentation

org.ccnx.ccn.impl.security.crypto.CCNDigestHelper.CCNDigestHelper ( String  digestAlgorithm  )  throws NoSuchAlgorithmException

Make a CCNDigestHelper that uses a specified algorithm.

Parameters:
digestAlgorithm algorithm to use
Exceptions:
NoSuchAlgorithmException if digestAlgorithm is unknown to any of our cryptography Providers

Member Function Documentation

static byte [] org.ccnx.ccn.impl.security.crypto.CCNDigestHelper.digest ( String  digestAlgorithm,
byte  contents[][] 
) throws NoSuchAlgorithmException [static]

Static digest helper; returns the digest of the concatenation of any number of component byte arrays.

Null arrays are skipped

Parameters:
digestAlgorithm digest algorithm to use
contents the arrays of content to digest
Returns:
digest of concatenated content using specified algorithm
Exceptions:
NoSuchAlgorithmException if the algorithm is unknown to any of our providers

Reimplemented from org.ccnx.ccn.impl.security.crypto.util.DigestHelper.

static byte [] org.ccnx.ccn.impl.security.crypto.CCNDigestHelper.digest ( byte  contents[][]  )  [static]

Static digest helper; returns the digest of the concatenation of any number of component byte arrays.

Null arrays are skipped

Parameters:
contents the arrays of content to digest
Returns:
digest of concatenated content using DEFAULT_DIGEST_ALGORITHM

Reimplemented from org.ccnx.ccn.impl.security.crypto.util.DigestHelper.

static byte [] org.ccnx.ccn.impl.security.crypto.CCNDigestHelper.digest ( String  digestAlgorithm,
byte[]  content1,
byte[]  content2 
) throws NoSuchAlgorithmException [static]

Static digest helper; returns the digest of the concatenation of two byte arrays.

If either is null, simply includes the non-null array in the digest.

Parameters:
digestAlgorithm digest algorithm to use
content1 first content array to digest
content2 second content array to digest
Returns:
digest of concatenated content using specified algorithm
Exceptions:
NoSuchAlgorithmException if the algorithm is unknown to any of our providers

Reimplemented from org.ccnx.ccn.impl.security.crypto.util.DigestHelper.

static byte [] org.ccnx.ccn.impl.security.crypto.CCNDigestHelper.digest ( byte[]  content1,
byte[]  content2 
) [static]

Static digest helper; returns the digest of the concatenation of two byte arrays.

If either is null, simply includes the non-null array in the digest.

Parameters:
content1 first content array to digest
content2 second content array to digest
Returns:
digest of content using DEFAULT_DIGEST_ALGORITHM

Reimplemented from org.ccnx.ccn.impl.security.crypto.util.DigestHelper.

static byte [] org.ccnx.ccn.impl.security.crypto.CCNDigestHelper.digest ( String  digestAlgorithm,
byte[]  content,
int  offset,
int  length 
) throws NoSuchAlgorithmException [static]

Static digest helper.

Parameters:
digestAlgorithm digest algorithm to use
content content to digest
offset offset into content at which to start digesting, in bytes
length number of bytes of content to digest
Returns:
digest of content using specified algorithm
Exceptions:
NoSuchAlgorithmException if the algorithm is unknown to any of our providers

Reimplemented from org.ccnx.ccn.impl.security.crypto.util.DigestHelper.

static byte [] org.ccnx.ccn.impl.security.crypto.CCNDigestHelper.digest ( byte[]  content,
int  offset,
int  length 
) [static]

Static digest helper.

Parameters:
content content to digest
offset offset into content at which to start digesting, in bytes
length number of bytes of content to digest
Returns:
digest of content using DEFAULT_DIGEST_ALGORITHM

Reimplemented from org.ccnx.ccn.impl.security.crypto.util.DigestHelper.

static byte [] org.ccnx.ccn.impl.security.crypto.CCNDigestHelper.digest ( String  digestAlgorithm,
byte[]  content 
) throws NoSuchAlgorithmException [static]

Static digest helper.

Parameters:
digestAlgorithm digest algorithm to use
content content to digest
Returns:
digest of content using specified algorithm
Exceptions:
NoSuchAlgorithmException if the algorithm is unknown to any of our providers

Reimplemented from org.ccnx.ccn.impl.security.crypto.util.DigestHelper.

static byte [] org.ccnx.ccn.impl.security.crypto.CCNDigestHelper.digest ( byte[]  content  )  [static]

Static digest helper.

Parameters:
content content to digest
Returns:
digest of content using DEFAULT_DIGEST_ALGORITHM

Reimplemented from org.ccnx.ccn.impl.security.crypto.util.DigestHelper.

static byte [] org.ccnx.ccn.impl.security.crypto.CCNDigestHelper.digestLeaf ( String  digestAlgorithm,
XMLEncodable[]  toBeSigneds,
byteadditionalToBeSigneds  [][] 
) throws ContentEncodingException, NoSuchAlgorithmException [static]

Same digest preparation algorithm as ContentObject.

Exceptions:
ContentEncodingException 
NoSuchAlgorithmException 
static byte [] org.ccnx.ccn.impl.security.crypto.CCNDigestHelper.encodedDigest ( byte[]  content  )  throws CertificateEncodingException [static]

Digests some data and wraps it in an encoded PKCS#1 DigestInfo, which contains a specification of the digestAlgorithm (as an Object Identifier, or OID wrapped in an AlgorithmIdentifier, which for a digest algorithm typically has null parameters), and the digest itself, all encoded in DER.

This digests content with the DEFAULT_DIGEST_ALGORITHM.

Parameters:
content the content to digest
Returns:
a DER-encoded DigestInfo containing the content digested with DEFAULT_DIGEST_ALGORITHM and the OID for DEFAULT_DIGEST_ALGORITHM
Exceptions:
CertificateEncodingException if there is an error in encoding

Reimplemented from org.ccnx.ccn.impl.security.crypto.util.DigestHelper.

static byte [] org.ccnx.ccn.impl.security.crypto.CCNDigestHelper.encodedDigest ( String  digestAlgorithm,
byte[]  content 
) throws CertificateEncodingException, NoSuchAlgorithmException [static]

Digests some data and wraps it in an encoded PKCS#1 DigestInfo, which contains a specification of the digestAlgorithm (as an Object Identifier, or OID wrapped in an AlgorithmIdentifier, which for a digest algorithm typically has null parameters), and the digest itself, all encoded in DER.

Parameters:
digestAlgorithm the algorithm to use to digest (as a Java String algorithm name)
content the content to digest
Returns:
a DER-encoded DigestInfo containing the digested content and the OID for digestAlgorithm
Exceptions:
CertificateEncodingException if there is an error in encoding
NoSuchAlgorithmException if none of our providers recognize digestAlgorithm, or know its OID

Reimplemented from org.ccnx.ccn.impl.security.crypto.util.DigestHelper.

String org.ccnx.ccn.impl.security.crypto.CCNDigestHelper.getDefaultDigest (  ) 

This method is non-static so subclasses can override it.

Returns:
the default digest algorithm.

Reimplemented from org.ccnx.ccn.impl.security.crypto.util.DigestHelper.


Member Data Documentation

Current default algorithm is SHA-256.

We expect it to move to SHA3 when that is standardized. We're doing our best to support variable algorithms in all but core network components (digest components in ContentNames, publisher IDs), whose digest algorithm is fixed for a given protocol version.

Reimplemented from org.ccnx.ccn.impl.security.crypto.util.DigestHelper.


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