Record Class RecipientEnvelope

java.lang.Object
java.lang.Record
co.cryptoservice.sdk.RecipientEnvelope
Record Components:
ephemeralPublicKey - the sender's ephemeral X25519 public key; lowercase hex
type - x25519 for a classical recipient, x25519-ml-kem-768 for a pq one
wrappedKey - the content key, wrapped for this recipient; standard base64 (RFC 4648 section 4), padded
mlKemCiphertext - 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 Details

    • RecipientEnvelope

      public RecipientEnvelope(String ephemeralPublicKey, String type, String wrappedKey, String mlKemCiphertext)
      Creates an instance of a RecipientEnvelope record class.
      Parameters:
      ephemeralPublicKey - the value for the ephemeralPublicKey record component
      type - the value for the type record component
      wrappedKey - the value for the wrappedKey record component
      mlKemCiphertext - the value for the mlKemCiphertext record component
  • Method Details

    • ephemeralPublicKeyBytes

      public byte[] ephemeralPublicKeyBytes()
      ephemeralPublicKey() decoded from hex.
      Returns:
      the bytes, or null when ephemeralPublicKey is absent
      Throws:
      IllegalArgumentException - when the server sent malformed hex
    • wrappedKeyBytes

      public byte[] wrappedKeyBytes()
      wrappedKey() decoded from base64.
      Returns:
      the bytes, or null when wrappedKey is absent
      Throws:
      IllegalArgumentException - when the server sent malformed base64
    • mlKemCiphertextBytes

      public byte[] mlKemCiphertextBytes()
      mlKemCiphertext() decoded from hex.
      Returns:
      the bytes, or null when mlKemCiphertext is absent
      Throws:
      IllegalArgumentException - when the server sent malformed hex
    • toString

      public String toString()
      Names the members; values that may be secret (keys, plaintexts, passwords, signatures) are redacted.
      Specified by:
      toString in class Record
      Returns:
      a description safe to log
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • ephemeralPublicKey

      public String ephemeralPublicKey()
      Returns the value of the ephemeralPublicKey record component.
      Returns:
      the value of the ephemeralPublicKey record component
    • type

      public String type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • wrappedKey

      public String wrappedKey()
      Returns the value of the wrappedKey record component.
      Returns:
      the value of the wrappedKey record component
    • mlKemCiphertext

      public String mlKemCiphertext()
      Returns the value of the mlKemCiphertext record component.
      Returns:
      the value of the mlKemCiphertext record component