public class

SMIMEEnvelopedGenerator

extends SMIMEGenerator
java.lang.Object
   ↳ org.bouncycastle.mail.smime.SMIMEGenerator
     ↳ org.bouncycastle.mail.smime.SMIMEEnvelopedGenerator

Class Overview

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.

Summary

Constants
String CAST5_CBC
String IDEA_CBC
Fields
public static final String AES128_CBC
public static final String AES128_WRAP
public static final String AES192_CBC
public static final String AES256_CBC
public static final String AES256_WRAP
public static final String CAMELLIA128_CBC
public static final String CAMELLIA128_WRAP
public static final String CAMELLIA192_CBC
public static final String CAMELLIA192_WRAP
public static final String CAMELLIA256_CBC
public static final String CAMELLIA256_WRAP
public static final String DES_EDE3_CBC
public static final String DES_EDE3_WRAP
public static final String ECDH_SHA1KDF
public static final String RC2_CBC
public static final String SEED_CBC
public static final String SEED_WRAP
[Expand]
Inherited Fields
From class org.bouncycastle.mail.smime.SMIMEGenerator
Public Constructors
SMIMEEnvelopedGenerator()
base constructor
Public Methods
void addKEKRecipient(SecretKey key, byte[] keyIdentifier)
This method is deprecated. use addRecipientInfoGenerator()
void addKeyAgreementRecipient(String agreementAlgorithm, PrivateKey senderPrivateKey, PublicKey senderPublicKey, X509Certificate recipientCert, String cekWrapAlgorithm, String provider)
This method is deprecated. use addRecipientInfoGenerator()
void addKeyAgreementRecipient(String agreementAlgorithm, PrivateKey senderPrivateKey, PublicKey senderPublicKey, X509Certificate recipientCert, String cekWrapAlgorithm, Provider provider)
This method is deprecated. use addRecipientInfoGenerator()
void addKeyTransRecipient(PublicKey key, byte[] subKeyId)
This method is deprecated. use addRecipientInfoGenerator()
void addKeyTransRecipient(X509Certificate cert)
This method is deprecated. use addRecipientInfoGenerator()
void addRecipientInfoGenerator(RecipientInfoGenerator recipientInfoGen)
add a recipientInfoGenerator.
MimeBodyPart generate(MimeMessage message, String encryptionOID, Provider provider)
This method is deprecated. No replacement.
MimeBodyPart generate(MimeBodyPart content, String encryptionOID, int keySize, String provider)
This method is deprecated. No replacement.
MimeBodyPart generate(MimeBodyPart content, OutputEncryptor encryptor)
generate an enveloped object that contains an SMIME Enveloped object using the given content encryptor
MimeBodyPart generate(MimeBodyPart content, String encryptionOID, String provider)
This method is deprecated. No replacement.
MimeBodyPart generate(MimeBodyPart content, String encryptionOID, Provider provider)
This method is deprecated. No replacement.
MimeBodyPart generate(MimeMessage message, String encryptionOID, int keySize, String provider)
This method is deprecated. No replacement.
MimeBodyPart generate(MimeMessage message, String encryptionOID, String provider)
This method is deprecated. No replacement.
MimeBodyPart generate(MimeMessage message, OutputEncryptor encryptor)
generate an enveloped object that contains an SMIME Enveloped object using the given provider from the contents of the passed in message
MimeBodyPart generate(MimeMessage message, String encryptionOID, int keySize, Provider provider)
This method is deprecated. No replacement.
MimeBodyPart generate(MimeBodyPart content, String encryptionOID, int keySize, Provider provider)
This method is deprecated. No replacement.
void setBerEncodeRecipients(boolean berEncodeRecipientSet)
Use a BER Set to store the recipient information
[Expand]
Inherited Methods
From class org.bouncycastle.mail.smime.SMIMEGenerator
From class java.lang.Object

Constants

public static final String CAST5_CBC

Constant Value: "1.2.840.113533.7.66.10"

public static final String IDEA_CBC

Constant Value: "1.3.6.1.4.1.188.7.1.1.2"

Fields

public static final String AES128_CBC

public static final String AES128_WRAP

public static final String AES192_CBC

public static final String AES256_CBC

public static final String AES256_WRAP

public static final String CAMELLIA128_CBC

public static final String CAMELLIA128_WRAP

public static final String CAMELLIA192_CBC

public static final String CAMELLIA192_WRAP

public static final String CAMELLIA256_CBC

public static final String CAMELLIA256_WRAP

public static final String DES_EDE3_CBC

