Package org.bouncycastle.cms
Class CMSSignedGenerator
java.lang.Object
org.bouncycastle.cms.CMSSignedGenerator
- Direct Known Subclasses:
CMSSignedDataGenerator
public class CMSSignedGenerator extends Object
-
Field Summary
Fields Modifier and Type Field Description protected List_signersprotected Listcertsprotected Listcrlsstatic StringDATADefault type for the signed data.static StringDIGEST_MD5static StringDIGEST_SHA1static StringDIGEST_SHA256static StringDIGEST_SHA384static StringDIGEST_SHA512protected Mapdigestsstatic StringENCRYPTION_DSAstatic StringENCRYPTION_ECDSAstatic StringENCRYPTION_RSAstatic StringENCRYPTION_RSA_PSSprotected SecureRandomrandprotected ListsignerGens -
Constructor Summary
Constructors Modifier Constructor Description protectedCMSSignedGenerator()base constructorprotectedCMSSignedGenerator(SecureRandom rand)constructor allowing specific source of randomness -
Method Summary
Modifier and Type Method Description voidaddAttributeCertificate(X509AttributeCertificateHolder attrCert)Add the attribute certificates in attrStore to the certificate set to be included with the generated SignedData message.voidaddAttributeCertificates(Store attrStore)Add the attribute certificates in attrStore to the certificate set to be included with the generated SignedData message.voidaddAttributeCertificates(X509Store store)Deprecated.use basic Store methodvoidaddCertificate(X509CertificateHolder certificate)Add a certificate to the certificate set to be included with the generated SignedData message.voidaddCertificates(Store certStore)Add the certificates in certStore to the certificate set to be included with the generated SignedData message.voidaddCertificatesAndCRLs(CertStore certStore)Deprecated.use addCertificates and addCRLsvoidaddCRL(X509CRLHolder crl)Add a CRL to the CRL set to be included with the generated SignedData message.voidaddCRLs(Store crlStore)Add the CRLs in crlStore to the CRL set to be included with the generated SignedData message.voidaddSignerInfoGenerator(SignerInfoGenerator infoGen)voidaddSigners(SignerInformationStore signerStore)Add a store of precalculated signers to the generator.protected ASN1SetgetAttributeSet(AttributeTable attr)protected MapgetBaseParameters(ASN1ObjectIdentifier contentType, AlgorithmIdentifier digAlgId, byte[] hash)protected StringgetEncOID(PrivateKey key, String digestOID)MapgetGeneratedDigests()Return a map of oids and byte arrays representing the digests calculated on the content during the last generate.
-
Field Details
-
DATA
Default type for the signed data. -
DIGEST_SHA1
-
DIGEST_SHA256
-
DIGEST_SHA384
-
DIGEST_SHA512
-
DIGEST_MD5
-
ENCRYPTION_RSA
-
ENCRYPTION_DSA
-
ENCRYPTION_ECDSA
-
ENCRYPTION_RSA_PSS
-
certs
-
crls
-
_signers
-
signerGens
-
digests
-
rand
-
-
Constructor Details
-
CMSSignedGenerator
protected CMSSignedGenerator()base constructor -
CMSSignedGenerator
constructor allowing specific source of randomness- Parameters:
rand- instance of SecureRandom to use
-
-
Method Details
-
getEncOID
-
getBaseParameters
protected Map getBaseParameters(ASN1ObjectIdentifier contentType, AlgorithmIdentifier digAlgId, byte[] hash) -
getAttributeSet
-
addCertificatesAndCRLs
Deprecated.use addCertificates and addCRLsadd the certificates and CRLs contained in the given CertStore to the pool that will be included in the encoded signature block.Note: this assumes the CertStore will support null in the get methods.
- Parameters:
certStore- CertStore containing the public key certificates and CRLs- Throws:
CertStoreException- if an issue occurs processing the CertStoreCMSException- if an issue occurse transforming data from the CertStore into the message
-
addCertificate
Add a certificate to the certificate set to be included with the generated SignedData message.- Parameters:
certificate- the certificate to be included.- Throws:
CMSException- if the certificate cannot be encoded for adding.
-
addCertificates
Add the certificates in certStore to the certificate set to be included with the generated SignedData message.- Parameters:
certStore- the store containing the certificates to be included.- Throws:
CMSException- if the certificates cannot be encoded for adding.
-
addCRL
Add a CRL to the CRL set to be included with the generated SignedData message.- Parameters:
crl- the CRL to be included.
-
addCRLs
Add the CRLs in crlStore to the CRL set to be included with the generated SignedData message.- Parameters:
crlStore- the store containing the CRLs to be included.- Throws:
CMSException- if the CRLs cannot be encoded for adding.
-
addAttributeCertificate
Add the attribute certificates in attrStore to the certificate set to be included with the generated SignedData message.- Parameters:
attrCert- the store containing the certificates to be included.- Throws:
CMSException- if the attribute certificate cannot be encoded for adding.
-
addAttributeCertificates
Add the attribute certificates in attrStore to the certificate set to be included with the generated SignedData message.- Parameters:
attrStore- the store containing the certificates to be included.- Throws:
CMSException- if the attribute certificate cannot be encoded for adding.
-
addAttributeCertificates
Deprecated.use basic Store methodAdd the attribute certificates contained in the passed in store to the generator.- Parameters:
store- a store of Version 2 attribute certificates- Throws:
CMSException- if an error occurse processing the store.
-
addSigners
Add a store of precalculated signers to the generator.- Parameters:
signerStore- store of signers
-
addSignerInfoGenerator
-
getGeneratedDigests
Return a map of oids and byte arrays representing the digests calculated on the content during the last generate.- Returns:
- a map of oids (as String objects) and byte[] representing digests.
-