Class Hkdf

java.lang.Object
org.conscrypt.Hkdf

public final class Hkdf extends Object
Hkdf - perform HKDF key derivation operations per RFC 5869.

Instances should be instantiated using the standard JCA name for the required HMAC.

Each invocation of expand or extract uses a new Mac instance and so instances of Hkdf are thread-safe.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final String
     
    private final int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Hkdf(String hmacName)
    Creates an Hkdf instance which will use hmacName as the name for the underlying HMAC algorithm, which will be located using normal JCA precedence rules.
  • Method Summary

    Modifier and Type
    Method
    Description
    byte[]
    expand(byte[] prk, byte[] info, int length)
    Performs an HKDF expand operation as specified in RFC 5869.
    byte[]
    extract(byte[] salt, byte[] ikm)
    Performs an HKDF extract operation as specified in RFC 5869.
    private Mac
    getMac(byte[] key)
     
    int
     

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • hmacName

      private final String hmacName
    • macLength

      private final int macLength
  • Constructor Details

    • Hkdf

      public Hkdf(String hmacName) throws NoSuchAlgorithmException
      Creates an Hkdf instance which will use hmacName as the name for the underlying HMAC algorithm, which will be located using normal JCA precedence rules.

      Parameters:
      hmacName - the name of the HMAC algorithm to use
      Throws:
      NoSuchAlgorithmException - if hmacName is not a valid HMAC name
  • Method Details