org.bouncycastle.cms
public class CMSSignedDataGenerator extends CMSSignedGenerator
A simple example of usage.
CertStore certs...
CMSSignedDataGenerator gen = new CMSSignedDataGenerator();
gen.addSigner(privKey, cert, CMSSignedGenerator.DIGEST_SHA1);
gen.addCertificatesAndCRLs(certs);
CMSSignedData data = gen.generate(content, "BC");
_certs, _crls, _digests, _signers, DATA, DIGEST_GOST3411, DIGEST_MD5, DIGEST_RIPEMD128, DIGEST_RIPEMD160, DIGEST_RIPEMD256, DIGEST_SHA1, DIGEST_SHA224, DIGEST_SHA256, DIGEST_SHA384, DIGEST_SHA512, ENCRYPTION_DSA, ENCRYPTION_ECDSA, ENCRYPTION_ECGOST3410, ENCRYPTION_GOST3410, ENCRYPTION_RSA, ENCRYPTION_RSA_PSS, rand| Constructor and Description |
|---|
CMSSignedDataGenerator()
base constructor
|
CMSSignedDataGenerator(java.security.SecureRandom rand)
constructor allowing specific source of randomness
|
| Modifier and Type | Method and Description |
|---|---|
void |
addSigner(java.security.PrivateKey key,
byte[] subjectKeyID,
java.lang.String digestOID)
add a signer - no attributes other than the default ones will be
provided here.
|
void |
addSigner(java.security.PrivateKey key,
byte[] subjectKeyID,
java.lang.String digestOID,
org.bouncycastle.asn1.cms.AttributeTable signedAttr,
org.bouncycastle.asn1.cms.AttributeTable unsignedAttr)
add a signer with extra signed/unsigned attributes.
|
void |
addSigner(java.security.PrivateKey key,
byte[] subjectKeyID,
java.lang.String digestOID,
CMSAttributeTableGenerator signedAttrGen,
CMSAttributeTableGenerator unsignedAttrGen)
add a signer with extra signed/unsigned attributes based on generators.
|
void |
addSigner(java.security.PrivateKey key,
byte[] subjectKeyID,
java.lang.String encryptionOID,
java.lang.String digestOID)
add a signer, specifying the digest encryption algorithm to use - no attributes other than the default ones will be
provided here.
|
void |
addSigner(java.security.PrivateKey key,
byte[] subjectKeyID,
java.lang.String encryptionOID,
java.lang.String digestOID,
org.bouncycastle.asn1.cms.AttributeTable signedAttr,
org.bouncycastle.asn1.cms.AttributeTable unsignedAttr)
add a signer, specifying the digest encryption algorithm, with extra signed/unsigned attributes.
|
void |
addSigner(java.security.PrivateKey key,
byte[] subjectKeyID,
java.lang.String encryptionOID,
java.lang.String digestOID,
CMSAttributeTableGenerator signedAttrGen,
CMSAttributeTableGenerator unsignedAttrGen)
add a signer, including digest encryption algorithm, with extra signed/unsigned attributes based on generators.
|
void |
addSigner(java.security.PrivateKey key,
java.security.cert.X509Certificate cert,
java.lang.String digestOID)
add a signer - no attributes other than the default ones will be
provided here.
|
void |
addSigner(java.security.PrivateKey key,
java.security.cert.X509Certificate cert,
java.lang.String digestOID,
org.bouncycastle.asn1.cms.AttributeTable signedAttr,
org.bouncycastle.asn1.cms.AttributeTable unsignedAttr)
add a signer with extra signed/unsigned attributes.
|
void |
addSigner(java.security.PrivateKey key,
java.security.cert.X509Certificate cert,
java.lang.String digestOID,
CMSAttributeTableGenerator signedAttrGen,
CMSAttributeTableGenerator unsignedAttrGen)
add a signer with extra signed/unsigned attributes based on generators.
|
void |
addSigner(java.security.PrivateKey key,
java.security.cert.X509Certificate cert,
java.lang.String encryptionOID,
java.lang.String digestOID)
add a signer, specifying the digest encryption algorithm to use - no attributes other than the default ones will be
provided here.
|
void |
addSigner(java.security.PrivateKey key,
java.security.cert.X509Certificate cert,
java.lang.String encryptionOID,
java.lang.String digestOID,
org.bouncycastle.asn1.cms.AttributeTable signedAttr,
org.bouncycastle.asn1.cms.AttributeTable unsignedAttr)
add a signer, specifying the digest encryption algorithm, with extra signed/unsigned attributes.
|
void |
addSigner(java.security.PrivateKey key,
java.security.cert.X509Certificate cert,
java.lang.String encryptionOID,
java.lang.String digestOID,
CMSAttributeTableGenerator signedAttrGen,
CMSAttributeTableGenerator unsignedAttrGen)
add a signer, specifying the digest encryption algorithm, with extra signed/unsigned attributes based on generators.
|
CMSSignedData |
generate(CMSProcessable content,
boolean encapsulate,
java.security.Provider sigProvider)
generate a signed object that for a CMS Signed Data
object using the given provider - if encapsulate is true a copy
of the message will be included in the signature with the
default content type "data".
|
CMSSignedData |
generate(CMSProcessable content,
boolean encapsulate,
java.lang.String sigProvider)
generate a signed object that for a CMS Signed Data
object using the given provider - if encapsulate is true a copy
of the message will be included in the signature with the
default content type "data".
|
CMSSignedData |
generate(CMSProcessable content,
java.security.Provider sigProvider)
generate a signed object that for a CMS Signed Data
object using the given provider.
|
CMSSignedData |
generate(CMSProcessable content,
java.lang.String sigProvider)
generate a signed object that for a CMS Signed Data
object using the given provider.
|
CMSSignedData |
generate(java.lang.String eContentType,
CMSProcessable content,
boolean encapsulate,
java.security.Provider sigProvider)
generate a signed object that for a CMS Signed Data
object using the given provider - if encapsulate is true a copy
of the message will be included in the signature.
|
CMSSignedData |
generate(java.lang.String eContentType,
CMSProcessable content,
boolean encapsulate,
java.security.Provider sigProvider,
boolean addDefaultAttributes)
Similar method to the other generate methods.
|
CMSSignedData |
generate(java.lang.String eContentType,
CMSProcessable content,
boolean encapsulate,
java.lang.String sigProvider)
generate a signed object that for a CMS Signed Data
object using the given provider - if encapsulate is true a copy
of the message will be included in the signature.
|
CMSSignedData |
generate(java.lang.String eContentType,
CMSProcessable content,
boolean encapsulate,
java.lang.String sigProvider,
boolean addDefaultAttributes)
Similar method to the other generate methods.
|
SignerInformationStore |
generateCounterSigners(SignerInformation signer,
java.security.Provider sigProvider)
generate a set of one or more SignerInformation objects representing counter signatures on
the passed in SignerInformation object.
|
SignerInformationStore |
generateCounterSigners(SignerInformation signer,
java.lang.String sigProvider)
generate a set of one or more SignerInformation objects representing counter signatures on
the passed in SignerInformation object.
|
addAttributeCertificates, addCertificatesAndCRLs, addSigners, getAttributeSet, getBaseParameters, getEncAlgorithmIdentifier, getEncOID, getGeneratedDigestspublic CMSSignedDataGenerator()
public CMSSignedDataGenerator(java.security.SecureRandom rand)
rand - instance of SecureRandom to usepublic void addSigner(java.security.PrivateKey key,
java.security.cert.X509Certificate cert,
java.lang.String digestOID)
throws java.lang.IllegalArgumentException
key - signing key to usecert - certificate containing corresponding public keydigestOID - digest algorithm OIDjava.lang.IllegalArgumentExceptionpublic void addSigner(java.security.PrivateKey key,
java.security.cert.X509Certificate cert,
java.lang.String encryptionOID,
java.lang.String digestOID)
throws java.lang.IllegalArgumentException
key - signing key to usecert - certificate containing corresponding public keyencryptionOID - digest encryption algorithm OIDdigestOID - digest algorithm OIDjava.lang.IllegalArgumentExceptionpublic void addSigner(java.security.PrivateKey key,
byte[] subjectKeyID,
java.lang.String digestOID)
throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentExceptionpublic void addSigner(java.security.PrivateKey key,
byte[] subjectKeyID,
java.lang.String encryptionOID,
java.lang.String digestOID)
throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentExceptionpublic void addSigner(java.security.PrivateKey key,
java.security.cert.X509Certificate cert,
java.lang.String digestOID,
org.bouncycastle.asn1.cms.AttributeTable signedAttr,
org.bouncycastle.asn1.cms.AttributeTable unsignedAttr)
throws java.lang.IllegalArgumentException
key - signing key to usecert - certificate containing corresponding public keydigestOID - digest algorithm OIDsignedAttr - table of attributes to be included in signatureunsignedAttr - table of attributes to be included as unsignedjava.lang.IllegalArgumentExceptionpublic void addSigner(java.security.PrivateKey key,
java.security.cert.X509Certificate cert,
java.lang.String encryptionOID,
java.lang.String digestOID,
org.bouncycastle.asn1.cms.AttributeTable signedAttr,
org.bouncycastle.asn1.cms.AttributeTable unsignedAttr)
throws java.lang.IllegalArgumentException
key - signing key to usecert - certificate containing corresponding public keyencryptionOID - digest encryption algorithm OIDdigestOID - digest algorithm OIDsignedAttr - table of attributes to be included in signatureunsignedAttr - table of attributes to be included as unsignedjava.lang.IllegalArgumentExceptionpublic void addSigner(java.security.PrivateKey key,
byte[] subjectKeyID,
java.lang.String digestOID,
org.bouncycastle.asn1.cms.AttributeTable signedAttr,
org.bouncycastle.asn1.cms.AttributeTable unsignedAttr)
throws java.lang.IllegalArgumentException
key - signing key to usesubjectKeyID - subjectKeyID of corresponding public keydigestOID - digest algorithm OIDsignedAttr - table of attributes to be included in signatureunsignedAttr - table of attributes to be included as unsignedjava.lang.IllegalArgumentExceptionpublic void addSigner(java.security.PrivateKey key,
byte[] subjectKeyID,
java.lang.String encryptionOID,
java.lang.String digestOID,
org.bouncycastle.asn1.cms.AttributeTable signedAttr,
org.bouncycastle.asn1.cms.AttributeTable unsignedAttr)
throws java.lang.IllegalArgumentException
key - signing key to usesubjectKeyID - subjectKeyID of corresponding public keyencryptionOID - digest encryption algorithm OIDdigestOID - digest algorithm OIDsignedAttr - table of attributes to be included in signatureunsignedAttr - table of attributes to be included as unsignedjava.lang.IllegalArgumentExceptionpublic void addSigner(java.security.PrivateKey key,
java.security.cert.X509Certificate cert,
java.lang.String digestOID,
CMSAttributeTableGenerator signedAttrGen,
CMSAttributeTableGenerator unsignedAttrGen)
throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentExceptionpublic void addSigner(java.security.PrivateKey key,
java.security.cert.X509Certificate cert,
java.lang.String encryptionOID,
java.lang.String digestOID,
CMSAttributeTableGenerator signedAttrGen,
CMSAttributeTableGenerator unsignedAttrGen)
throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentExceptionpublic void addSigner(java.security.PrivateKey key,
byte[] subjectKeyID,
java.lang.String digestOID,
CMSAttributeTableGenerator signedAttrGen,
CMSAttributeTableGenerator unsignedAttrGen)
throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentExceptionpublic void addSigner(java.security.PrivateKey key,
byte[] subjectKeyID,
java.lang.String encryptionOID,
java.lang.String digestOID,
CMSAttributeTableGenerator signedAttrGen,
CMSAttributeTableGenerator unsignedAttrGen)
throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentExceptionpublic CMSSignedData generate(CMSProcessable content, java.lang.String sigProvider) throws java.security.NoSuchAlgorithmException, java.security.NoSuchProviderException, CMSException
java.security.NoSuchAlgorithmExceptionjava.security.NoSuchProviderExceptionCMSExceptionpublic CMSSignedData generate(CMSProcessable content, java.security.Provider sigProvider) throws java.security.NoSuchAlgorithmException, CMSException
java.security.NoSuchAlgorithmExceptionCMSExceptionpublic CMSSignedData generate(java.lang.String eContentType, CMSProcessable content, boolean encapsulate, java.lang.String sigProvider) throws java.security.NoSuchAlgorithmException, java.security.NoSuchProviderException, CMSException
java.security.NoSuchAlgorithmExceptionjava.security.NoSuchProviderExceptionCMSExceptionpublic CMSSignedData generate(java.lang.String eContentType, CMSProcessable content, boolean encapsulate, java.security.Provider sigProvider) throws java.security.NoSuchAlgorithmException, CMSException
java.security.NoSuchAlgorithmExceptionCMSExceptionpublic CMSSignedData generate(java.lang.String eContentType, CMSProcessable content, boolean encapsulate, java.lang.String sigProvider, boolean addDefaultAttributes) throws java.security.NoSuchAlgorithmException, java.security.NoSuchProviderException, CMSException
java.security.NoSuchAlgorithmExceptionjava.security.NoSuchProviderExceptionCMSExceptionpublic CMSSignedData generate(java.lang.String eContentType, CMSProcessable content, boolean encapsulate, java.security.Provider sigProvider, boolean addDefaultAttributes) throws java.security.NoSuchAlgorithmException, CMSException
java.security.NoSuchAlgorithmExceptionCMSExceptionpublic CMSSignedData generate(CMSProcessable content, boolean encapsulate, java.lang.String sigProvider) throws java.security.NoSuchAlgorithmException, java.security.NoSuchProviderException, CMSException
java.security.NoSuchAlgorithmExceptionjava.security.NoSuchProviderExceptionCMSExceptionpublic CMSSignedData generate(CMSProcessable content, boolean encapsulate, java.security.Provider sigProvider) throws java.security.NoSuchAlgorithmException, CMSException
java.security.NoSuchAlgorithmExceptionCMSExceptionpublic SignerInformationStore generateCounterSigners(SignerInformation signer, java.security.Provider sigProvider) throws java.security.NoSuchAlgorithmException, CMSException
signer - the signer to be countersignedsigProvider - the provider to be used for counter signing.java.security.NoSuchAlgorithmExceptionCMSExceptionpublic SignerInformationStore generateCounterSigners(SignerInformation signer, java.lang.String sigProvider) throws java.security.NoSuchAlgorithmException, java.security.NoSuchProviderException, CMSException
signer - the signer to be countersignedsigProvider - the provider to be used for counter signing.java.security.NoSuchAlgorithmExceptionjava.security.NoSuchProviderExceptionCMSException