| Modifier and Type | Class and Description |
|---|---|
static class |
SignerInfo.Template
A template for decoding a SignerInfo blob
|
| Constructor and Description |
|---|
SignerInfo(IssuerAndSerialNumber issuerAndSerialNumber,
SET authenticatedAttributes,
SET unauthenticatedAttributes,
OBJECT_IDENTIFIER contentType,
byte[] messageDigest,
SignatureAlgorithm signingAlg,
PrivateKey signingKey)
A constructor for creating a new SignerInfo from scratch.
|
| Modifier and Type | Method and Description |
|---|---|
void |
encode(java.io.OutputStream ostream)
Write this value's DER encoding to an output stream using
its own base tag.
|
void |
encode(Tag tag,
java.io.OutputStream ostream)
Write this value's DER encoding to an output stream using
an implicit tag.
|
SET |
getAuthenticatedAttributes()
Retrieves the authenticated attributes, if they exist.
|
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.
|
IssuerAndSerialNumber |
getIssuerAndSerialNumber()
Retrieves the issuer and serial number of the certificate whose
private key was used to sign the SignerInfo.
|
Tag |
getTag()
Returns the base tag for this type, not counting any tags
that may be imposed on it by its context.
|
static SignerInfo.Template |
getTemplate() |
SET |
getUnauthenticatedAttributes()
Retrieves the unauthenticated attributes, if they exist.
|
INTEGER |
getVersion()
Retrieves the version number of this SignerInfo.
|
boolean |
hasAuthenticatedAttributes()
Returns true if the authenticatedAttributes field is present.
|
boolean |
hasUnauthenticatedAttributes()
Returns true if the unauthenticatedAttributes 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.
|
public SignerInfo(IssuerAndSerialNumber issuerAndSerialNumber, SET authenticatedAttributes, SET unauthenticatedAttributes, OBJECT_IDENTIFIER contentType, byte[] messageDigest, SignatureAlgorithm signingAlg, PrivateKey signingKey) throws java.security.InvalidKeyException, java.security.NoSuchAlgorithmException, CryptoManager.NotInitializedException, java.security.SignatureException, TokenException
issuerAndSerialNumber - The issuer and serial number 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.authenticatedAttributes - 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.unauthenticatedAttributes - 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 authenticated attributes.java.security.InvalidKeyExceptionjava.security.NoSuchAlgorithmExceptionCryptoManager.NotInitializedExceptionjava.security.SignatureExceptionTokenExceptionpublic INTEGER getVersion()
public IssuerAndSerialNumber getIssuerAndSerialNumber()
public DigestAlgorithm getDigestAlgorithm() throws java.security.NoSuchAlgorithmException
NoSuchAlgorithm - If the algorithm is not recognized by JSS.java.security.NoSuchAlgorithmExceptionpublic AlgorithmIdentifier getDigestAlgorithmIdentifer()
public SET getAuthenticatedAttributes()
public boolean hasAuthenticatedAttributes()
public SignatureAlgorithm getDigestEncryptionAlgorithm() throws java.security.NoSuchAlgorithmException
java.security.NoSuchAlgorithmException - If the algorithm is not recognized
by JSS.public AlgorithmIdentifier getDigestEncryptionAlgorithmIdentifier()
public byte[] getEncryptedDigest()
public SET getUnauthenticatedAttributes()
public boolean hasUnauthenticatedAttributes()
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.NoSuchObjectException - If no certificate matching the
the issuer name and serial number can be found.CryptoManager.NotInitializedExceptionjava.security.NoSuchAlgorithmExceptionjava.security.InvalidKeyExceptionTokenExceptionjava.security.SignatureExceptionObjectNotFoundExceptionpublic 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.CryptoManager.NotInitializedExceptionjava.security.NoSuchAlgorithmExceptionjava.security.InvalidKeyExceptionTokenExceptionjava.security.SignatureExceptionpublic Tag getTag()
ASN1Valuepublic void encode(java.io.OutputStream ostream)
throws java.io.IOException
ASN1Valuepublic void encode(Tag tag, java.io.OutputStream ostream) throws java.io.IOException
ASN1Valuepublic static SignerInfo.Template getTemplate()