JceKeyAgreeRecipientInfoGenerator (Bouncy Castle Library 1.52 API Specification)
Date: 2015-03-01

org.bouncycastle.cms.jcajce

## Class JceKeyAgreeRecipientInfoGenerator

- java.lang.Object
- - org.bouncycastle.cms.KeyAgreeRecipientInfoGenerator
  - - org.bouncycastle.cms.jcajce.JceKeyAgreeRecipientInfoGenerator

- All Implemented Interfaces:
    RecipientInfoGenerator

      public class JceKeyAgreeRecipientInfoGenerator
      extends KeyAgreeRecipientInfoGenerator

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `JceKeyAgreeRecipientInfoGenerator(org.bouncycastle.asn1.ASN1ObjectIdentifier keyAgreementOID, java.security.PrivateKey senderPrivateKey, java.security.PublicKey senderPublicKey, org.bouncycastle.asn1.ASN1ObjectIdentifier keyEncryptionOID)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `JceKeyAgreeRecipientInfoGenerator` | `addRecipient(byte[] subjectKeyID, java.security.PublicKey publicKey)` Add a recipient identified by the passed in subjectKeyID and the for the passed in public key.
    `JceKeyAgreeRecipientInfoGenerator` | `addRecipient(java.security.cert.X509Certificate recipientCert)` Add a recipient based on the passed in certificate's public key and its issuer and serial number.
    `org.bouncycastle.asn1.ASN1Sequence` | `generateRecipientEncryptedKeys(org.bouncycastle.asn1.x509.AlgorithmIdentifier keyAgreeAlgorithm, org.bouncycastle.asn1.x509.AlgorithmIdentifier keyEncryptionAlgorithm, GenericKey contentEncryptionKey)`
    `protected org.bouncycastle.asn1.ASN1Encodable` | `getUserKeyingMaterial(org.bouncycastle.asn1.x509.AlgorithmIdentifier keyAgreeAlg)`
    `JceKeyAgreeRecipientInfoGenerator` | `setProvider(java.security.Provider provider)`
    `JceKeyAgreeRecipientInfoGenerator` | `setProvider(java.lang.String providerName)`
    `JceKeyAgreeRecipientInfoGenerator` | `setSecureRandom(java.security.SecureRandom random)`

    - ### Methods inherited from class org.bouncycastle.cms.KeyAgreeRecipientInfoGenerator

      `createOriginatorPublicKey, generate`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### JceKeyAgreeRecipientInfoGenerator

          public JceKeyAgreeRecipientInfoGenerator(org.bouncycastle.asn1.ASN1ObjectIdentifier keyAgreementOID,
                                           java.security.PrivateKey senderPrivateKey,
                                           java.security.PublicKey senderPublicKey,
                                           org.bouncycastle.asn1.ASN1ObjectIdentifier keyEncryptionOID)

  - ### Method Detail

    - #### setProvider

          public JceKeyAgreeRecipientInfoGenerator setProvider(java.security.Provider provider)

    - #### setProvider

          public JceKeyAgreeRecipientInfoGenerator setProvider(java.lang.String providerName)

    - #### setSecureRandom

          public JceKeyAgreeRecipientInfoGenerator setSecureRandom(java.security.SecureRandom random)

    - #### addRecipient

          public JceKeyAgreeRecipientInfoGenerator addRecipient(java.security.cert.X509Certificate recipientCert)
                                                         throws java.security.cert.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:
        `java.security.cert.CertificateEncodingException` - if the necessary data cannot be extracted from the certificate.

    - #### addRecipient

          public JceKeyAgreeRecipientInfoGenerator addRecipient(byte[] subjectKeyID,
                                                       java.security.PublicKey publicKey)
                                                         throws java.security.cert.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:
        `java.security.cert.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:
        `generateRecipientEncryptedKeys` in class `KeyAgreeRecipientInfoGenerator`
      Throws:
        `CMSException`

    - #### getUserKeyingMaterial

          protected org.bouncycastle.asn1.ASN1Encodable getUserKeyingMaterial(org.bouncycastle.asn1.x509.AlgorithmIdentifier keyAgreeAlg)
                                                                       throws CMSException

      Specified by:
        `getUserKeyingMaterial` in class `KeyAgreeRecipientInfoGenerator`
      Throws:
        `CMSException`