public class CMSEnvelopedGenerator extends Object
Modifier and Type | Field and Description |
---|---|
static String |
AES128_CBC |
static String |
AES128_WRAP |
static String |
AES192_CBC |
static String |
AES192_WRAP |
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 |
ECMQV_SHA1KDF |
static String |
IDEA_CBC |
static String |
RC2_CBC |
static String |
SEED_CBC |
static String |
SEED_WRAP |
protected CMSAttributeTableGenerator |
unprotectedAttributeGenerator |
Constructor and Description |
---|
CMSEnvelopedGenerator()
base constructor
|
CMSEnvelopedGenerator(SecureRandom rand)
constructor allowing specific source of randomness
|
Modifier and Type | Method and Description |
---|---|
void |
addKEKRecipient(SecretKey key,
byte[] keyIdentifier)
Deprecated.
use the addRecipientGenerator and JceKEKRecipientInfoGenerator
|
void |
addKEKRecipient(SecretKey key,
KEKIdentifier kekIdentifier)
Deprecated.
use the addRecipientGenerator and JceKEKRecipientInfoGenerator
|
void |
addKeyAgreementRecipient(String agreementAlgorithm,
PrivateKey senderPrivateKey,
PublicKey senderPublicKey,
X509Certificate recipientCert,
String cekWrapAlgorithm,
Provider provider)
Deprecated.
use the addRecipientGenerator and JceKeyAgreeRecipientInfoGenerator
|
void |
addKeyAgreementRecipient(String agreementAlgorithm,
PrivateKey senderPrivateKey,
PublicKey senderPublicKey,
X509Certificate recipientCert,
String cekWrapAlgorithm,
String provider)
Deprecated.
use the addRecipientGenerator and JceKeyAgreeRecipientInfoGenerator
|
void |
addKeyAgreementRecipients(String agreementAlgorithm,
PrivateKey senderPrivateKey,
PublicKey senderPublicKey,
Collection recipientCerts,
String cekWrapAlgorithm,
Provider provider)
Deprecated.
use the addRecipientGenerator and JceKeyAgreeRecipientInfoGenerator
|
void |
addKeyAgreementRecipients(String agreementAlgorithm,
PrivateKey senderPrivateKey,
PublicKey senderPublicKey,
Collection recipientCerts,
String cekWrapAlgorithm,
String provider)
Deprecated.
use the addRecipientGenerator and JceKeyAgreeRecipientInfoGenerator
|
void |
addKeyTransRecipient(PublicKey key,
byte[] subKeyId)
Deprecated.
use the addRecipientGenerator and JceKeyTransRecipientInfoGenerator
|
void |
addKeyTransRecipient(X509Certificate cert)
Deprecated.
use the addRecipientGenerator and JceKeyTransRecipientInfoGenerator
|
void |
addPasswordRecipient(CMSPBEKey pbeKey,
String kekAlgorithmOid)
Deprecated.
use addRecipientGenerator and JcePasswordRecipientInfoGenerator
|
void |
addRecipientInfoGenerator(RecipientInfoGenerator recipientGenerator)
Add a generator to produce the recipient info required.
|
protected AlgorithmParameters |
generateParameters(String encryptionOID,
SecretKey encKey,
Provider encProvider) |
protected AlgorithmIdentifier |
getAlgorithmIdentifier(String encryptionOID,
AlgorithmParameters params) |
void |
setUnprotectedAttributeGenerator(CMSAttributeTableGenerator unprotectedAttributeGenerator) |
public static final String DES_EDE3_CBC
public static final String RC2_CBC
public static final String IDEA_CBC
public static final String CAST5_CBC
public static final String AES128_CBC
public static final String AES192_CBC
public static final String AES256_CBC
public static final String CAMELLIA128_CBC
public static final String CAMELLIA192_CBC
public static final String CAMELLIA256_CBC
public static final String SEED_CBC
public static final String DES_EDE3_WRAP
public static final String AES128_WRAP
public static final String AES192_WRAP
public static final String AES256_WRAP
public static final String CAMELLIA128_WRAP
public static final String CAMELLIA192_WRAP
public static final String CAMELLIA256_WRAP
public static final String SEED_WRAP
public static final String ECDH_SHA1KDF
public static final String ECMQV_SHA1KDF
protected CMSAttributeTableGenerator unprotectedAttributeGenerator
public CMSEnvelopedGenerator()
public CMSEnvelopedGenerator(SecureRandom rand)
rand
- instance of SecureRandom to usepublic void setUnprotectedAttributeGenerator(CMSAttributeTableGenerator unprotectedAttributeGenerator)
public void addKeyTransRecipient(X509Certificate cert) throws IllegalArgumentException
cert
- recipient's public key certificateIllegalArgumentException
- if there is a problem with the certificatepublic void addKeyTransRecipient(PublicKey key, byte[] subKeyId) throws IllegalArgumentException
key
- the public key used by the recipientsubKeyId
- the identifier for the recipient's public keyIllegalArgumentException
- if there is a problem with the keypublic void addKEKRecipient(SecretKey key, byte[] keyIdentifier)
key
- the secret key to use for wrappingkeyIdentifier
- the byte string that identifies the keypublic void addKEKRecipient(SecretKey key, KEKIdentifier kekIdentifier)
key
- the secret key to use for wrappingkekIdentifier
- a KEKIdentifier structure (identifies the key)public void addPasswordRecipient(CMSPBEKey pbeKey, String kekAlgorithmOid)
pbeKey
- PBE keykekAlgorithmOid
- key encryption algorithm to use.public void addKeyAgreementRecipient(String agreementAlgorithm, PrivateKey senderPrivateKey, PublicKey senderPublicKey, X509Certificate recipientCert, String cekWrapAlgorithm, String provider) throws NoSuchProviderException, NoSuchAlgorithmException, 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.NoSuchProviderException
- if the specified provider cannot be foundNoSuchAlgorithmException
- if the algorithm requested cannot be foundInvalidKeyException
- if the keys are inappropriate for the algorithm specifiedpublic void addKeyAgreementRecipient(String agreementAlgorithm, PrivateKey senderPrivateKey, PublicKey senderPublicKey, X509Certificate recipientCert, String cekWrapAlgorithm, Provider provider) throws NoSuchAlgorithmException, 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.NoSuchAlgorithmException
- if the algorithm requested cannot be foundInvalidKeyException
- if the keys are inappropriate for the algorithm specifiedpublic void addKeyAgreementRecipients(String agreementAlgorithm, PrivateKey senderPrivateKey, PublicKey senderPublicKey, Collection recipientCerts, String cekWrapAlgorithm, String provider) throws NoSuchProviderException, NoSuchAlgorithmException, 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.NoSuchAlgorithmException
- if the algorithm requested cannot be foundInvalidKeyException
- if the keys are inappropriate for the algorithm specifiedNoSuchProviderException
public void addKeyAgreementRecipients(String agreementAlgorithm, PrivateKey senderPrivateKey, PublicKey senderPublicKey, Collection recipientCerts, String cekWrapAlgorithm, Provider provider) throws NoSuchAlgorithmException, 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.NoSuchAlgorithmException
- if the algorithm requested cannot be foundInvalidKeyException
- if the keys are inappropriate for the algorithm specifiedpublic void addRecipientInfoGenerator(RecipientInfoGenerator recipientGenerator)
recipientGenerator
- a generator of a recipient info object.protected AlgorithmIdentifier getAlgorithmIdentifier(String encryptionOID, AlgorithmParameters params) throws IOException
IOException
protected AlgorithmParameters generateParameters(String encryptionOID, SecretKey encKey, Provider encProvider) throws CMSException
CMSException
Copyright © 2015. All rights reserved.