Class JceKeyAgreeRecipientInfoGenerator
java.lang.Object
org.bouncycastle.cms.KeyAgreeRecipientInfoGenerator
org.bouncycastle.cms.jcajce.JceKeyAgreeRecipientInfoGenerator
- All Implemented Interfaces:
RecipientInfoGenerator
-
Constructor Summary
ConstructorsConstructorDescriptionJceKeyAgreeRecipientInfoGenerator(org.bouncycastle.asn1.ASN1ObjectIdentifier keyAgreementOID, PrivateKey senderPrivateKey, PublicKey senderPublicKey, org.bouncycastle.asn1.ASN1ObjectIdentifier keyEncryptionOID) -
Method Summary
Modifier and TypeMethodDescriptionaddRecipient(byte[] subjectKeyID, PublicKey publicKey) Add a recipient identified by the passed in subjectKeyID and the for the passed in public key.addRecipient(X509Certificate recipientCert) Add a recipient based on the passed in certificate's public key and its issuer and serial number.org.bouncycastle.asn1.ASN1SequencegenerateRecipientEncryptedKeys(org.bouncycastle.asn1.x509.AlgorithmIdentifier keyAgreeAlgorithm, org.bouncycastle.asn1.x509.AlgorithmIdentifier keyEncryptionAlgorithm, GenericKey contentEncryptionKey) protected voidCalled at the end of everyKeyAgreeRecipientInfoGenerator.generate(GenericKey), whether it completed normally or not, so a subclass can release any state it holds for the duration of a single KeyAgreeRecipientInfo (e.g.protected byte[]getUserKeyingMaterial(org.bouncycastle.asn1.x509.AlgorithmIdentifier keyAgreeAlg) setKeyWrappingProvider(String providerName) setKeyWrappingProvider(Provider provider) setProvider(String providerName) setProvider(Provider provider) setSecureRandom(SecureRandom random) setUserKeyingMaterial(byte[] userKeyingMaterial) Methods inherited from class KeyAgreeRecipientInfoGenerator
createOriginatorPublicKey, generate, isEC, isGOST, isHKDF, isMQV, isRFC2631
-
Constructor Details
-
JceKeyAgreeRecipientInfoGenerator
public JceKeyAgreeRecipientInfoGenerator(org.bouncycastle.asn1.ASN1ObjectIdentifier keyAgreementOID, PrivateKey senderPrivateKey, PublicKey senderPublicKey, org.bouncycastle.asn1.ASN1ObjectIdentifier keyEncryptionOID)
-
-
Method Details
-
setUserKeyingMaterial
-
setProvider
-
setProvider
-
setKeyWrappingProvider
-
setKeyWrappingProvider
-
setSecureRandom
-
addRecipient
public JceKeyAgreeRecipientInfoGenerator addRecipient(X509Certificate recipientCert) throws CertificateEncodingException Add a recipient based on the passed in certificate's public key and its issuer and serial number.- Parameters:
recipientCert- recipient's certificate- Returns:
- the current instance.
- Throws:
CertificateEncodingException- if the necessary data cannot be extracted from the certificate.
-
addRecipient
public JceKeyAgreeRecipientInfoGenerator addRecipient(byte[] subjectKeyID, PublicKey publicKey) throws CertificateEncodingException Add a recipient identified by the passed in subjectKeyID and the for the passed in public key.- Parameters:
subjectKeyID- identifier actual recipient will use to match the private key.publicKey- the public key for encrypting the secret key.- Returns:
- the current instance.
- Throws:
CertificateEncodingException
-
generateRecipientEncryptedKeys
public org.bouncycastle.asn1.ASN1Sequence generateRecipientEncryptedKeys(org.bouncycastle.asn1.x509.AlgorithmIdentifier keyAgreeAlgorithm, org.bouncycastle.asn1.x509.AlgorithmIdentifier keyEncryptionAlgorithm, GenericKey contentEncryptionKey) throws CMSException - Specified by:
generateRecipientEncryptedKeysin classKeyAgreeRecipientInfoGenerator- Throws:
CMSException
-
getUserKeyingMaterial
protected byte[] getUserKeyingMaterial(org.bouncycastle.asn1.x509.AlgorithmIdentifier keyAgreeAlg) throws CMSException - Specified by:
getUserKeyingMaterialin classKeyAgreeRecipientInfoGenerator- Throws:
CMSException
-
generationComplete
protected void generationComplete()Description copied from class:KeyAgreeRecipientInfoGeneratorCalled at the end of everyKeyAgreeRecipientInfoGenerator.generate(GenericKey), whether it completed normally or not, so a subclass can release any state it holds for the duration of a single KeyAgreeRecipientInfo (e.g. an ephemeral key pair). The default implementation does nothing.This is called from a finally block, so an implementation must not throw: an exception thrown here would replace the result, or the exception, of the generate call.
- Overrides:
generationCompletein classKeyAgreeRecipientInfoGenerator
-