public class CMSEnvelopedGenerator
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
AES128_CBC |
static java.lang.String |
AES128_WRAP |
static java.lang.String |
AES192_CBC |
static java.lang.String |
AES192_WRAP |
static java.lang.String |
AES256_CBC |
static java.lang.String |
AES256_WRAP |
static java.lang.String |
CAMELLIA128_CBC |
static java.lang.String |
CAMELLIA128_WRAP |
static java.lang.String |
CAMELLIA192_CBC |
static java.lang.String |
CAMELLIA192_WRAP |
static java.lang.String |
CAMELLIA256_CBC |
static java.lang.String |
CAMELLIA256_WRAP |
static java.lang.String |
CAST5_CBC |
static java.lang.String |
DES_EDE3_CBC |
static java.lang.String |
DES_EDE3_WRAP |
static java.lang.String |
ECDH_SHA1KDF |
static java.lang.String |
ECMQV_SHA1KDF |
static java.lang.String |
IDEA_CBC |
protected org.bouncycastle.asn1.cms.OriginatorInfo |
originatorInfo |
static java.lang.String |
RC2_CBC |
static java.lang.String |
SEED_CBC |
static java.lang.String |
SEED_WRAP |
protected CMSAttributeTableGenerator |
unprotectedAttributeGenerator |
| Constructor and Description |
|---|
CMSEnvelopedGenerator()
base constructor
|
CMSEnvelopedGenerator(java.security.SecureRandom rand)
constructor allowing specific source of randomness
|
| Modifier and Type | Method and Description |
|---|---|
void |
addKEKRecipient(javax.crypto.SecretKey key,
byte[] keyIdentifier)
Deprecated.
use the addRecipientGenerator and JceKEKRecipientInfoGenerator
|
void |
addKEKRecipient(javax.crypto.SecretKey key,
org.bouncycastle.asn1.cms.KEKIdentifier kekIdentifier)
Deprecated.
use the addRecipientGenerator and JceKEKRecipientInfoGenerator
|
void |
addKeyAgreementRecipient(java.lang.String agreementAlgorithm,
java.security.PrivateKey senderPrivateKey,
java.security.PublicKey senderPublicKey,
java.security.cert.X509Certificate recipientCert,
java.lang.String cekWrapAlgorithm,
java.security.Provider provider)
Deprecated.
use the addRecipientGenerator and JceKeyAgreeRecipientInfoGenerator
|
void |
addKeyAgreementRecipient(java.lang.String agreementAlgorithm,
java.security.PrivateKey senderPrivateKey,
java.security.PublicKey senderPublicKey,
java.security.cert.X509Certificate recipientCert,
java.lang.String cekWrapAlgorithm,
java.lang.String provider)
Deprecated.
use the addRecipientGenerator and JceKeyAgreeRecipientInfoGenerator
|
void |
addKeyAgreementRecipients(java.lang.String agreementAlgorithm,
java.security.PrivateKey senderPrivateKey,
java.security.PublicKey senderPublicKey,
java.util.Collection recipientCerts,
java.lang.String cekWrapAlgorithm,
java.security.Provider provider)
Deprecated.
use the addRecipientGenerator and JceKeyAgreeRecipientInfoGenerator
|
void |
addKeyAgreementRecipients(java.lang.String agreementAlgorithm,
java.security.PrivateKey senderPrivateKey,
java.security.PublicKey senderPublicKey,
java.util.Collection recipientCerts,
java.lang.String cekWrapAlgorithm,
java.lang.String provider)
Deprecated.
use the addRecipientGenerator and JceKeyAgreeRecipientInfoGenerator
|
void |
addKeyTransRecipient(java.security.PublicKey key,
byte[] subKeyId)
Deprecated.
use the addRecipientGenerator and JceKeyTransRecipientInfoGenerator
|
void |
addKeyTransRecipient(java.security.cert.X509Certificate cert)
Deprecated.
use the addRecipientGenerator and JceKeyTransRecipientInfoGenerator
|
void |
addPasswordRecipient(CMSPBEKey pbeKey,
java.lang.String kekAlgorithmOid)
Deprecated.
use addRecipientGenerator and JcePasswordRecipientInfoGenerator
|
void |
addRecipientInfoGenerator(RecipientInfoGenerator recipientGenerator)
Add a generator to produce the recipient info required.
|
protected void |
convertOldRecipients(java.security.SecureRandom rand,
java.security.Provider provider) |
protected org.bouncycastle.asn1.x509.AlgorithmIdentifier |
getAlgorithmIdentifier(java.lang.String encryptionOID,
java.security.AlgorithmParameters params) |
void |
setOriginatorInfo(OriginatorInformation originatorInfo) |
void |
setUnprotectedAttributeGenerator(CMSAttributeTableGenerator unprotectedAttributeGenerator) |
public static final java.lang.String DES_EDE3_CBC
public static final java.lang.String RC2_CBC
public static final java.lang.String IDEA_CBC
public static final java.lang.String CAST5_CBC
public static final java.lang.String AES128_CBC
public static final java.lang.String AES192_CBC
public static final java.lang.String AES256_CBC
public static final java.lang.String CAMELLIA128_CBC
public static final java.lang.String CAMELLIA192_CBC
public static final java.lang.String CAMELLIA256_CBC
public static final java.lang.String SEED_CBC
public static final java.lang.String DES_EDE3_WRAP
public static final java.lang.String AES128_WRAP
public static final java.lang.String AES192_WRAP
public static final java.lang.String AES256_WRAP
public static final java.lang.String CAMELLIA128_WRAP
public static final java.lang.String CAMELLIA192_WRAP
public static final java.lang.String CAMELLIA256_WRAP
public static final java.lang.String SEED_WRAP
public static final java.lang.String ECDH_SHA1KDF
public static final java.lang.String ECMQV_SHA1KDF
protected CMSAttributeTableGenerator unprotectedAttributeGenerator
protected org.bouncycastle.asn1.cms.OriginatorInfo originatorInfo
public CMSEnvelopedGenerator()
public CMSEnvelopedGenerator(java.security.SecureRandom rand)
rand - instance of SecureRandom to usepublic void setUnprotectedAttributeGenerator(CMSAttributeTableGenerator unprotectedAttributeGenerator)
public void setOriginatorInfo(OriginatorInformation originatorInfo)
public void addKeyTransRecipient(java.security.cert.X509Certificate cert)
throws java.lang.IllegalArgumentException
cert - recipient's public key certificatejava.lang.IllegalArgumentException - if there is a problem with the certificatepublic void addKeyTransRecipient(java.security.PublicKey key,
byte[] subKeyId)
throws java.lang.IllegalArgumentException
key - the public key used by the recipientsubKeyId - the identifier for the recipient's public keyjava.lang.IllegalArgumentException - if there is a problem with the keypublic void addKEKRecipient(javax.crypto.SecretKey key,
byte[] keyIdentifier)
key - the secret key to use for wrappingkeyIdentifier - the byte string that identifies the keypublic void addKEKRecipient(javax.crypto.SecretKey key,
org.bouncycastle.asn1.cms.KEKIdentifier kekIdentifier)
key - the secret key to use for wrappingkekIdentifier - a KEKIdentifier structure (identifies the key)public void addPasswordRecipient(CMSPBEKey pbeKey, java.lang.String kekAlgorithmOid)
pbeKey - PBE keykekAlgorithmOid - key encryption algorithm to use.public void addKeyAgreementRecipient(java.lang.String agreementAlgorithm,
java.security.PrivateKey senderPrivateKey,
java.security.PublicKey senderPublicKey,
java.security.cert.X509Certificate recipientCert,
java.lang.String cekWrapAlgorithm,
java.lang.String provider)
throws java.security.NoSuchProviderException,
java.security.NoSuchAlgorithmException,
java.security.InvalidKeyException
agreementAlgorithm - key agreement algorithm to use.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.java.security.NoSuchProviderException - if the specified provider cannot be foundjava.security.NoSuchAlgorithmException - if the algorithm requested cannot be foundjava.security.InvalidKeyException - if the keys are inappropriate for the algorithm specifiedpublic void addKeyAgreementRecipient(java.lang.String agreementAlgorithm,
java.security.PrivateKey senderPrivateKey,
java.security.PublicKey senderPublicKey,
java.security.cert.X509Certificate recipientCert,
java.lang.String cekWrapAlgorithm,
java.security.Provider provider)
throws java.security.NoSuchAlgorithmException,
java.security.InvalidKeyException
agreementAlgorithm - key agreement algorithm to use.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.java.security.NoSuchAlgorithmException - if the algorithm requested cannot be foundjava.security.InvalidKeyException - if the keys are inappropriate for the algorithm specifiedpublic void addKeyAgreementRecipients(java.lang.String agreementAlgorithm,
java.security.PrivateKey senderPrivateKey,
java.security.PublicKey senderPublicKey,
java.util.Collection recipientCerts,
java.lang.String cekWrapAlgorithm,
java.lang.String provider)
throws java.security.NoSuchProviderException,
java.security.NoSuchAlgorithmException,
java.security.InvalidKeyException
agreementAlgorithm - key agreement algorithm to use.senderPrivateKey - private key to initialise sender side of agreement with.senderPublicKey - sender public key to include with message.recipientCerts - recipients' public key certificates.cekWrapAlgorithm - OID for key wrapping algorithm to use.provider - provider to use for the agreement calculation.java.security.NoSuchAlgorithmException - if the algorithm requested cannot be foundjava.security.InvalidKeyException - if the keys are inappropriate for the algorithm specifiedjava.security.NoSuchProviderExceptionpublic void addKeyAgreementRecipients(java.lang.String agreementAlgorithm,
java.security.PrivateKey senderPrivateKey,
java.security.PublicKey senderPublicKey,
java.util.Collection recipientCerts,
java.lang.String cekWrapAlgorithm,
java.security.Provider provider)
throws java.security.NoSuchAlgorithmException,
java.security.InvalidKeyException
agreementAlgorithm - key agreement algorithm to use.senderPrivateKey - private key to initialise sender side of agreement with.senderPublicKey - sender public key to include with message.recipientCerts - recipients' public key certificates.cekWrapAlgorithm - OID for key wrapping algorithm to use.provider - provider to use for the agreement calculation.java.security.NoSuchAlgorithmException - if the algorithm requested cannot be foundjava.security.InvalidKeyException - if the keys are inappropriate for the algorithm specifiedpublic void addRecipientInfoGenerator(RecipientInfoGenerator recipientGenerator)
recipientGenerator - a generator of a recipient info object.protected org.bouncycastle.asn1.x509.AlgorithmIdentifier getAlgorithmIdentifier(java.lang.String encryptionOID,
java.security.AlgorithmParameters params)
throws java.io.IOException
java.io.IOExceptionprotected void convertOldRecipients(java.security.SecureRandom rand,
java.security.Provider provider)