Record Class KeyEncapsulationExchange.KeyExchangeResult

java.lang.Object
java.lang.Record
net.jrodolfo.java_evolution.java21.key_encapsulation.KeyEncapsulationExchange.KeyExchangeResult
Record Components:
senderSecretBytes - the shared secret bytes created by the sender
receiverSecretBytes - the shared secret bytes recovered by the receiver
encapsulation - the transmitted encapsulation message
providerName - the provider selected for the sender-side KEM operation
Enclosing class:
KeyEncapsulationExchange

public static record KeyEncapsulationExchange.KeyExchangeResult(byte[] senderSecretBytes, byte[] receiverSecretBytes, byte[] encapsulation, String providerName) extends Record
Captures the observable result of the KEM exchange for tests and readers.
  • Constructor Details

    • KeyExchangeResult

      public KeyExchangeResult(byte[] senderSecretBytes, byte[] receiverSecretBytes, byte[] encapsulation, String providerName)
      Creates an immutable exchange result.
  • Method Details

    • senderSecretBytes

      public byte[] senderSecretBytes()
      Returns the value of the senderSecretBytes record component.
      Returns:
      the value of the senderSecretBytes record component
    • receiverSecretBytes

      public byte[] receiverSecretBytes()
      Returns the value of the receiverSecretBytes record component.
      Returns:
      the value of the receiverSecretBytes record component
    • encapsulation

      public byte[] encapsulation()
      Returns the value of the encapsulation record component.
      Returns:
      the value of the encapsulation record component
    • secretsMatch

      public boolean secretsMatch()
      Shows whether both parties reached the same shared secret.
      Returns:
      true when sender and receiver key material matches
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
    • providerName

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