org.bouncycastle.mail.smime
public class SMIMEEnvelopedGenerator extends SMIMEGenerator
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 String | AES128_CBC |
static String | AES128_WRAP |
static String | AES192_CBC |
static String | AES256_CBC |
static String | AES256_WRAP |
static String | CAMELLIA128_CBC |
static String | CAMELLIA128_WRAP |
static String | CAMELLIA192_CBC |
static String | CAMELLIA192_WRAP |
static String | CAMELLIA256_CBC |
static String | CAMELLIA256_WRAP |
static String | CAST5_CBC |
static String | DES_EDE3_CBC |
static String | DES_EDE3_WRAP |
static String | ECDH_SHA1KDF |
static String | IDEA_CBC |
static String | RC2_CBC |
static String | SEED_CBC |
static String | SEED_WRAP |
Constructor Summary | |
---|---|
SMIMEEnvelopedGenerator()
base constructor |
Method Summary | |
---|---|
void | addKeyAgreementRecipient(String agreementAlgorithm, PrivateKey senderPrivateKey, PublicKey senderPublicKey, X509Certificate recipientCert, String cekWrapAlgorithm, String provider)
Add a key agreement based recipient.
|
void | addKeyTransRecipient(X509Certificate cert)
add a recipient. |
void | addKeyTransRecipient(PublicKey key, byte[] subKeyId)
add a recipient - note: this will only work on V3 and later clients.
|
void | addKEKRecipient(SecretKey key, byte[] keyIdentifier)
add a KEK recipient. |
MimeBodyPart | generate(MimeBodyPart content, String encryptionOID, String provider)
generate an enveloped object that contains an SMIME Enveloped
object using the given provider. |
MimeBodyPart | generate(MimeMessage message, String encryptionOID, String provider)
generate an enveloped object that contains an SMIME Enveloped
object using the given provider from the contents of the passed in
message |
MimeBodyPart | generate(MimeBodyPart content, String encryptionOID, int keySize, String provider)
generate an enveloped object that contains an SMIME Enveloped
object using the given provider. |
MimeBodyPart | generate(MimeMessage message, String encryptionOID, int keySize, String provider)
generate an enveloped object that contains an SMIME Enveloped
object using the given provider from the contents of the passed in
message. |
void | setBerEncodeRecipients(boolean berEncodeRecipientSet)
Use a BER Set to store the recipient information |
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.
Parameters: key the recipient's public key subKeyId the subject key id for the recipient's public key