Class HkdfSha384

The HKDF-SHA384 for HPKE KDF implementing KdfInterface.

When using @hpke/core, the instance of this class must be specified to the kem parameter of CipherSuiteParams instead of KdfId.HkdfSha384.

The KDF class can only derive keys of the same length as the hashSize. If you want to derive keys longer than the hashSize, please use hpke-js#CipherSuite.

import {
Aes128Gcm,
CipherSuite,
DhkemP384HkdfSha384,
HkdfSha384,
} from "@hpke/core";

const suite = new CipherSuite({
kem: new DhkemP384HkdfSha384(),
kdf: new HkdfSha384(),
aead: new Aes128Gcm(),
});

Hierarchy

  • HkdfSha384Native
    • HkdfSha384

Constructors

Properties

_api: SubtleCrypto = undefined
_suiteId: Uint8Array = EMPTY
algHash: HmacKeyGenParams = ...

The parameters for Web Cryptography API

hashSize: number = 48

48

id: KdfId = KdfId.HkdfSha384

KdfId.HkdfSha384 (0x0002)

Methods

  • Builds a labeled input keying material.

    Parameters

    • label: Uint8Array

      A byte string indicating the cryptographic context/operation.

    • ikm: Uint8Array

    Returns Uint8Array

    An input keying material as bytes.

  • Builds a labeled info string.

    Parameters

    • label: Uint8Array

      A byte string indicating the cryptographic context/operation.

    • info: Uint8Array

      An additional byte string.

    • len: number

      The length of the output byte string.

    Returns Uint8Array

    An info string as bytes.

  • Expands a pseudorandom key prk.

    Parameters

    • prk: ArrayBuffer

      A pseudorandom key.

    • info: ArrayBuffer

      An additional byte string.

    • len: number

      The length in bytes of the output keying material.

    Returns Promise<ArrayBuffer>

    An output keying material as bytes.

  • Extracts a pseudorandom key of fixed length (Nh) bytes.

    Parameters

    • salt: ArrayBuffer

      An additional random byte string.

    • ikm: ArrayBuffer

      An input keying material

    Returns Promise<ArrayBuffer>

    A pseudorandom key as bytes.

  • Extracts a pseudorandom key and expand it to a specified length keying material.

    Parameters

    • salt: ArrayBuffer

      An additional random byte string.

    • ikm: ArrayBuffer

      An input keying material

    • info: ArrayBuffer

      An additional byte string.

    • len: number

      The length in bytes of the output keying material.

    Returns Promise<ArrayBuffer>

    An output keying material as bytes.

  • Initializes the instance by setting a suite_id defined in RFC9180.

    Parameters

    • suiteId: Uint8Array

      A suite_id defined in RFC9180.

    Returns void

  • Extracts a pseudorandom key with label.

    Parameters

    • prk: ArrayBuffer

      A pseudorandom key.

    • label: Uint8Array

      A byte string indicating the cryptographic context/operation.

    • info: Uint8Array

      An additional byte string.

    • len: number

      The length in bytes of the output keying material.

    Returns Promise<ArrayBuffer>

    An output keying material as bytes.

  • Extracts a pseudorandom key with label.

    Parameters

    • salt: ArrayBuffer

      An additional random byte string.

    • label: Uint8Array

      A byte string indicating the cryptographic context/operation.

    • ikm: Uint8Array

      An input keying material

    Returns Promise<ArrayBuffer>

    A pseudorandom key as bytes.