java.lang.Object
iu.crypt.JweRecipient
- All Implemented Interfaces:
WebEncryptionRecipient
Represents a recipient of a
Jwe
encrypted message.-
Nested Class Summary
Nested classes/interfaces inherited from interface edu.iu.crypt.WebEncryptionRecipient
WebEncryptionRecipient.Builder<B extends WebEncryptionRecipient.Builder<B>>
-
Constructor Summary
ConstructorsConstructorDescriptionJweRecipient
(Jose header, byte[] encryptedKey) Constructor.JweRecipient
(JsonObject protectedHeader, JsonObject sharedHeader, JsonObject recipient) Constructor. -
Method Summary
Modifier and TypeMethodDescription(package private) byte[]
agreedUponKey
(WebEncryption.Encryption encryption, WebKey recipientPrivateKey) Computes the agreed-upon key for the Elliptic Curve Diffie-Hellman algorithm.(package private) byte[]
decryptCek
(WebEncryption.Encryption encryption, Jwk privateKey) Decrypts the content encryption key (CEK)byte[]
Gets the encrypted_key JWE attributeGets the JOSE header.(package private) byte[]
passphraseDerivedKey
(String passphrase) Gets the passphrase-derived key to use with PBKDF2 key derivation defined by PKCS#5.
-
Constructor Details
-
JweRecipient
JweRecipient(Jose header, byte[] encryptedKey) Constructor.- Parameters:
header
- headerencryptedKey
- encrypted key
-
JweRecipient
JweRecipient(JsonObject protectedHeader, JsonObject sharedHeader, JsonObject recipient) Constructor.- Parameters:
protectedHeader
- protected header parameterssharedHeader
- shared header parametersrecipient
- recipient parameters
-
-
Method Details
-
getHeader
Description copied from interface:WebEncryptionRecipient
Gets the JOSE header.- Specified by:
getHeader
in interfaceWebEncryptionRecipient
- Returns:
WebCryptoHeader
-
getEncryptedKey
public byte[] getEncryptedKey()Description copied from interface:WebEncryptionRecipient
Gets the encrypted_key JWE attribute- Specified by:
getEncryptedKey
in interfaceWebEncryptionRecipient
- Returns:
- encrypted_key JWE attribute
-
agreedUponKey
Computes the agreed-upon key for the Elliptic Curve Diffie-Hellman algorithm.- Parameters:
encryption
- content encryption algorithmrecipientPrivateKey
- recipient's private key- Returns:
- agreed-upon key
- See Also:
-
passphraseDerivedKey
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
Decrypts the content encryption key (CEK)- Parameters:
encryption
- content encryption algorithmprivateKey
- private key- Returns:
- content encryption key
-