Top Description Fields Constructors Methods
org.bouncycastle.cms

public Class SignerInformation

extends Object
Class Inheritance
Known Direct Subclasses
org.bouncycastle.cms.CMSPatchKit.DLSignerInformation, org.bouncycastle.cms.CMSPatchKit.ModEncAlgSignerInformation
Imports
java.io.IOException, .OutputStream, java.util.ArrayList, .Enumeration, .Iterator, .List, org.bouncycastle.asn1.ASN1Encodable, .ASN1EncodableVector, .ASN1Encoding, .ASN1ObjectIdentifier, .ASN1OctetString, .ASN1Primitive, .ASN1Set, .DERNull, .DERSet, org.bouncycastle.asn1.cms.Attribute, .AttributeTable, .CMSAlgorithmProtection, .CMSAttributes, .IssuerAndSerialNumber, .SignerIdentifier, .SignerInfo, .Time, org.bouncycastle.asn1.oiw.OIWObjectIdentifiers, org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers, org.bouncycastle.asn1.x509.AlgorithmIdentifier, .DigestInfo, org.bouncycastle.cert.X509CertificateHolder, org.bouncycastle.operator.ContentVerifier, .DigestCalculator, .OperatorCreationException, .RawContentVerifier, org.bouncycastle.util.Arrays, org.bouncycastle.util.io.TeeOutputStream

an expanded SignerInfo block from a CMS Signed message

Field Summary

Modifier and TypeField and Description
private final CMSProcessable
private final ASN1ObjectIdentifier
protected final AlgorithmIdentifier
protected final AlgorithmIdentifier
protected final SignerInfo
private final boolean
private byte[]
private final SignerId
private final byte[]
protected final ASN1Set
private AttributeTable
protected final ASN1Set
private AttributeTable

Constructor Summary

AccessConstructor and Description
pack-priv
SignerInformation(SignerInfo info, ASN1ObjectIdentifier contentType, CMSProcessable content, byte[] resultDigest)

protected
SignerInformation(SignerInformation
the SignerInformation to base this one on.
baseInfo
)

Protected constructor.

protected
SignerInformation(SignerInformation
the SignerInformation to base this one on.
baseInfo
,
SignerInfo
the SignerInfo to associate with the existing baseInfo data.
info
)

Protected constructor.

Method Summary

Modifier and TypeMethod and Description
public static SignerInformation

Returns:

a copy of the original SignerInformationObject with the changed attributes.
addCounterSigners
(SignerInformation
the signerInfo to be used as the basis.
signerInformation
,
SignerInformationStore
signer info objects carrying counter signature.
counterSigners
)

Return a signer information object with passed in SignerInformationStore representing counter signatures attached as an unsigned attribute.

private boolean
private byte[]
public byte[]
getContentDigest()

return the content digest that was calculated during verification.

public ASN1ObjectIdentifier
public SignerInformationStore
getCounterSignatures()

Return a SignerInformationStore containing the counter signatures attached to this signer.

public String
getDigestAlgOID()

return the object identifier for the signature.

public AlgorithmIdentifier
public byte[]
getDigestAlgParams()

return the signature parameters, or null if there aren't any.

public byte[]
getEncodedSignedAttributes()

return the DER encoding of the signed attributes.

public String
getEncryptionAlgOID()

return the object identifier for the signature.

public byte[]
getEncryptionAlgParams()

return the signature/encryption algorithm parameters, or null if there aren't any.

public SignerId
public byte[]
getSignature()

return the encoded signature

public AttributeTable
getSignedAttributes()

return a table of the signed attributes - indexed by the OID of the attribute.

private Time
private ASN1Primitive
public AttributeTable
getUnsignedAttributes()

return a table of the unsigned attributes indexed by the OID of the attribute.

public int
getVersion()

return the version number for this objects underlying SignerInfo structure.

public boolean
public static SignerInformation

Returns:

a copy of the original SignerInformationObject with the changed attributes.
replaceUnsignedAttributes
(SignerInformation
the signerInfo to be used as the basis.
signerInformation
,
AttributeTable
the unsigned attributes to add.
unsignedAttributes
)

Return a signer information object with the passed in unsigned attributes replacing the ones that are current associated with the object passed in.

public SignerInfo

Returns:

a SignerInfo.
toASN1Structure
()

Return the underlying ASN.1 object defining this SignerInformation object.

private static AlgorithmIdentifier
translateBrokenRSAPkcs7(AlgorithmIdentifier encryptionAlgorithm, AlgorithmIdentifier digestAlgorithm)

public boolean

Returns:

true if the signer information is verified, false otherwise.
verify
(SignerInformationVerifier
a suitably configured SignerInformationVerifier.
verifier
)

Verify that the given verifier can successfully verify the signature on this SignerInformation object.

private void
verifyAlgorithmIdentifierProtectionAttribute(AttributeTable
signed attributes
signedAttrTable
)

RFC 6211 Validate Algorithm Identifier protection attribute if present

private void
verifyContentTypeAttributeValue()

RFC 3852 11.1 Check the content-type attribute is correct

private void
verifyCounterSignatureAttribute(AttributeTable
signed attributes
signedAttrTable
)

RFC 3852 11.4 Validate countersignature attribute(s)

private void
verifyMessageDigestAttribute()

RFC 3852 11.2 Check the message-digest attribute is correct

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

