Package co.cryptoservice.sdk
Record Class RecipientEnvelope
java.lang.Object
java.lang.Record
co.cryptoservice.sdk.RecipientEnvelope
- Record Components:
ephemeralPublicKey- the sender's ephemeral X25519 public key; lowercase hextype- x25519 for a classical recipient, x25519-ml-kem-768 for a pq onewrappedKey- the content key, wrapped for this recipient; standard base64 (RFC 4648 section 4), paddedmlKemCiphertext- the ML-KEM-768 ciphertext (pq recipients only); lowercase hex, or null when absent
public record RecipientEnvelope(String ephemeralPublicKey, String type, String wrappedKey, String mlKemCiphertext)
extends Record
One element of
recipients.-
Constructor Summary
ConstructorsConstructorDescriptionRecipientEnvelope(String ephemeralPublicKey, String type, String wrappedKey, String mlKemCiphertext) Creates an instance of aRecipientEnveloperecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theephemeralPublicKeyrecord component.byte[]ephemeralPublicKey()decoded from hex.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of themlKemCiphertextrecord component.byte[]mlKemCiphertext()decoded from hex.toString()Names the members; values that may be secret (keys, plaintexts, passwords, signatures) are redacted.type()Returns the value of thetyperecord component.Returns the value of thewrappedKeyrecord component.byte[]wrappedKey()decoded from base64.
-
Constructor Details
-
RecipientEnvelope
public RecipientEnvelope(String ephemeralPublicKey, String type, String wrappedKey, String mlKemCiphertext) Creates an instance of aRecipientEnveloperecord class.- Parameters:
ephemeralPublicKey- the value for theephemeralPublicKeyrecord componenttype- the value for thetyperecord componentwrappedKey- the value for thewrappedKeyrecord componentmlKemCiphertext- the value for themlKemCiphertextrecord component
-
-
Method Details
-
ephemeralPublicKeyBytes
public byte[] ephemeralPublicKeyBytes()ephemeralPublicKey()decoded from hex.- Returns:
- the bytes, or null when
ephemeralPublicKeyis absent - Throws:
IllegalArgumentException- when the server sent malformed hex
-
wrappedKeyBytes
public byte[] wrappedKeyBytes()wrappedKey()decoded from base64.- Returns:
- the bytes, or null when
wrappedKeyis absent - Throws:
IllegalArgumentException- when the server sent malformed base64
-
mlKemCiphertextBytes
public byte[] mlKemCiphertextBytes()mlKemCiphertext()decoded from hex.- Returns:
- the bytes, or null when
mlKemCiphertextis absent - Throws:
IllegalArgumentException- when the server sent malformed hex
-
toString
Names the members; values that may be secret (keys, plaintexts, passwords, signatures) are redacted. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
ephemeralPublicKey
Returns the value of theephemeralPublicKeyrecord component.- Returns:
- the value of the
ephemeralPublicKeyrecord component
-
type
Returns the value of thetyperecord component.- Returns:
- the value of the
typerecord component
-
wrappedKey
Returns the value of thewrappedKeyrecord component.- Returns:
- the value of the
wrappedKeyrecord component
-
mlKemCiphertext
Returns the value of themlKemCiphertextrecord component.- Returns:
- the value of the
mlKemCiphertextrecord component
-