Package org.bouncycastle.cms
Class SignerInformation
- java.lang.Object
 - 
- org.bouncycastle.cms.SignerInformation
 
 
- 
public class SignerInformation extends java.lang.Objectan expanded SignerInfo block from a CMS Signed message 
- 
- 
Field Summary
Fields Modifier and Type Field Description protected org.bouncycastle.asn1.x509.AlgorithmIdentifierdigestAlgorithmprotected org.bouncycastle.asn1.x509.AlgorithmIdentifierencryptionAlgorithmprotected org.bouncycastle.asn1.cms.SignerInfoinfoprotected org.bouncycastle.asn1.ASN1SetsignedAttributeSetprotected org.bouncycastle.asn1.ASN1SetunsignedAttributeSet 
- 
Constructor Summary
Constructors Modifier Constructor Description protectedSignerInformation(SignerInformation baseInfo)Protected constructor.protectedSignerInformation(SignerInformation baseInfo, org.bouncycastle.asn1.cms.SignerInfo info)Protected constructor. 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods 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.org.bouncycastle.asn1.ASN1ObjectIdentifiergetContentType()SignerInformationStoregetCounterSignatures()Return a SignerInformationStore containing the counter signatures attached to this signer.java.lang.StringgetDigestAlgOID()return the object identifier for the signature.org.bouncycastle.asn1.x509.AlgorithmIdentifiergetDigestAlgorithmID()byte[]getDigestAlgParams()return the signature parameters, or null if there aren't any.byte[]getEncodedSignedAttributes()return the DER encoding of the signed attributes.java.lang.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 signatureorg.bouncycastle.asn1.cms.AttributeTablegetSignedAttributes()return a table of the signed attributes - indexed by the OID of the attribute.org.bouncycastle.asn1.cms.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, org.bouncycastle.asn1.cms.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.org.bouncycastle.asn1.cms.SignerInfotoASN1Structure()Return the underlying ASN.1 object defining this SignerInformation object.booleanverify(SignerInformationVerifier verifier)Verify that the given verifier can successfully verify the signature on this SignerInformation object. 
 - 
 
- 
- 
Field Detail
- 
info
protected final org.bouncycastle.asn1.cms.SignerInfo info
 
- 
digestAlgorithm
protected final org.bouncycastle.asn1.x509.AlgorithmIdentifier digestAlgorithm
 
- 
encryptionAlgorithm
protected final org.bouncycastle.asn1.x509.AlgorithmIdentifier encryptionAlgorithm
 
- 
signedAttributeSet
protected final org.bouncycastle.asn1.ASN1Set signedAttributeSet
 
- 
unsignedAttributeSet
protected final org.bouncycastle.asn1.ASN1Set unsignedAttributeSet
 
 - 
 
- 
Constructor Detail
- 
SignerInformation
protected SignerInformation(SignerInformation baseInfo)
Protected constructor. In some cases clients have their own idea about how to encode the signed attributes and calculate the signature. This constructor is to allow developers to deal with that by extending off the class and overriding methods like getSignedAttributes().- Parameters:
 baseInfo- the SignerInformation to base this one on.
 
- 
SignerInformation
protected SignerInformation(SignerInformation baseInfo, org.bouncycastle.asn1.cms.SignerInfo info)
Protected constructor. In some cases clients also have their own ideas about what goes in various SignerInfo fields. This constructor is to allow developers to deal with that by also tweaking the SignerInfo so that these issues can be dealt with.- Parameters:
 baseInfo- the SignerInformation to base this one on.info- the SignerInfo to associate with the existing baseInfo data.
 
 - 
 
- 
Method Detail
- 
isCounterSignature
public boolean isCounterSignature()
 
- 
getContentType
public org.bouncycastle.asn1.ASN1ObjectIdentifier getContentType()
 
- 
getSID
public SignerId getSID()
 
- 
getVersion
public int getVersion()
return the version number for this objects underlying SignerInfo structure. 
- 
getDigestAlgorithmID
public org.bouncycastle.asn1.x509.AlgorithmIdentifier getDigestAlgorithmID()
 
- 
getDigestAlgOID
public java.lang.String 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
public java.lang.String 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
public org.bouncycastle.asn1.cms.AttributeTable getSignedAttributes()
return a table of the signed attributes - indexed by the OID of the attribute. 
- 
getUnsignedAttributes
public org.bouncycastle.asn1.cms.AttributeTable getUnsignedAttributes()
return a table of the unsigned attributes indexed by the OID of the attribute. 
- 
getSignature
public byte[] getSignature()
return the encoded signature 
- 
getCounterSignatures
public SignerInformationStore getCounterSignatures()
Return a SignerInformationStore containing the counter signatures attached to this signer. If no counter signatures are present an empty store is returned. 
- 
getEncodedSignedAttributes
public byte[] getEncodedSignedAttributes() throws java.io.IOExceptionreturn the DER encoding of the signed attributes.- Throws:
 java.io.IOException- if an encoding error occurs.
 
- 
verify
public boolean verify(SignerInformationVerifier verifier) throws CMSException
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.
 
- 
toASN1Structure
public org.bouncycastle.asn1.cms.SignerInfo toASN1Structure()
Return the underlying ASN.1 object defining this SignerInformation object.- Returns:
 - a SignerInfo.
 
 
- 
replaceUnsignedAttributes
public static SignerInformation replaceUnsignedAttributes(SignerInformation signerInformation, org.bouncycastle.asn1.cms.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.
 
 
 - 
 
 -