Package iu.crypt

Class JweRecipient

java.lang.Object
iu.crypt.JweRecipient
All Implemented Interfaces:
WebEncryptionRecipient

public class JweRecipient extends Object implements WebEncryptionRecipient
Represents a recipient of a Jwe encrypted message.
  • Constructor Details

    • JweRecipient

      JweRecipient(Jose header, byte[] encryptedKey)
      Constructor.
      Parameters:
      header - header
      encryptedKey - encrypted key
    • JweRecipient

      JweRecipient(JsonObject protectedHeader, JsonObject sharedHeader, JsonObject recipient)
      Constructor.
      Parameters:
      protectedHeader - protected header parameters
      sharedHeader - shared header parameters
      recipient - recipient parameters
  • Method Details

    • getHeader

      public Jose getHeader()
      Description copied from interface: WebEncryptionRecipient
      Gets the JOSE header.
      Specified by:
      getHeader in interface WebEncryptionRecipient
      Returns:
      WebCryptoHeader
    • getEncryptedKey

      public byte[] getEncryptedKey()
      Description copied from interface: WebEncryptionRecipient
      Gets the encrypted_key JWE attribute
      Specified by:
      getEncryptedKey in interface WebEncryptionRecipient
      Returns:
      encrypted_key JWE attribute
    • agreedUponKey

      byte[] agreedUponKey(WebEncryption.Encryption encryption, WebKey recipientPrivateKey)
      Computes the agreed-upon key for the Elliptic Curve Diffie-Hellman algorithm.
      Parameters:
      encryption - content encryption algorithm
      recipientPrivateKey - recipient's private key
      Returns:
      agreed-upon key
      See Also:
    • passphraseDerivedKey

      byte[] passphraseDerivedKey(String passphrase)
      Gets the passphrase-derived key to use with PBKDF2 key derivation defined by PKCS#5.
      Parameters:
      passphrase - passphrase
      Returns:
      128-bit derived key data suitable for use with AESWrap
    • decryptCek

      byte[] decryptCek(WebEncryption.Encryption encryption, Jwk privateKey)
      Decrypts the content encryption key (CEK)
      Parameters:
      encryption - content encryption algorithm
      privateKey - private key
      Returns:
      content encryption key