Overview | Package | Class | Tree | Deprecated | Index | Help
| Bouncy Castle Cryptography 1.19
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## 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.addKeyTransRecipient(cert);

          MimeBodyPart           smime = fact.generate(content, algorithm, "BC");

Note: Most clients expect the MimeBodyPart to be in a MimeMultipart when it's sent.

Field Summary
`static java.lang.String` | `AES128_CBC`
`static java.lang.String` | `AES192_CBC`
`static java.lang.String` | `AES256_CBC`
`static java.lang.String` | `CAST5_CBC`
`static java.lang.String` | `DES_EDE3_CBC`
`static java.lang.String` | `IDEA_CBC`
`static java.lang.String` | `RC2_CBC`

Fields inherited from class org.bouncycastle.mail.smime.SMIMEGenerator
`encoding, useBase64`

Constructor Summary
`SMIMEEnvelopedGenerator()` base constructor

Method Summary
`void` | `addKeyTransRecipient(java.security.PublicKey key, byte[] subKeyId)` add a recipient - note: this will only work on V3 and later clients.
`void` | `addKeyTransRecipient(java.security.cert.X509Certificate cert)` add a recipient.
`javax.mail.internet.MimeBodyPart` | `generate(javax.mail.internet.MimeBodyPart content, java.lang.String encryptionOID, int keySize, java.lang.String provider)` generate an enveloped object that contains an SMIME Enveloped object using the given provider.
`javax.mail.internet.MimeBodyPart` | `generate(javax.mail.internet.MimeBodyPart content, java.lang.String encryptionOID, java.lang.String provider)` generate an enveloped object that contains an SMIME Enveloped object using the given provider.
`javax.mail.internet.MimeBodyPart` | `generate(javax.mail.internet.MimeMessage message, java.lang.String encryptionOID, int keySize, java.lang.String provider)` generate an enveloped object that contains an SMIME Enveloped object using the given provider from the contents of the passed in message.
`javax.mail.internet.MimeBodyPart` | `generate(javax.mail.internet.MimeMessage message, java.lang.String encryptionOID, java.lang.String provider)` generate an enveloped object that contains an SMIME Enveloped object using the given provider from the contents of the passed in message

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

### DES_EDE3_CBC

    public static final java.lang.String DES_EDE3_CBC

See Also:
  Constant Field Values

### RC2_CBC

    public static final java.lang.String RC2_CBC

See Also:
  Constant Field Values

### 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

See Also:
  Constant Field Values

### AES192_CBC

    public static final java.lang.String AES192_CBC

See Also:
  Constant Field Values

### AES256_CBC

    public static final java.lang.String AES256_CBC

See Also:
  Constant Field Values

Constructor Detail

### SMIMEEnvelopedGenerator

    public SMIMEEnvelopedGenerator()

  base constructor

Method Detail

### addKeyTransRecipient

    public void addKeyTransRecipient(java.security.cert.X509Certificate cert)
                              throws java.lang.IllegalArgumentException

  add a recipient.

    `java.lang.IllegalArgumentException`

### addKeyTransRecipient

    public void addKeyTransRecipient(java.security.PublicKey key,
                                     byte[] subKeyId)
                              throws java.lang.IllegalArgumentException

  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
    `java.lang.IllegalArgumentException`

### generate

    public javax.mail.internet.MimeBodyPart generate(javax.mail.internet.MimeBodyPart content,
                                                     java.lang.String encryptionOID,
                                                     java.lang.String provider)
                                              throws java.security.NoSuchAlgorithmException,
                                                     java.security.NoSuchProviderException,
                                                     SMIMEException

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

    `java.security.NoSuchAlgorithmException`
    `java.security.NoSuchProviderException`
    `SMIMEException`

### generate

    public javax.mail.internet.MimeBodyPart generate(javax.mail.internet.MimeMessage message,
                                                     java.lang.String encryptionOID,
                                                     java.lang.String provider)
                                              throws java.security.NoSuchAlgorithmException,
                                                     java.security.NoSuchProviderException,
                                                     SMIMEException

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

    `java.security.NoSuchAlgorithmException`
    `java.security.NoSuchProviderException`
    `SMIMEException`

### generate

    public javax.mail.internet.MimeBodyPart generate(javax.mail.internet.MimeBodyPart content,
                                                     java.lang.String encryptionOID,
                                                     int keySize,
                                                     java.lang.String provider)
                                              throws java.security.NoSuchAlgorithmException,
                                                     java.security.NoSuchProviderException,
                                                     SMIMEException

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

    `java.security.NoSuchAlgorithmException`
    `java.security.NoSuchProviderException`
    `SMIMEException`

### generate

    public javax.mail.internet.MimeBodyPart generate(javax.mail.internet.MimeMessage message,
                                                     java.lang.String encryptionOID,
                                                     int keySize,
                                                     java.lang.String provider)
                                              throws java.security.NoSuchAlgorithmException,
                                                     java.security.NoSuchProviderException,
                                                     SMIMEException

  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.

    `java.security.NoSuchAlgorithmException`
    `java.security.NoSuchProviderException`
    `SMIMEException`

Overview | Package | Class | Tree | Deprecated | Index | Help
| Bouncy Castle Cryptography 1.19
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD