Package org.bouncycastle.cms
Class SignerInformation
java.lang.Object
org.bouncycastle.cms.SignerInformation
public class SignerInformation extends Object
an expanded SignerInfo block from a CMS Signed message
-
Method Summary
Modifier and Type Method Description static SignerInformationaddCounterSigners(SignerInformation signerInformation, SignerInformationStore counterSigners)Return a signer information object with passed in SignerInformationStore representing counter signatures attached as an unsigned attribute.byte[]getContentDigest()return the content digest that was calculated during verification.ASN1ObjectIdentifiergetContentType()SignerInformationStoregetCounterSignatures()Return a SignerInformationStore containing the counter signatures attached to this signer.StringgetDigestAlgOID()return the object identifier for the signature.AlgorithmIdentifiergetDigestAlgorithmID()byte[]getDigestAlgParams()return the signature parameters, or null if there aren't any.byte[]getEncodedSignedAttributes()return the DER encoding of the signed attributes.StringgetEncryptionAlgOID()return the object identifier for the signature.byte[]getEncryptionAlgParams()return the signature/encryption algorithm parameters, or null if there aren't any.SignerIdgetSID()byte[]getSignature()return the encoded signatureAttributeTablegetSignedAttributes()return a table of the signed attributes - indexed by the OID of the attribute.AttributeTablegetUnsignedAttributes()return a table of the unsigned attributes indexed by the OID of the attribute.intgetVersion()return the version number for this objects underlying SignerInfo structure.booleanisCounterSignature()static SignerInformationreplaceUnsignedAttributes(SignerInformation signerInformation, AttributeTable unsignedAttributes)Return a signer information object with the passed in unsigned attributes replacing the ones that are current associated with the object passed in.SignerInfotoASN1Structure()Return the underlying ASN.1 object defining this SignerInformation object.SignerInfotoSignerInfo()Deprecated.use toASN1Structure()booleanverify(X509Certificate cert, String sigProvider)Deprecated.use verify(ContentVerifierProvider)booleanverify(X509Certificate cert, Provider sigProvider)Deprecated.use verify(ContentVerifierProvider)booleanverify(PublicKey key, String sigProvider)Deprecated.use verify(ContentVerifierProvider)booleanverify(PublicKey key, Provider sigProvider)Deprecated.use verify(ContentVerifierProvider)booleanverify(SignerInformationVerifier verifier)Verify that the given verifier can successfully verify the signature on this SignerInformation object.
-
Method Details
-
isCounterSignature
public boolean isCounterSignature() -
getContentType
-
getSID
-
getVersion
public int getVersion()return the version number for this objects underlying SignerInfo structure. -
getDigestAlgorithmID
-
getDigestAlgOID
return the object identifier for the signature. -
getDigestAlgParams
public byte[] getDigestAlgParams()return the signature parameters, or null if there aren't any. -
getContentDigest
public byte[] getContentDigest()return the content digest that was calculated during verification. -
getEncryptionAlgOID
return the object identifier for the signature. -
getEncryptionAlgParams
public byte[] getEncryptionAlgParams()return the signature/encryption algorithm parameters, or null if there aren't any. -
getSignedAttributes
return a table of the signed attributes - indexed by the OID of the attribute. -
getUnsignedAttributes
return a table of the unsigned attributes indexed by the OID of the attribute. -
getSignature
public byte[] getSignature()return the encoded signature -
getCounterSignatures
Return a SignerInformationStore containing the counter signatures attached to this signer. If no counter signatures are present an empty store is returned. -
getEncodedSignedAttributes
return the DER encoding of the signed attributes.- Throws:
IOException- if an encoding error occurs.
-
verify
public boolean verify(PublicKey key, String sigProvider) throws NoSuchAlgorithmException, NoSuchProviderException, CMSExceptionDeprecated.use verify(ContentVerifierProvider)verify that the given public key successfully handles and confirms the signature associated with this signer. -
verify
public boolean verify(PublicKey key, Provider sigProvider) throws NoSuchAlgorithmException, NoSuchProviderException, CMSExceptionDeprecated.use verify(ContentVerifierProvider)verify that the given public key successfully handles and confirms the signature associated with this signer -
verify
public boolean verify(X509Certificate cert, String sigProvider) throws NoSuchAlgorithmException, NoSuchProviderException, CertificateExpiredException, CertificateNotYetValidException, CMSExceptionDeprecated.use verify(ContentVerifierProvider)verify that the given certificate successfully handles and confirms the signature associated with this signer and, if a signingTime attribute is available, that the certificate was valid at the time the signature was generated. -
verify
public boolean verify(X509Certificate cert, Provider sigProvider) throws NoSuchAlgorithmException, CertificateExpiredException, CertificateNotYetValidException, CMSExceptionDeprecated.use verify(ContentVerifierProvider)verify that the given certificate successfully handles and confirms the signature associated with this signer and, if a signingTime attribute is available, that the certificate was valid at the time the signature was generated. -
verify
Verify that the given verifier can successfully verify the signature on this SignerInformation object.- Parameters:
verifier- a suitably configured SignerInformationVerifier.- Returns:
- true if the signer information is verified, false otherwise.
- Throws:
CMSVerifierCertificateNotValidException- if the provider has an associated certificate and the certificate is not valid at the time given as the SignerInfo's signing time.CMSException- if the verifier is unable to create a ContentVerifiers or DigestCalculators.
-
toSignerInfo
Deprecated.use toASN1Structure()Return the base ASN.1 CMS structure that this object contains.- Returns:
- an object containing a CMS SignerInfo structure.
-
toASN1Structure
Return the underlying ASN.1 object defining this SignerInformation object.- Returns:
- a SignerInfo.
-
replaceUnsignedAttributes
public static SignerInformation replaceUnsignedAttributes(SignerInformation signerInformation, AttributeTable unsignedAttributes)Return a signer information object with the passed in unsigned attributes replacing the ones that are current associated with the object passed in.- Parameters:
signerInformation- the signerInfo to be used as the basis.unsignedAttributes- the unsigned attributes to add.- Returns:
- a copy of the original SignerInformationObject with the changed attributes.
-
addCounterSigners
public static SignerInformation addCounterSigners(SignerInformation signerInformation, SignerInformationStore counterSigners)Return a signer information object with passed in SignerInformationStore representing counter signatures attached as an unsigned attribute.- Parameters:
signerInformation- the signerInfo to be used as the basis.counterSigners- signer info objects carrying counter signature.- Returns:
- a copy of the original SignerInformationObject with the changed attributes.
-