A simple example of usage - note, in the example below the validity of the certificate isn't verified, just the fact that one of the certs matches the given signer...
Store certStore = s.getCertificates();
SignerInformationStore signers = s.getSignerInfos();
Collection c = signers.getSigners();
Iterator it = c.iterator();
while (it.hasNext())
{
SignerInformation signer = (SignerInformation)it.next();
Collection certCollection = certStore.getMatches(signer.getSID());
Iterator certIt = certCollection.iterator();
X509CertificateHolder cert = (X509CertificateHolder)certIt.next();
if (signer.verify(new JcaSimpleSignerInfoVerifierBuilder().setProvider("BC").build(cert)))
{
verified++;
}
}
| Modifier and Type | Field and Description |
|---|---|
| pack-priv ContentInfo | |
| private static final DefaultDigestAlgorithmIdentifierFinder | |
| private Map | |
| private static final CMSSignedHelper | |
| pack-priv CMSTypedData | |
| pack-priv SignedData | |
| pack-priv SignerInformationStore |
| Access | Constructor and Description |
|---|---|
| private | |
| public | |
| public | |
| public | CMSSignedData(Map<K, V>
a map of precomputed digests for content indexed by name of hash. hashes, byte[] the signature object. sigBlock)Content with detached signature, digests precomputed |
| public | CMSSignedData(CMSProcessable
the content that was signed. signedContent, InputStream the signature object. sigData)base constructor - content with detached signature. |
| public | |
| public | |
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public static CMSSignedData | Returns: a new signed data object.the signed data object to be used as a base. signedData, AlgorithmIdentifier the digest algorithm to be added to the signed data. digestAlgorithm)Return a new CMSSignedData which guarantees to have the passed in digestAlgorithm in it. |
| public static CMSSignedData | Returns: a new signed data object.the signed data object to be used as a base. signedData, AlgorithmIdentifier the digest algorithm to be added to the signed data. digestAlgorithm, DigestAlgorithmIdentifierFinder the digest algorithmID map to generate the digest set with. digestAlgIdFinder)Return a new CMSSignedData which guarantees to have the passed in digestAlgorithm in it. |
| public Store | Returns: a Store of X509AttributeCertificateHolder objects.Return any X.509 attribute certificate objects in this SignedData structure as a Store of X509AttributeCertificateHolder objects. |
| public Store | Returns: a Store of X509CertificateHolder objects.Return any X.509 certificate objects in this SignedData structure as a Store of X509CertificateHolder objects. |
| public Store | Returns: a Store of X509CRLHolder objects.Return any X.509 CRL objects in this SignedData structure as a Store of X509CRLHolder objects. |
| public Set | Returns: the set of digest algorithm identifiersReturn the digest algorithm identifiers for the SignedData object |
| public byte[] | getEncoded()
Implements org. |
| public byte[] | getEncoded(String
the ASN.1 encoding format to use ("BER", "DL", or "DER"). encoding)return the ASN.1 encoded representation of this object using the specified encoding. |
| public Store | Returns: a Store of ASN1Encodable objects representing any objects of otherRevocationInfoFormat found.OID of the format type been looked for. otherRevocationInfoFormat)Return any OtherRevocationInfo OtherRevInfo objects of the type indicated by otherRevocationInfoFormat in this SignedData structure. |
| public CMSTypedData | |
| public String | Returns: the OID for the content type.Return the a string representation of the OID associated with the encapsulated content info structure carried in the signed data. |
| private SignedData | |
| public SignerInformationStore | getSignerInfos()
return the collection of signers that are associated with the signatures for the message. |
| public int | |
| public boolean | Returns: true if the message has no signers or content, false otherwise.Return if this is object represents a certificate management message. |
| public boolean | Returns: true if this message represents a detached signature, false otherwise.Return if this is object represents a detached signature. |
| public static CMSSignedData | Returns: a new signed data object.the signed data object to be used as a base. signedData, Store<T> the new certificates to be used. certificates, Store<T> the new attribute certificates to be used. attrCerts, Store<T> the new CRLs to be used - a collection of X509CRLHolder objects, OtherRevocationInfoFormat, or both. revocations)Replace the certificate and CRL information associated with this CMSSignedData object with the new one passed in. |
| public static CMSSignedData | Returns: a new signed data object.the signed data object to be used as a base. signedData, SignerInformationStore the new signer information store to use. signerInformationStore)Replace the SignerInformation store associated with this CMSSignedData object with the new one passed in using the current DigestAlgorithmIdentifierFinder for creating the digest sets. |
| public static CMSSignedData | Returns: a new signed data object.the signed data object to be used as a base. signedData, SignerInformationStore the new signer information store to use. signerInformationStore, DigestAlgorithmIdentifierFinder the digest algorithmID map to generate the digest set with. digestAlgIdFinder)Replace the SignerInformation store associated with this CMSSignedData object with the new one passed in using the passed in DigestAlgorithmIdentifierFinder for creating the digest sets. |
| public ContentInfo | |
| private boolean | verifyCounterSignature(SignerInformation counterSigner, SignerInformationVerifierProvider verifierProvider)
|
| public boolean | Returns: true if all verify, false otherwise.a provider of SignerInformationVerifier objects. verifierProvider)Verify all the SignerInformation objects and their associated counter signatures attached to this CMS SignedData object. |
| public boolean | Returns: true if all verify, false otherwise.a provider of SignerInformationVerifier objects. verifierProvider, boolean if true don't check counter signatures. If false check counter signatures as well. ignoreCounterSignatures)Verify all the SignerInformation objects and optionally their associated counter signatures attached to this CMS SignedData object. |
| contentInfo | back to summary |
|---|---|
| pack-priv ContentInfo contentInfo | |
| DIGEST_ALG_ID_FINDER | back to summary |
|---|---|
| private static final DefaultDigestAlgorithmIdentifierFinder DIGEST_ALG_ID_FINDER | |
| hashes | back to summary |
|---|---|
| private Map<K, V> hashes | |
| HELPER | back to summary |
|---|---|
| private static final CMSSignedHelper HELPER | |
| signedContent | back to summary |
|---|---|
| pack-priv CMSTypedData signedContent | |
| signedData | back to summary |
|---|---|
| pack-priv SignedData signedData | |
| signerInfoStore | back to summary |
|---|---|
| pack-priv SignerInformationStore signerInfoStore | |
| CMSSignedData | back to summary |
|---|---|
| private CMSSignedData(CMSSignedData c) | |
| CMSSignedData | back to summary |
|---|---|
| public CMSSignedData(byte[] sigBlock) throws CMSException | |
| CMSSignedData | back to summary |
|---|---|
| public CMSSignedData(CMSProcessable signedContent, byte[] sigBlock) throws CMSException | |
| CMSSignedData | back to summary |
|---|---|
| public CMSSignedData(Map<K, V> hashes, byte[] sigBlock) throws CMSException Content with detached signature, digests precomputed
| |
| CMSSignedData | back to summary |
|---|---|
| public CMSSignedData(CMSProcessable signedContent, InputStream sigData) throws CMSException base constructor - content with detached signature.
| |
| CMSSignedData | back to summary |
|---|---|
| public CMSSignedData(InputStream sigData) throws CMSException base constructor - with encapsulated content | |
| CMSSignedData | back to summary |
|---|---|
| public CMSSignedData(final CMSProcessable signedContent, ContentInfo sigData) throws CMSException | |
| CMSSignedData | back to summary |
|---|---|
| public CMSSignedData(Map<K, V> hashes, ContentInfo sigData) throws CMSException | |
| CMSSignedData | back to summary |
|---|---|
| public CMSSignedData(ContentInfo sigData) throws CMSException | |
| addDigestAlgorithm | back to summary |
|---|---|
| public static CMSSignedData addDigestAlgorithm(CMSSignedData signedData, AlgorithmIdentifier digestAlgorithm) Return a new CMSSignedData which guarantees to have the passed in digestAlgorithm in it. Uses the current DigestAlgorithmIdentifierFinder for creating the digest sets.
| |
| addDigestAlgorithm | back to summary |
|---|---|
| public static CMSSignedData addDigestAlgorithm(CMSSignedData signedData, AlgorithmIdentifier digestAlgorithm, DigestAlgorithmIdentifierFinder digestAlgIdFinder) Return a new CMSSignedData which guarantees to have the passed in digestAlgorithm in it. Uses the passed in DigestAlgorithmIdentifierFinder for creating the digest sets.
| |
| getAttributeCertificates | back to summary |
|---|---|
| public Store Return any X.509 attribute certificate objects in this SignedData structure as a Store of X509AttributeCertificateHolder objects.
| |
| getCertificates | back to summary |
|---|---|
| public Store Return any X.509 certificate objects in this SignedData structure as a Store of X509CertificateHolder objects.
| |
| getCRLs | back to summary |
|---|---|
| public Store Return any X.509 CRL objects in this SignedData structure as a Store of X509CRLHolder objects.
| |
| getDigestAlgorithmIDs | back to summary |
|---|---|
| public Set Return the digest algorithm identifiers for the SignedData object
| |
| getEncoded | back to summary |
|---|---|
| public byte[] getEncoded() throws IOException Implements org. return the ASN.1 encoded representation of this object.
| |
| getEncoded | back to summary |
|---|---|
| public byte[] getEncoded(String encoding) throws IOException return the ASN.1 encoded representation of this object using the specified encoding.
| |
| getOtherRevocationInfo | back to summary |
|---|---|
| public Store Return any OtherRevocationInfo OtherRevInfo objects of the type indicated by otherRevocationInfoFormat in this SignedData structure.
| |
| getSignedContent | back to summary |
|---|---|
| public CMSTypedData getSignedContent() | |
| getSignedContentTypeOID | back to summary |
|---|---|
| public String getSignedContentTypeOID() Return the a string representation of the OID associated with the encapsulated content info structure carried in the signed data.
| |
| getSignedData | back to summary |
|---|---|
| private SignedData getSignedData() throws CMSException | |
| getSignerInfos | back to summary |
|---|---|
| public SignerInformationStore getSignerInfos() return the collection of signers that are associated with the signatures for the message. | |
| getVersion | back to summary |
|---|---|
| public int getVersion() Return the version number for this object | |
| isCertificateManagementMessage | back to summary |
|---|---|
| public boolean isCertificateManagementMessage() Return if this is object represents a certificate management message.
| |
| isDetachedSignature | back to summary |
|---|---|
| public boolean isDetachedSignature() Return if this is object represents a detached signature.
| |
| replaceCertificatesAndCRLs | back to summary |
|---|---|
| public static CMSSignedData replaceCertificatesAndCRLs(CMSSignedData signedData, Store<T> certificates, Store<T> attrCerts, Store<T> revocations) throws CMSException Replace the certificate and CRL information associated with this CMSSignedData object with the new one passed in.
| |
| replaceSigners | back to summary |
|---|---|
| public static CMSSignedData replaceSigners(CMSSignedData signedData, SignerInformationStore signerInformationStore) Replace the SignerInformation store associated with this CMSSignedData object with the new one passed in using the current DigestAlgorithmIdentifierFinder for creating the digest sets. You would probably only want to do this if you wanted to change the unsigned attributes associated with a signer, or perhaps delete one.
| |
| replaceSigners | back to summary |
|---|---|
| public static CMSSignedData replaceSigners(CMSSignedData signedData, SignerInformationStore signerInformationStore, DigestAlgorithmIdentifierFinder digestAlgIdFinder) Replace the SignerInformation store associated with this CMSSignedData object with the new one passed in using the passed in DigestAlgorithmIdentifierFinder for creating the digest sets. You would probably only want to do this if you wanted to change the unsigned attributes associated with a signer, or perhaps delete one.
| |
| toASN1Structure | back to summary |
|---|---|
| public ContentInfo toASN1Structure() return the ContentInfo | |
| verifyCounterSignature | back to summary |
|---|---|
| private boolean verifyCounterSignature(SignerInformation counterSigner, SignerInformationVerifierProvider verifierProvider) throws OperatorCreationException, CMSException | |
| verifySignatures | back to summary |
|---|---|
| public boolean verifySignatures(SignerInformationVerifierProvider verifierProvider) throws CMSException Verify all the SignerInformation objects and their associated counter signatures attached to this CMS SignedData object.
| |
| verifySignatures | back to summary |
|---|---|
| public boolean verifySignatures(SignerInformationVerifierProvider verifierProvider, boolean ignoreCounterSignatures) throws CMSException Verify all the SignerInformation objects and optionally their associated counter signatures attached to this CMS SignedData object.
| |