|
JSS 3.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.mozilla.jss.pkix.cms.SignerInfo
A CMS SignerInfo.
Inner Class Summary | |
static class |
SignerInfo.Template
A template for decoding a SignerInfo blob |
Field Summary | |
private static OBJECT_IDENTIFIER |
CONTENT_TYPE
|
private AlgorithmIdentifier |
digestAlgorithm
|
private AlgorithmIdentifier |
digestEncryptionAlgorithm
|
private OCTET_STRING |
encryptedDigest
|
private static OBJECT_IDENTIFIER |
MESSAGE_DIGEST
|
private SET |
signedAttributes
|
private SignerIdentifier |
signerIdentifier
|
private static Tag |
TAG
|
private static SignerInfo.Template |
templateInstance
|
private SET |
unsignedAttributes
|
private INTEGER |
version
|
private static INTEGER |
VERSION
|
Constructor Summary | |
(package private) |
SignerInfo(INTEGER version,
SignerIdentifier signerIdentifier,
AlgorithmIdentifier digestAlgorithm,
SET signedAttributes,
AlgorithmIdentifier digestEncryptionAlgorithm,
byte[] encryptedDigest,
SET unsignedAttributes)
A constructor for creating a new SignerInfo from its decoding. |
|
SignerInfo(SignerIdentifier signerIdentifier,
SET signedAttributes,
SET unsignedAttributes,
OBJECT_IDENTIFIER contentType,
byte[] messageDigest,
SignatureAlgorithm signingAlg,
PrivateKey signingKey)
A constructor for creating a new SignerInfo from scratch. |
Method Summary | |
private static boolean |
byteArraysAreSame(byte[] left,
byte[] right)
Compares two non-null byte arrays. |
void |
encode(java.io.OutputStream ostream)
|
void |
encode(Tag tag,
java.io.OutputStream ostream)
|
DigestAlgorithm |
getDigestAlgorithm()
Retrieves the DigestAlgorithm used in this SignerInfo. |
AlgorithmIdentifier |
getDigestAlgorithmIdentifer()
Retrieves the DigestAlgorithmIdentifier used in this SignerInfo. |
SignatureAlgorithm |
getDigestEncryptionAlgorithm()
Returns the raw signature (digest encryption) algorithm used in this SignerInfo. |
AlgorithmIdentifier |
getDigestEncryptionAlgorithmIdentifier()
Returns the DigestEncryptionAlgorithmIdentifier used in this SignerInfo. |
byte[] |
getEncryptedDigest()
Retrieves the encrypted digest. |
SET |
getSignedAttributes()
Retrieves the signed attributes, if they exist. |
SignerIdentifier |
getSignerIdentifier()
Retrieves the SignerIdentifier. |
Tag |
getTag()
|
static SignerInfo.Template |
getTemplate()
|
SET |
getUnsignedAttributes()
Retrieves the unsigned attributes, if they exist. |
INTEGER |
getVersion()
Retrieves the version number of this SignerInfo. |
boolean |
hasSignedAttributes()
Returns true if the signedAttributes field is present. |
boolean |
hasUnsignedAttributes()
Returns true if the unsignedAttributes field is present. |
void |
verify(byte[] messageDigest,
OBJECT_IDENTIFIER contentType)
Verifies that this SignerInfo contains a valid signature of the given message digest. |
void |
verify(byte[] messageDigest,
OBJECT_IDENTIFIER contentType,
java.security.PublicKey pubkey)
Verifies that this SignerInfo contains a valid signature of the given message digest. |
private void |
verifyWithoutSignedAttributes(byte[] messageDigest,
OBJECT_IDENTIFIER contentType,
java.security.PublicKey pubkey)
Verifies that the message digest passed in, when encrypted with the given public key, matches the encrypted digest in the SignerInfo. |
private void |
verifyWithSignedAttributes(byte[] messageDigest,
OBJECT_IDENTIFIER contentType,
java.security.PublicKey pubkey)
Verifies a SignerInfo with signed attributes. |
Methods inherited from class java.lang.Object |
|
Field Detail |
private static final OBJECT_IDENTIFIER CONTENT_TYPE
private static final OBJECT_IDENTIFIER MESSAGE_DIGEST
private INTEGER version
private SignerIdentifier signerIdentifier
private AlgorithmIdentifier digestAlgorithm
private SET signedAttributes
private AlgorithmIdentifier digestEncryptionAlgorithm
private OCTET_STRING encryptedDigest
private SET unsignedAttributes
private static final INTEGER VERSION
private static final Tag TAG
private static SignerInfo.Template templateInstance
Constructor Detail |
public SignerInfo(SignerIdentifier signerIdentifier, SET signedAttributes, SET unsignedAttributes, OBJECT_IDENTIFIER contentType, byte[] messageDigest, SignatureAlgorithm signingAlg, PrivateKey signingKey) throws java.security.InvalidKeyException, java.security.NoSuchAlgorithmException, CryptoManager.NotInitializedException, java.security.SignatureException, TokenException
signerIdentifier
- The signerIdentifier of the
certificate from which the public key was extracted to create
this SignerInfo.signingAlg
- The algorithm to be used to sign the content.
This should be a composite algorithm, such as
RSASignatureWithMD5Digest, instead of a raw algorithm, such as
RSASignature.
Note that the digest portion of this algorithm must be the same
algorithm as was used to digest the message content.signedAttributes
- An optional set of Attributes, which
will be signed along with the message content. This parameter may
be null, or the SET may be empty. DO NOT insert
the PKCS #9 content-type or message-digest attributes. They will
be added automatically if they are necessary.unsignedAttributes
- An optional set of Attributes, which
will be included in the SignerInfo but not signed. This parameter
may be null, or the SET may be empty.messageDigest
- The digest of the message contents. The digest
must have been created with the digest algorithm specified by
the signingAlg parameter.contentType
- The type of the ContentInfo that is being signed.
If it is not data
, then the PKCS #9 attributes
content-type and message-digest will be automatically computed and
added to the signed attributes.SignerInfo(INTEGER version, SignerIdentifier signerIdentifier, AlgorithmIdentifier digestAlgorithm, SET signedAttributes, AlgorithmIdentifier digestEncryptionAlgorithm, byte[] encryptedDigest, SET unsignedAttributes)
Method Detail |
public INTEGER getVersion()
public SignerIdentifier getSignerIdentifier()
public DigestAlgorithm getDigestAlgorithm() throws java.security.NoSuchAlgorithmException
public AlgorithmIdentifier getDigestAlgorithmIdentifer()
public SET getSignedAttributes()
public boolean hasSignedAttributes()
public SignatureAlgorithm getDigestEncryptionAlgorithm() throws java.security.NoSuchAlgorithmException
public AlgorithmIdentifier getDigestEncryptionAlgorithmIdentifier()
public byte[] getEncryptedDigest()
public SET getUnsignedAttributes()
public boolean hasUnsignedAttributes()
public void verify(byte[] messageDigest, OBJECT_IDENTIFIER contentType) throws CryptoManager.NotInitializedException, java.security.NoSuchAlgorithmException, java.security.InvalidKeyException, TokenException, java.security.SignatureException, ObjectNotFoundException
Note that this does not verify the validity of the the certificate itself, only the signature.
messageDigest
- The hash of the content that is signed by this
SignerInfo.contentType
- The type of the content that is signed by this
SignerInfo.public void verify(byte[] messageDigest, OBJECT_IDENTIFIER contentType, java.security.PublicKey pubkey) throws CryptoManager.NotInitializedException, java.security.NoSuchAlgorithmException, java.security.InvalidKeyException, TokenException, java.security.SignatureException
messageDigest
- The hash of the content that is signed by this
SignerInfo.contentType
- The type of the content that is signed by this
SignerInfo.pubkey
- The public key to use to verify the signature.private void verifyWithoutSignedAttributes(byte[] messageDigest, OBJECT_IDENTIFIER contentType, java.security.PublicKey pubkey) throws CryptoManager.NotInitializedException, java.security.NoSuchAlgorithmException, java.security.InvalidKeyException, TokenException, java.security.SignatureException
private void verifyWithSignedAttributes(byte[] messageDigest, OBJECT_IDENTIFIER contentType, java.security.PublicKey pubkey) throws CryptoManager.NotInitializedException, java.security.NoSuchAlgorithmException, java.security.InvalidKeyException, TokenException, java.security.SignatureException
private static boolean byteArraysAreSame(byte[] left, byte[] right)
public Tag getTag()
public void encode(java.io.OutputStream ostream) throws java.io.IOException
public void encode(Tag tag, java.io.OutputStream ostream) throws java.io.IOException
public static SignerInfo.Template getTemplate()
|
JSS 3.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |