Record Class KdfResult

java.lang.Object
java.lang.Record
co.cryptoservice.sdk.KdfResult
Record Components:
algorithm - the algorithm
derivedKey - the derived key; lowercase hex
keyLength - derived key length in bytes
salt - the salt used: the request's, or 16 random bytes; lowercase hex

public record KdfResult(String algorithm, String derivedKey, int keyLength, String salt) extends Record
What POST /v2/kdf answers: derive a key from a password.
  • Constructor Details

    • KdfResult

      public KdfResult(String algorithm, String derivedKey, int keyLength, String salt)
      Creates an instance of a KdfResult record class.
      Parameters:
      algorithm - the value for the algorithm record component
      derivedKey - the value for the derivedKey record component
      keyLength - the value for the keyLength record component
      salt - the value for the salt record component
  • Method Details

    • derivedKeyBytes

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

      public byte[] saltBytes()
      salt() decoded from hex.
      Returns:
      the bytes, or null when salt 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      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.
    • algorithm

      public String algorithm()
      Returns the value of the algorithm record component.
      Returns:
      the value of the algorithm record component
    • derivedKey

      public String derivedKey()
      Returns the value of the derivedKey record component.
      Returns:
      the value of the derivedKey record component
    • keyLength

      public int keyLength()
      Returns the value of the keyLength record component.
      Returns:
      the value of the keyLength record component
    • salt

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