java.lang.Object | ||
↳ | org.bouncycastle.mail.smime.SMIMEGenerator | |
↳ | org.bouncycastle.mail.smime.SMIMESignedGenerator |
general class for generating a pkcs7-signature message.
A simple example of usage.
X509Certificate signCert = ... KeyPair signKP = ... List certList = new ArrayList(); certList.add(signCert); Store certs = new JcaCertStore(certList); SMIMESignedGenerator gen = new SMIMESignedGenerator(); gen.addSignerInfoGenerator(new JcaSimpleSignerInfoGeneratorBuilder().setProvider("BC").build("SHA1withRSA", signKP.getPrivate(), signCert)); gen.addCertificates(certs); MimeMultipart smime = fact.generate(content);
Note: if you are using this class with AS2 or some other protocol that does not use "7bit" as the default content transfer encoding you will need to use the constructor that allows you to specify the default content transfer encoding, such as "binary".
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
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 |
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.bouncycastle.mail.smime.SMIMEGenerator
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
base constructor - default content transfer encoding 7bit
| |||||||||||
base constructor - default content transfer encoding explicitly set
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
This method is deprecated.
use addAttributeCertificates(Store)
| |||||||||||
This method is deprecated.
use addCertificates(Store) and addCRLs(Store)
| |||||||||||
This method is deprecated.
use addSignerInfoGenerator()
| |||||||||||
This method is deprecated.
use addSignerInfoGenerator()
| |||||||||||
This method is deprecated.
use addSignerInfoGenerator()
| |||||||||||
This method is deprecated.
use addSignerInfoGenerator()
| |||||||||||
Add a store of precalculated signers to the generator.
| |||||||||||
generate a signed object that contains an SMIME Signed Multipart
object using the given provider from the given MimeMessage
| |||||||||||
generate a signed object that contains an SMIME Signed Multipart
object using the given provider.
| |||||||||||
This method is deprecated.
use generate(MimeBodyPart)
| |||||||||||
generate a signed object that contains an SMIME Signed Multipart
object using the given provider from the given MimeMessage
| |||||||||||
Creates a certificate management message which is like a signed message with no content
or signers but that still carries certificates and CRLs.
| |||||||||||
Creates a certificate management message which is like a signed message with no content
or signers but that still carries certificates and CRLs.
| |||||||||||
This method is deprecated.
use generateEncapsulated(content)
| |||||||||||
This method is deprecated.
use generateEncapsulated(content)
| |||||||||||
This method is deprecated.
use generateEncapsulated(content)
| |||||||||||
generate a signed message with encapsulated content
Note: doing this is strongly not recommended as it means a recipient of the message will have to be able to read the signature to read the message. | |||||||||||
This method is deprecated.
use generateEncapsulated(content)
| |||||||||||
Return a map of oids and byte arrays representing the digests calculated on the content during
the last generate.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.bouncycastle.mail.smime.SMIMEGenerator
| |||||||||||
From class
java.lang.Object
|
base constructor - default content transfer encoding 7bit
base constructor - default content transfer encoding explicitly set
defaultContentTransferEncoding | new default to use. |
---|
This method is deprecated.
use addAttributeCertificates(Store)
Add the attribute certificates contained in the passed in store to the generator.
store | a store of Version 2 attribute certificates |
---|
CMSException | if an error occurse processing the store. |
---|
This method is deprecated.
use addCertificates(Store) and addCRLs(Store)
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.
certStore | CertStore containing the certificates and CRLs to be added. |
---|
CertStoreException | |
---|---|
SMIMEException |
This method is deprecated.
use addSignerInfoGenerator()
add a signer - no attributes other than the default ones will be provided here.
key | key to use to generate the signature |
---|---|
cert | the public key certificate associated with the signer's key. |
encryptionOID | object ID of the digest ecnryption algorithm to use. |
digestOID | object ID of the digest algorithm to use. |
IllegalArgumentException | any of the arguments are inappropriate |
---|
This method is deprecated.
use addSignerInfoGenerator()
Add a signer with extra signed/unsigned attributes or overrides for the standard attributes and a digest encryption algorithm. For example this method can be used to explictly set default attributes such as the signing time.
key | key to use to generate the signature |
---|---|
cert | the public key certificate associated with the signer's key. |
encryptionOID | the digest encryption algorithm OID. |
digestOID | object ID of the digest algorithm to use. |
signedAttr | signed attributes to be included in the signature. |
unsignedAttr | unsigned attribitues to be included. |
IllegalArgumentException | any of the arguments are inappropriate |
---|
This method is deprecated.
use addSignerInfoGenerator()
add a signer - no attributes other than the default ones will be provided here.
key | key to use to generate the signature |
---|---|
cert | the public key certificate associated with the signer's key. |
digestOID | object ID of the digest algorithm to use. |
IllegalArgumentException | any of the arguments are inappropriate |
---|
This method is deprecated.
use addSignerInfoGenerator()
Add a signer with extra signed/unsigned attributes or overrides for the standard attributes. For example this method can be used to explictly set default attributes such as the signing time.
key | key to use to generate the signature |
---|---|
cert | the public key certificate associated with the signer's key. |
digestOID | object ID of the digest algorithm to use. |
signedAttr | signed attributes to be included in the signature. |
unsignedAttr | unsigned attribitues to be included. |
IllegalArgumentException | any of the arguments are inappropriate |
---|
Add a store of precalculated signers to the generator.
signerStore | store of signers |
---|
generate a signed object that contains an SMIME Signed Multipart object using the given provider from the given MimeMessage
NoSuchAlgorithmException | if the required algorithms for the signature cannot be found. |
---|---|
NoSuchProviderException | if no provider can be found. |
SMIMEException | if an exception occurs in processing the signature. |
generate a signed object that contains an SMIME Signed Multipart object using the given provider.
content | the MimeBodyPart to be signed. |
---|---|
sigProvider | the provider to be used for the signature. |
NoSuchAlgorithmException | if the required algorithms for the signature cannot be found. |
---|---|
SMIMEException | if an exception occurs in processing the signature. |
This method is deprecated.
use generate(MimeBodyPart)
generate a signed object that contains an SMIME Signed Multipart object using the given provider.
content | the MimeBodyPart to be signed. |
---|---|
sigProvider | the provider to be used for the signature. |
NoSuchAlgorithmException | if the required algorithms for the signature cannot be found. |
---|---|
NoSuchProviderException | if no provider can be found. |
SMIMEException | if an exception occurs in processing the signature. |
generate a signed object that contains an SMIME Signed Multipart object using the given provider from the given MimeMessage
NoSuchAlgorithmException | if the required algorithms for the signature cannot be found. |
---|---|
NoSuchProviderException | if no provider can be found. |
SMIMEException | if an exception occurs in processing the signature. |
Creates a certificate management message which is like a signed message with no content or signers but that still carries certificates and CRLs.
Creates a certificate management message which is like a signed message with no content or signers but that still carries certificates and CRLs.
SMIMEException |
---|
This method is deprecated.
use generateEncapsulated(content)
generate a signed message with encapsulated content
Note: doing this is strongly not recommended as it means a recipient of the message will have to be able to read the signature to read the message.
This method is deprecated.
use generateEncapsulated(content)
generate a signed object that contains an SMIME Signed Multipart object using the given provider from the given MimeMessage.
Note: doing this is strongly not recommended as it means a recipient of the message will have to be able to read the signature to read the message.
This method is deprecated.
use generateEncapsulated(content)
generate a signed message with encapsulated content
Note: doing this is strongly not recommended as it means a recipient of the message will have to be able to read the signature to read the message.
generate a signed message with encapsulated content
Note: doing this is strongly not recommended as it means a recipient of the message will have to be able to read the signature to read the message.
SMIMEException |
---|
This method is deprecated.
use generateEncapsulated(content)
generate a signed object that contains an SMIME Signed Multipart object using the given provider from the given MimeMessage.
Note: doing this is strongly not recommended as it means a recipient of the message will have to be able to read the signature to read the message.
Return a map of oids and byte arrays representing the digests calculated on the content during the last generate.