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.
| Modifier and Type | Class and Description |
|---|---|
| private static class | |
| private class |
| Modifier and Type | Field and Description |
|---|---|
| public static final String | |
| public static final String | |
| public static final String | |
| pack-priv static final String | |
| private final SMIMEAuthEnvelopedGenerator. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | addRecipientInfoGenerator(RecipientInfoGenerator recipientInfoGen)
Overrides org. add a recipientInfoGenerator. |
| protected SMIMEStreamingProcessor | getContentEncryptor(MimeBodyPart content, OutputEncryptor encryptor)
Overrides org. return content encryptor. |
| protected String | getEncryptedContentType()
Overrides org. return encrypted content type for enveloped data. |
| public void | setBerEncodeRecipients(boolean berEncodeRecipientSet)
Overrides org. Use a BER Set to store the recipient information |
| AES128_GCM | back to summary |
|---|---|
| public static final String AES128_GCM | |
| AES192_GCM | back to summary |
|---|---|
| public static final String AES192_GCM | |
| AES256_GCM | back to summary |
|---|---|
| public static final String AES256_GCM | |
| AUTH_ENVELOPED_DATA_CONTENT_TYPE | back to summary |
|---|---|
| pack-priv static final String AUTH_ENVELOPED_DATA_CONTENT_TYPE | |
| authFact | back to summary |
|---|---|
| private final SMIMEAuthEnvelopedGenerator. | |
| SMIMEAuthEnvelopedGenerator | back to summary |
|---|---|
| public SMIMEAuthEnvelopedGenerator() base constructor | |
| addRecipientInfoGenerator | back to summary |
|---|---|
| public void addRecipientInfoGenerator(RecipientInfoGenerator recipientInfoGen) throws IllegalArgumentException Overrides org. add a recipientInfoGenerator. | |
| getContentEncryptor | back to summary |
|---|---|
| protected SMIMEStreamingProcessor getContentEncryptor(MimeBodyPart content, OutputEncryptor encryptor) throws SMIMEException Overrides org. return content encryptor. | |
| getEncryptedContentType | back to summary |
|---|---|
| protected String getEncryptedContentType() Overrides org. return encrypted content type for enveloped data. | |
| setBerEncodeRecipients | back to summary |
|---|---|
| public void setBerEncodeRecipients(boolean berEncodeRecipientSet) Overrides org. Use a BER Set to store the recipient information | |
| Modifier and Type | Field and Description |
|---|---|
| private ASN1ObjectIdentifier | |
| private ASN1EncodableVector |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| protected OutputStream | open(ASN1ObjectIdentifier dataType, OutputStream out, ASN1EncodableVector recipientInfos, OutputAEADEncryptor encryptor)
Overrides org.
|
| pack-priv OutputStream |
| dataType | back to summary |
|---|---|
| private ASN1ObjectIdentifier dataType | |
| recipientInfos | back to summary |
|---|---|
| private ASN1EncodableVector recipientInfos | |
| AuthEnvelopedGenerator | back to summary |
|---|---|
| private AuthEnvelopedGenerator() | |
| open | back to summary |
|---|---|
| protected OutputStream open(ASN1ObjectIdentifier dataType, OutputStream out, ASN1EncodableVector recipientInfos, OutputAEADEncryptor encryptor) throws IOException Overrides org. | |
| regenerate | back to summary |
|---|---|
| pack-priv OutputStream regenerate(OutputStream out, OutputAEADEncryptor encryptor) throws IOException | |
| Modifier and Type | Field and Description |
|---|---|
| private final MimeBodyPart | |
| private OutputAEADEncryptor | |
| private boolean |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public void |
| _content | back to summary |
|---|---|
| private final MimeBodyPart _content | |
| _encryptor | back to summary |
|---|---|
| private OutputAEADEncryptor _encryptor | |
| _firstTime | back to summary |
|---|---|
| private boolean _firstTime | |
| ContentEncryptor | back to summary |
|---|---|
| pack-priv ContentEncryptor(MimeBodyPart content, OutputAEADEncryptor encryptor) | |
| write | back to summary |
|---|---|
| public void write(OutputStream out) throws IOException Implements org. | |