@hpke/core
    Preparing search index...

    Class HkdfSha384

    The HKDF-SHA384 for HPKE KDF implementing KdfInterface.

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

    HKDF-Extract accepts salts of any length. HKDF-Expand supports output lengths up to 255 times hashSize.

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

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

    Hierarchy

    • HkdfSha384Native
      • HkdfSha384
    Index
    • Uses WebCrypto HMAC for salts of any length when no callback is supplied. Prefer omitting the callback and its JavaScript HMAC/SHA-2 imports to reduce bundle size. Empty salts are normalized to hashSize zero bytes.

      Parameters

      • OptionalfallbackExtract: (salt: Uint8Array, ikm: Uint8Array) => Uint8Array

        Optional legacy callback, taking precedence over WebCrypto for nonempty salts whose length differs from hashSize. Empty and hash-sized salts always use WebCrypto.

      Returns HkdfSha384

    _api: SubtleCrypto = undefined
    _fallbackExtract: (salt: Uint8Array, ikm: Uint8Array) => Uint8Array
    _suiteId: Uint8Array = EMPTY
    algHash: HmacKeyGenParams = ...

    The parameters for Web Cryptography API

    hashSize: number = 48

    48

    id: KdfId = 0x0002

    KdfId.HkdfSha384 (0x0002)

    • 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: ArrayBufferLike | ArrayBufferView<ArrayBufferLike>

        A pseudorandom key.

      • info: ArrayBufferLike | ArrayBufferView<ArrayBufferLike>

        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: ArrayBufferLike | ArrayBufferView<ArrayBufferLike>

        An additional random byte string.

      • ikm: ArrayBufferLike | ArrayBufferView<ArrayBufferLike>

        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: ArrayBufferLike | ArrayBufferView<ArrayBufferLike>

        An additional random byte string.

      • ikm: ArrayBufferLike | ArrayBufferView<ArrayBufferLike>

        An input keying material

      • info: ArrayBufferLike | ArrayBufferView<ArrayBufferLike>

        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: ArrayBufferLike | ArrayBufferView<ArrayBufferLike>

        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: ArrayBufferLike | ArrayBufferView<ArrayBufferLike>

        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.