public class SMIMEAuthEnvelopedGenerator extends SMIMEEnvelopedGenerator
A simple example of usage.
SMIMEAuthEnvelopedGenerator fact = new SMIMEAuthEnvelopedGenerator(); fact.addRecipientInfoGenerator(new JceKeyTransRecipientInfoGenerator(recipientCert).setProvider("BC")); MimeBodyPart mp = fact.generate(content, new JceCMSContentEncryptorBuilder(CMSAlgorithm.AES256_GCM).setProvider("BC").build());Note: Most clients expect the MimeBodyPart to be in a MimeMultipart when it's sent.
SMIMEEnvelopedGenerator.WrappingIOException
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
AES128_GCM |
static java.lang.String |
AES192_GCM |
static java.lang.String |
AES256_GCM |
AES128_CBC, AES128_WRAP, AES192_CBC, AES256_CBC, AES256_WRAP, CAMELLIA128_CBC, CAMELLIA128_WRAP, CAMELLIA192_CBC, CAMELLIA192_WRAP, CAMELLIA256_CBC, CAMELLIA256_WRAP, CAST5_CBC, DES_EDE3_CBC, DES_EDE3_WRAP, ECDH_SHA1KDF, IDEA_CBC, RC2_CBC, SEED_CBC, SEED_WRAP
encoding, useBase64
Constructor and Description |
---|
SMIMEAuthEnvelopedGenerator()
base constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addRecipientInfoGenerator(org.bouncycastle.cms.RecipientInfoGenerator recipientInfoGen)
add a recipientInfoGenerator.
|
protected SMIMEStreamingProcessor |
getContentEncryptor(javax.mail.internet.MimeBodyPart content,
org.bouncycastle.operator.OutputEncryptor encryptor)
return content encryptor.
|
protected java.lang.String |
getEncryptedContentType()
return encrypted content type for enveloped data.
|
void |
setBerEncodeRecipients(boolean berEncodeRecipientSet)
Use a BER Set to store the recipient information
|
generate, generate
makeContentBodyPart, makeContentBodyPart, setContentTransferEncoding
public static final java.lang.String AES128_GCM
public static final java.lang.String AES192_GCM
public static final java.lang.String AES256_GCM
public SMIMEAuthEnvelopedGenerator()
public void addRecipientInfoGenerator(org.bouncycastle.cms.RecipientInfoGenerator recipientInfoGen) throws java.lang.IllegalArgumentException
addRecipientInfoGenerator
in class SMIMEEnvelopedGenerator
java.lang.IllegalArgumentException
public void setBerEncodeRecipients(boolean berEncodeRecipientSet)
setBerEncodeRecipients
in class SMIMEEnvelopedGenerator
protected java.lang.String getEncryptedContentType()
getEncryptedContentType
in class SMIMEEnvelopedGenerator
protected SMIMEStreamingProcessor getContentEncryptor(javax.mail.internet.MimeBodyPart content, org.bouncycastle.operator.OutputEncryptor encryptor) throws SMIMEException
getContentEncryptor
in class SMIMEEnvelopedGenerator
SMIMEException