|
Bouncy Castle Cryptography Library 1.81 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.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 1: 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".
Note 2: between RFC 3851 and RFC 5751 the values used in the micalg parameter for signed messages changed. We will accept both, but the default is now to use RFC 5751. In the event you are dealing with an older style system you will also need to use a constructor that sets the micalgs table and call it with RFC3851_MICALGS.
Field Summary | |
static java.lang.String |
DIGEST_GOST3411
|
static java.lang.String |
DIGEST_MD5
|
static java.lang.String |
DIGEST_RIPEMD128
|
static java.lang.String |
DIGEST_RIPEMD160
|
static java.lang.String |
DIGEST_RIPEMD256
|
static java.lang.String |
DIGEST_SHA1
|
static java.lang.String |
DIGEST_SHA224
|
static java.lang.String |
DIGEST_SHA256
|
static java.lang.String |
DIGEST_SHA384
|
static java.lang.String |
DIGEST_SHA512
|
static java.lang.String |
ENCRYPTION_DSA
|
static java.lang.String |
ENCRYPTION_ECDSA
|
static java.lang.String |
ENCRYPTION_ECGOST3410
|
static java.lang.String |
ENCRYPTION_ECGOST3410_2012_256
|
static java.lang.String |
ENCRYPTION_ECGOST3410_2012_512
|
static java.lang.String |
ENCRYPTION_GOST3410
|
static java.lang.String |
ENCRYPTION_RSA
|
static java.lang.String |
ENCRYPTION_RSA_PSS
|
static java.util.Map |
RFC3851_MICALGS
|
static java.util.Map |
RFC5751_MICALGS
|
static java.util.Map |
STANDARD_MICALGS
|
Fields inherited from class org.bouncycastle.mail.smime.SMIMEGenerator |
encoding, useBase64 |
Constructor Summary | |
SMIMESignedGenerator()
base constructor - default content transfer encoding 7bit |
|
SMIMESignedGenerator(java.util.Map micAlgs)
base constructor - default content transfer encoding explicitly set |
|
SMIMESignedGenerator(java.lang.String defaultContentTransferEncoding)
base constructor - default content transfer encoding explicitly set |
|
SMIMESignedGenerator(java.lang.String defaultContentTransferEncoding,
java.util.Map micAlgs)
base constructor - default content transfer encoding explicitly set |
Method Summary | |
void |
addAttributeCertificates(org.bouncycastle.util.Store certStore)
|
void |
addCertificates(org.bouncycastle.util.Store certStore)
|
void |
addCRLs(org.bouncycastle.util.Store crlStore)
|
void |
addSignerInfoGenerator(org.bouncycastle.cms.SignerInfoGenerator sigInfoGen)
|
void |
addSigners(org.bouncycastle.cms.SignerInformationStore signerStore)
Add a store of precalculated signers to the generator. |
javax.mail.internet.MimeMultipart |
generate(javax.mail.internet.MimeBodyPart content)
|
javax.mail.internet.MimeMultipart |
generate(javax.mail.internet.MimeMessage message)
|
javax.mail.internet.MimeBodyPart |
generateCertificateManagement()
Creates a certificate management message which is like a signed message with no content or signers but that still carries certificates and CRLs. |
javax.mail.internet.MimeBodyPart |
generateEncapsulated(javax.mail.internet.MimeBodyPart 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. |
javax.mail.internet.MimeBodyPart |
generateEncapsulated(javax.mail.internet.MimeMessage message)
|
java.util.Map |
getGeneratedDigests()
Return a map of oids and byte arrays representing the digests calculated on the content during the last generate. |
Methods inherited from class org.bouncycastle.mail.smime.SMIMEGenerator |
makeContentBodyPart, makeContentBodyPart, setContentTransferEncoding |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String DIGEST_SHA1
public static final java.lang.String DIGEST_MD5
public static final java.lang.String DIGEST_SHA224
public static final java.lang.String DIGEST_SHA256
public static final java.lang.String DIGEST_SHA384
public static final java.lang.String DIGEST_SHA512
public static final java.lang.String DIGEST_GOST3411
public static final java.lang.String DIGEST_RIPEMD128
public static final java.lang.String DIGEST_RIPEMD160
public static final java.lang.String DIGEST_RIPEMD256
public static final java.lang.String ENCRYPTION_RSA
public static final java.lang.String ENCRYPTION_DSA
public static final java.lang.String ENCRYPTION_ECDSA
public static final java.lang.String ENCRYPTION_RSA_PSS
public static final java.lang.String ENCRYPTION_GOST3410
public static final java.lang.String ENCRYPTION_ECGOST3410
public static final java.lang.String ENCRYPTION_ECGOST3410_2012_256
public static final java.lang.String ENCRYPTION_ECGOST3410_2012_512
public static final java.util.Map RFC3851_MICALGS
public static final java.util.Map RFC5751_MICALGS
public static final java.util.Map STANDARD_MICALGS
Constructor Detail |
public SMIMESignedGenerator()
public SMIMESignedGenerator(java.lang.String defaultContentTransferEncoding)
defaultContentTransferEncoding
- new default to use.public SMIMESignedGenerator(java.util.Map micAlgs)
micAlgs
- a map of ANS1ObjectIdentifiers to strings hash algorithm names.public SMIMESignedGenerator(java.lang.String defaultContentTransferEncoding, java.util.Map micAlgs)
defaultContentTransferEncoding
- new default to use.micAlgs
- a map of ANS1ObjectIdentifiers to strings hash algorithm names.Method Detail |
public void addSigners(org.bouncycastle.cms.SignerInformationStore signerStore)
signerStore
- store of signerspublic void addSignerInfoGenerator(org.bouncycastle.cms.SignerInfoGenerator sigInfoGen)
sigInfoGen
- public void addCertificates(org.bouncycastle.util.Store certStore)
public void addCRLs(org.bouncycastle.util.Store crlStore)
public void addAttributeCertificates(org.bouncycastle.util.Store certStore)
public java.util.Map getGeneratedDigests()
public javax.mail.internet.MimeMultipart generate(javax.mail.internet.MimeBodyPart content) throws SMIMEException
SMIMEException
public javax.mail.internet.MimeMultipart generate(javax.mail.internet.MimeMessage message) throws SMIMEException
SMIMEException
public javax.mail.internet.MimeBodyPart generateEncapsulated(javax.mail.internet.MimeBodyPart content) throws SMIMEException
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
public javax.mail.internet.MimeBodyPart generateEncapsulated(javax.mail.internet.MimeMessage message) throws SMIMEException
SMIMEException
public javax.mail.internet.MimeBodyPart generateCertificateManagement() throws SMIMEException
SMIMEException
|
Bouncy Castle Cryptography Library 1.81 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |