org.ccnx.ccn.impl.security.crypto.util.SignatureHelper Class Reference

Helper class for generating signatures. More...

List of all members.

Static Public Member Functions

static byte[] sign (String digestAlgorithm, byte[] toBeSigned, PrivateKey signingKey) throws SignatureException, NoSuchAlgorithmException, InvalidKeyException
 Signs an array of bytes with a private signing key and specified digest algorithm.
static byte[] sign (String digestAlgorithm, byte[][] toBeSigneds, PrivateKey signingKey) throws SignatureException, NoSuchAlgorithmException, InvalidKeyException
 Sign concatenation of the toBeSigneds.
static boolean verify (byte[][] data, byte[] signature, String digestAlgorithm, PublicKey verificationKey) throws SignatureException, NoSuchAlgorithmException, InvalidKeyException
 Verifies the signature on the concatenation of a set of individual data items, given the verification key and digest algorithm.
static boolean verify (byte[] data, byte[] signature, String digestAlgorithm, PublicKey verificationKey) throws InvalidKeyException, SignatureException, NoSuchAlgorithmException
 Verify a standalone signature.
static AlgorithmIdentifier getSignatureAlgorithm (String hashAlgorithm, PrivateKey signingKey) throws NoSuchAlgorithmException, InvalidParameterSpecException, InvalidAlgorithmParameterException
 Gets an AlgorithmIdentifier incorporating a given digest and encryption algorithm, and containing any necessary parameters for the signing key.
static String getSignatureAlgorithmName (String hashAlgorithm, PrivateKey signingKey)
 Gets the JCA string name of a signature algorithm, to be used with a Signature object.
static String getSignatureAlgorithmName (String hashAlgorithm, PublicKey publicKey)
static String getSignatureAlgorithmName (String hashAlgorithm, String keyAlgorithm)
 Gets the JCA string name of a signature algorithm, to be used with a Signature object.
static String getSignatureAlgorithmOID (String hashAlgorithm, String keyAlgorithm)
 Gets the OID of a signature algorithm, to be used with a Signature object.

Detailed Description

Helper class for generating signatures.


Member Function Documentation

static AlgorithmIdentifier org.ccnx.ccn.impl.security.crypto.util.SignatureHelper.getSignatureAlgorithm ( String  hashAlgorithm,
PrivateKey  signingKey 
) throws NoSuchAlgorithmException, InvalidParameterSpecException, InvalidAlgorithmParameterException [static]

Gets an AlgorithmIdentifier incorporating a given digest and encryption algorithm, and containing any necessary parameters for the signing key.

Parameters:
hashAlgorithm the JCA standard name of the digest algorithm (e.g. "SHA1")
signingKey the private key that will be used to compute the signature
Returns:
the algorithm identifier.
Exceptions:
NoSuchAlgorithmException if the algorithm identifier can't be formed
InvalidParameterSpecException 
InvalidAlgorithmParameterException 
static String org.ccnx.ccn.impl.security.crypto.util.SignatureHelper.getSignatureAlgorithmName ( String  hashAlgorithm,
String  keyAlgorithm 
) [static]

Gets the JCA string name of a signature algorithm, to be used with a Signature object.

Parameters:
hashAlgorithm the JCA standard name of the digest algorithm (e.g. "SHA1").
keyAlgorithm the key algorithm.
Returns:
the JCA string alias for the signature algorithm.
static String org.ccnx.ccn.impl.security.crypto.util.SignatureHelper.getSignatureAlgorithmName ( String  hashAlgorithm,
PrivateKey  signingKey 
) [static]

Gets the JCA string name of a signature algorithm, to be used with a Signature object.

Parameters:
hashAlgorithm the JCA standard name of the digest algorithm (e.g. "SHA1").
signingKey the private key that will be used to compute the signature.
Returns:
the JCA string alias for the signature algorithm.
static String org.ccnx.ccn.impl.security.crypto.util.SignatureHelper.getSignatureAlgorithmOID ( String  hashAlgorithm,
String  keyAlgorithm 
) [static]

Gets the OID of a signature algorithm, to be used with a Signature object.

Parameters:
hashAlgorithm the JCA standard name of the digest algorithm (e.g. "SHA1").
keyAlgorithm the key algorithm.
Returns:
the JCA string alias for the signature algorithm.
static byte [] org.ccnx.ccn.impl.security.crypto.util.SignatureHelper.sign ( String  digestAlgorithm,
byte  toBeSigneds[][],
PrivateKey  signingKey 
) throws SignatureException, NoSuchAlgorithmException, InvalidKeyException [static]

Sign concatenation of the toBeSigneds.

Parameters:
digestAlgorithm the digest algorithm. if null uses DEFAULT_DIGEST_ALGORITHM
toBeSigneds the content to be signed.
signingKey the signing key.
Returns:
the signature.
Exceptions:
SignatureException 
NoSuchAlgorithmException 
InvalidKeyException 

Reimplemented in org.ccnx.ccn.impl.security.crypto.CCNSignatureHelper.

static byte [] org.ccnx.ccn.impl.security.crypto.util.SignatureHelper.sign ( String  digestAlgorithm,
byte[]  toBeSigned,
PrivateKey  signingKey 
) throws SignatureException, NoSuchAlgorithmException, InvalidKeyException [static]

Signs an array of bytes with a private signing key and specified digest algorithm.

Parameters:
digestAlgorithm the digest algorithm. if null uses DEFAULT_DIGEST_ALGORITHM
toBeSigned the array of bytes to be signed.
signingKey the signing key.
Returns:
the signature.
Exceptions:
SignatureException 
NoSuchAlgorithmException 
InvalidKeyException 

Reimplemented in org.ccnx.ccn.impl.security.crypto.CCNSignatureHelper.

static boolean org.ccnx.ccn.impl.security.crypto.util.SignatureHelper.verify ( byte[]  data,
byte[]  signature,
String  digestAlgorithm,
PublicKey  verificationKey 
) throws InvalidKeyException, SignatureException, NoSuchAlgorithmException [static]

Verify a standalone signature.

Parameters:
data the data whose signature we want to verify
signature the signature itself
digestAlgorithm the digest algorithm used to generate the signature, if null uses DEFAULT_DIGEST_ALGORITHM
verificationKey the public key to verify the signature with
Returns:
true if signature valid, false otherwise
Exceptions:
InvalidKeyException 
SignatureException 
NoSuchAlgorithmException 

Reimplemented in org.ccnx.ccn.impl.security.crypto.CCNSignatureHelper.

static boolean org.ccnx.ccn.impl.security.crypto.util.SignatureHelper.verify ( byte  data[][],
byte[]  signature,
String  digestAlgorithm,
PublicKey  verificationKey 
) throws SignatureException, NoSuchAlgorithmException, InvalidKeyException [static]

Verifies the signature on the concatenation of a set of individual data items, given the verification key and digest algorithm.

Parameters:
data the data; which are expected to have been concatenated before signing. Any null arrays are skipped.
signature the signature.
digestAlgorithm the digest algorithm. if null uses DEFAULT_DIGEST_ALGORITHM
verificationKey the public verification key.
Returns:
the correctness of the signature as a boolean.
Exceptions:
SignatureException 
NoSuchAlgorithmException 
InvalidKeyException 

Reimplemented in org.ccnx.ccn.impl.security.crypto.CCNSignatureHelper.


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