public static final String DES_EDE3_WRAP

public static final String ECDH_SHA1KDF

public static final String RC2_CBC

public static final String SEED_CBC

public static final String SEED_WRAP

Public Constructors

public SMIMEEnvelopedGenerator ()

base constructor

Public Methods

public void addKEKRecipient (SecretKey key, byte[] keyIdentifier)

This method is deprecated.
use addRecipientInfoGenerator()

add a KEK recipient.

public void addKeyAgreementRecipient (String agreementAlgorithm, PrivateKey senderPrivateKey, PublicKey senderPublicKey, X509Certificate recipientCert, String cekWrapAlgorithm, String provider)

This method is deprecated.
use addRecipientInfoGenerator()

Add a key agreement based recipient.

Parameters
senderPrivateKey private key to initialise sender side of agreement with.
senderPublicKey sender public key to include with message.
recipientCert recipient's public key certificate.
cekWrapAlgorithm OID for key wrapping algorithm to use.
provider provider to use for the agreement calculation.

public void addKeyAgreementRecipient (String agreementAlgorithm, PrivateKey senderPrivateKey, PublicKey senderPublicKey, X509Certificate recipientCert, String cekWrapAlgorithm, Provider provider)

This method is deprecated.
use addRecipientInfoGenerator()

Add a key agreement based recipient.

Parameters
senderPrivateKey private key to initialise sender side of agreement with.
senderPublicKey sender public key to include with message.
recipientCert recipient's public key certificate.
cekWrapAlgorithm OID for key wrapping algorithm to use.
provider provider to use for the agreement calculation.

public void addKeyTransRecipient (PublicKey key, byte[] subKeyId)

This method is deprecated.
use addRecipientInfoGenerator()

add a recipient - note: this will only work on V3 and later clients.

Parameters
key the recipient's public key
subKeyId the subject key id for the recipient's public key

public void addKeyTransRecipient (X509Certificate cert)

This method is deprecated.
use addRecipientInfoGenerator()

add a recipient.

public void addRecipientInfoGenerator (RecipientInfoGenerator recipientInfoGen)

add a recipientInfoGenerator.

public MimeBodyPart generate (MimeMessage message, String encryptionOID, Provider provider)

This method is deprecated.
No replacement.

generate an enveloped object that contains an SMIME Enveloped object using the given provider from the contents of the passed in message

public MimeBodyPart generate (MimeBodyPart content, String encryptionOID, int keySize, String provider)

This method is deprecated.
No replacement.

generate an enveloped object that contains an SMIME Enveloped object using the given provider. The size of the encryption key is determined by keysize.

public MimeBodyPart generate (MimeBodyPart content, OutputEncryptor encryptor)

generate an enveloped object that contains an SMIME Enveloped object using the given content encryptor

public MimeBodyPart generate (MimeBodyPart content, String encryptionOID, String provider)

This method is deprecated.
No replacement.

generate an enveloped object that contains an SMIME Enveloped object using the given provider.

public MimeBodyPart generate (MimeBodyPart content, String encryptionOID, Provider provider)

This method is deprecated.
No replacement.

generate an enveloped object that contains an SMIME Enveloped object using the given provider.

public MimeBodyPart generate (MimeMessage message, String encryptionOID, int keySize, String provider)

This method is deprecated.
No replacement.

generate an enveloped object that contains an SMIME Enveloped object using the given provider from the contents of the passed in message. The size of the encryption key used to protect the message is determined by keysize.

public MimeBodyPart generate (MimeMessage message, String encryptionOID, String provider)

This method is deprecated.
No replacement.

generate an enveloped object that contains an SMIME Enveloped object using the given provider from the contents of the passed in message

public MimeBodyPart generate (MimeMessage message, OutputEncryptor encryptor)

generate an enveloped object that contains an SMIME Enveloped object using the given provider from the contents of the passed in message

public MimeBodyPart generate (MimeMessage message, String encryptionOID, int keySize, Provider provider)

This method is deprecated.
No replacement.

generate an enveloped object that contains an SMIME Enveloped object using the given provider from the contents of the passed in message. The size of the encryption key used to protect the message is determined by keysize.

public MimeBodyPart generate (MimeBodyPart content, String encryptionOID, int keySize, Provider provider)

This method is deprecated.
No replacement.

generate an enveloped object that contains an SMIME Enveloped object using the given provider. The size of the encryption key is determined by keysize.

public void setBerEncodeRecipients (boolean berEncodeRecipientSet)

Use a BER Set to store the recipient information