org.bouncycastle.cms
Class CMSSignedDataGenerator
java.lang.Object
|
+--org.bouncycastle.cms.CMSSignedDataGenerator
- public class CMSSignedDataGenerator
- extends java.lang.Object
general class for generating a pkcs7-signature message.
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");
Method Summary |
void |
addCertificatesAndCRLs(org.bouncycastle.jce.cert.CertStore certStore)
add the certificates and CRLs contained in the given CertStore
to the pool that will be included in the encoded signature block. |
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. |
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. |
CMSSignedData |
generate(CMSProcessable content,
java.lang.String sigProvider)
generate a signed object that for a CMS Signed Data
object using the given provider. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DIGEST_SHA1
public static final java.lang.String DIGEST_SHA1
DIGEST_MD5
public static final java.lang.String DIGEST_MD5
ENCRYPTION_RSA
public static final java.lang.String ENCRYPTION_RSA
ENCRYPTION_DSA
public static final java.lang.String ENCRYPTION_DSA
CMSSignedDataGenerator
public CMSSignedDataGenerator()
- base constructor
addSigner
public void addSigner(java.security.PrivateKey key,
java.security.cert.X509Certificate cert,
java.lang.String digestOID)
throws java.lang.IllegalArgumentException
- add a signer - no attributes other than the default ones will be
provided here.
addSigner
public 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
- add a signer with extra signed/unsigned attributes.
addCertificatesAndCRLs
public void addCertificatesAndCRLs(org.bouncycastle.jce.cert.CertStore certStore)
throws org.bouncycastle.jce.cert.CertStoreException,
CMSException
- add 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.
generate
public CMSSignedData generate(CMSProcessable content,
java.lang.String sigProvider)
throws java.security.NoSuchAlgorithmException,
java.security.NoSuchProviderException,
CMSException
- generate a signed object that for a CMS Signed Data
object using the given provider.
generate
public CMSSignedData generate(CMSProcessable content,
boolean encapsulate,
java.lang.String sigProvider)
throws java.security.NoSuchAlgorithmException,
java.security.NoSuchProviderException,
CMSException
- 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.