contentback to summary
private final CMSProcessable content
contentTypeback to summary
private final ASN1ObjectIdentifier contentType
digestAlgorithmback to summary
protected final AlgorithmIdentifier digestAlgorithm
encryptionAlgorithmback to summary
protected final AlgorithmIdentifier encryptionAlgorithm
infoback to summary
protected final SignerInfo info
isCounterSignatureback to summary
private final boolean isCounterSignature
resultDigestback to summary
private byte[] resultDigest
sidback to summary
private final SignerId sid
signatureback to summary
private final byte[] signature
signedAttributeSetback to summary
protected final ASN1Set signedAttributeSet
signedAttributeValuesback to summary
private AttributeTable signedAttributeValues
unsignedAttributeSetback to summary
protected final ASN1Set unsignedAttributeSet
unsignedAttributeValuesback to summary
private AttributeTable unsignedAttributeValues

Constructor Detail

SignerInformationback to summary
pack-priv SignerInformation(SignerInfo info, ASN1ObjectIdentifier contentType, CMSProcessable content, byte[] resultDigest)
SignerInformationback to summary
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:SignerInformation

the SignerInformation to base this one on.

SignerInformationback to summary
protected SignerInformation(SignerInformation baseInfo, 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:SignerInformation

the SignerInformation to base this one on.

info:SignerInfo

the SignerInfo to associate with the existing baseInfo data.

Method Detail

addCounterSignersback to summary
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:SignerInformation

the signerInfo to be used as the basis.

counterSigners:SignerInformationStore

signer info objects carrying counter signature.

Returns:SignerInformation

a copy of the original SignerInformationObject with the changed attributes.

doVerifyback to summary
private boolean doVerify(SignerInformationVerifier verifier) throws CMSException
encodeObjback to summary
private byte[] encodeObj(ASN1Encodable obj) throws IOException
getContentDigestback to summary
public byte[] getContentDigest()

return the content digest that was calculated during verification.

getContentTypeback to summary
public ASN1ObjectIdentifier getContentType()
getCounterSignaturesback to summary
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.

getDigestAlgOIDback to summary
public String getDigestAlgOID()

return the object identifier for the signature.

getDigestAlgorithmIDback to summary
public AlgorithmIdentifier getDigestAlgorithmID()
getDigestAlgParamsback to summary
public byte[] getDigestAlgParams()

return the signature parameters, or null if there aren't any.

getEncodedSignedAttributesback to summary
public byte[] getEncodedSignedAttributes() throws IOException

return the DER encoding of the signed attributes.

Exceptions
IOException:
if an encoding error occurs.
getEncryptionAlgOIDback to summary
public String getEncryptionAlgOID()

return the object identifier for the signature.

getEncryptionAlgParamsback to summary
public byte[] getEncryptionAlgParams()

return the signature/encryption algorithm parameters, or null if there aren't any.

getSIDback to summary
public SignerId getSID()
getSignatureback to summary
public byte[] getSignature()

return the encoded signature

getSignedAttributesback to summary
public AttributeTable getSignedAttributes()

return a table of the signed attributes - indexed by the OID of the attribute.

getSigningTimeback to summary
private Time getSigningTime() throws CMSException
getSingleValuedSignedAttributeback to summary
private ASN1Primitive getSingleValuedSignedAttribute(ASN1ObjectIdentifier attrOID, String printableName) throws CMSException
getUnsignedAttributesback to summary
public AttributeTable getUnsignedAttributes()

return a table of the unsigned attributes indexed by the OID of the attribute.

getVersionback to summary
public int getVersion()

return the version number for this objects underlying SignerInfo structure.

isCounterSignatureback to summary
public boolean isCounterSignature()
replaceUnsignedAttributesback to summary
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:SignerInformation

the signerInfo to be used as the basis.

unsignedAttributes:AttributeTable

the unsigned attributes to add.

Returns:SignerInformation

a copy of the original SignerInformationObject with the changed attributes.

toASN1Structureback to summary
public SignerInfo toASN1Structure()

Return the underlying ASN.1 object defining this SignerInformation object.

Returns:SignerInfo

a SignerInfo.

translateBrokenRSAPkcs7back to summary
private static AlgorithmIdentifier translateBrokenRSAPkcs7(AlgorithmIdentifier encryptionAlgorithm, AlgorithmIdentifier digestAlgorithm)
verifyback to summary
public boolean verify(SignerInformationVerifier verifier) throws CMSException

Verify that the given verifier can successfully verify the signature on this SignerInformation object.

Parameters
verifier:SignerInformationVerifier

a suitably configured SignerInformationVerifier.

Returns:boolean

true if the signer information is verified, false otherwise.

Exceptions
CMSException:
if the verifier is unable to create a ContentVerifiers or DigestCalculators.
CMSVerifierCertificateNotValidException:
if the provider has an associated certificate and the certificate is not valid at the time given as the SignerInfo's signing time.
verifyAlgorithmIdentifierProtectionAttributeback to summary
private void verifyAlgorithmIdentifierProtectionAttribute(AttributeTable signedAttrTable) throws CMSException

RFC 6211 Validate Algorithm Identifier protection attribute if present

Parameters
signedAttrTable:AttributeTable

signed attributes

Exceptions
CMSException:
when cmsAlgorihmProtect attribute was rejected
verifyContentTypeAttributeValueback to summary
private void verifyContentTypeAttributeValue() throws CMSException

RFC 3852 11.1 Check the content-type attribute is correct

Exceptions
CMSException:
when content-type was invalid.
verifyCounterSignatureAttributeback to summary
private void verifyCounterSignatureAttribute(AttributeTable signedAttrTable) throws CMSException

RFC 3852 11.4 Validate countersignature attribute(s)

Parameters
signedAttrTable:AttributeTable

signed attributes

Exceptions
CMSException:
when countersignature attribute was rejected
verifyMessageDigestAttributeback to summary
private void verifyMessageDigestAttribute() throws CMSException

RFC 3852 11.2 Check the message-digest attribute is correct

Exceptions
CMSException:
when message-digest attribute was rejected