Package org.bouncycastle.mail.smime
Class SMIMEEnvelopedGenerator
- java.lang.Object
-
- org.bouncycastle.mail.smime.SMIMEGenerator
-
- org.bouncycastle.mail.smime.SMIMEEnvelopedGenerator
-
public class SMIMEEnvelopedGenerator extends SMIMEGenerator
General class for generating a pkcs7-mime message. A simple example of usage.SMIMEEnvelopedGenerator fact = new SMIMEEnvelopedGenerator(); fact.addRecipientInfoGenerator(new JceKeyTransRecipientInfoGenerator(recipientCert).setProvider("BC")); MimeBodyPart mp = fact.generate(content, new JceCMSContentEncryptorBuilder(CMSAlgorithm.RC2_CBC, 40).setProvider("BC").build());
Note: Most clients expect the MimeBodyPart to be in a MimeMultipart when it's sent.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
AES128_CBC
static java.lang.String
AES128_WRAP
static java.lang.String
AES192_CBC
static java.lang.String
AES256_CBC
static java.lang.String
AES256_WRAP
static java.lang.String
CAMELLIA128_CBC
static java.lang.String
CAMELLIA128_WRAP
static java.lang.String
CAMELLIA192_CBC
static java.lang.String
CAMELLIA192_WRAP
static java.lang.String
CAMELLIA256_CBC
static java.lang.String
CAMELLIA256_WRAP
static java.lang.String
CAST5_CBC
static java.lang.String
DES_EDE3_CBC
static java.lang.String
DES_EDE3_WRAP
static java.lang.String
ECDH_SHA1KDF
static java.lang.String
IDEA_CBC
static java.lang.String
RC2_CBC
static java.lang.String
SEED_CBC
static java.lang.String
SEED_WRAP
-
Fields inherited from class org.bouncycastle.mail.smime.SMIMEGenerator
encoding, useBase64
-
-
Constructor Summary
Constructors Constructor Description SMIMEEnvelopedGenerator()
base constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addRecipientInfoGenerator(org.bouncycastle.cms.RecipientInfoGenerator recipientInfoGen)
add a recipientInfoGenerator.javax.mail.internet.MimeBodyPart
generate(javax.mail.internet.MimeBodyPart content, org.bouncycastle.operator.OutputEncryptor encryptor)
generate an enveloped object that contains an SMIME Enveloped object using the given content encryptorjavax.mail.internet.MimeBodyPart
generate(javax.mail.internet.MimeMessage message, org.bouncycastle.operator.OutputEncryptor encryptor)
generate an enveloped object that contains an SMIME Enveloped object using the given provider from the contents of the passed in messagevoid
setBerEncodeRecipients(boolean berEncodeRecipientSet)
Use a BER Set to store the recipient information-
Methods inherited from class org.bouncycastle.mail.smime.SMIMEGenerator
createSymmetricKeyGenerator, makeContentBodyPart, makeContentBodyPart, setContentTransferEncoding
-
-
-
-
Field Detail
-
DES_EDE3_CBC
public static final java.lang.String DES_EDE3_CBC
-
RC2_CBC
public static final java.lang.String RC2_CBC
-
IDEA_CBC
public static final java.lang.String IDEA_CBC
- See Also:
- Constant Field Values
-
CAST5_CBC
public static final java.lang.String CAST5_CBC
- See Also:
- Constant Field Values
-
AES128_CBC
public static final java.lang.String AES128_CBC
-
AES192_CBC
public static final java.lang.String AES192_CBC
-
AES256_CBC
public static final java.lang.String AES256_CBC
-
CAMELLIA128_CBC
public static final java.lang.String CAMELLIA128_CBC
-
CAMELLIA192_CBC
public static final java.lang.String CAMELLIA192_CBC
-
CAMELLIA256_CBC
public static final java.lang.String CAMELLIA256_CBC
-
SEED_CBC
public static final java.lang.String SEED_CBC
-
DES_EDE3_WRAP
public static final java.lang.String DES_EDE3_WRAP
-
AES128_WRAP
public static final java.lang.String AES128_WRAP
-
AES256_WRAP
public static final java.lang.String AES256_WRAP
-
CAMELLIA128_WRAP
public static final java.lang.String CAMELLIA128_WRAP
-
CAMELLIA192_WRAP
public static final java.lang.String CAMELLIA192_WRAP
-
CAMELLIA256_WRAP
public static final java.lang.String CAMELLIA256_WRAP
-
SEED_WRAP
public static final java.lang.String SEED_WRAP
-
ECDH_SHA1KDF
public static final java.lang.String ECDH_SHA1KDF
-
-
Method Detail
-
addRecipientInfoGenerator
public void addRecipientInfoGenerator(org.bouncycastle.cms.RecipientInfoGenerator recipientInfoGen) throws java.lang.IllegalArgumentException
add a recipientInfoGenerator.- Throws:
java.lang.IllegalArgumentException
-
setBerEncodeRecipients
public void setBerEncodeRecipients(boolean berEncodeRecipientSet)
Use a BER Set to store the recipient information
-
generate
public javax.mail.internet.MimeBodyPart generate(javax.mail.internet.MimeBodyPart content, org.bouncycastle.operator.OutputEncryptor encryptor) throws SMIMEException
generate an enveloped object that contains an SMIME Enveloped object using the given content encryptor- Throws:
SMIMEException
-
generate
public javax.mail.internet.MimeBodyPart generate(javax.mail.internet.MimeMessage message, org.bouncycastle.operator.OutputEncryptor encryptor) throws SMIMEException
generate an enveloped object that contains an SMIME Enveloped object using the given provider from the contents of the passed in message- Throws:
SMIMEException
-
-