@hpke/core
    Preparing search index...

    Class DhkemP521HkdfSha512

    The DHKEM(P-521, HKDF-SHA512) for HPKE KEM implementing KemInterface.

    When using @hpke/core, the instance of this class must be specified to the kem parameter of CipherSuiteParams instead of KemId.DhkemP521HkdfSha512 as follows:

    import {
    Aes256Gcm,
    CipherSuite,
    DhkemP521HkdfSha512,
    HkdfSha512,
    } from "@hpke/core";

    const suite = new CipherSuite({
    kem: new DhkemP521HkdfSha512(),
    kdf: new HkdfSha512(),
    aead: new Aes256Gcm(),
    });

    Hierarchy

    • DhkemP521HkdfSha512Native
      • DhkemP521HkdfSha512
    Index

    Constructors

    Properties

    _prim: DhkemPrimitives
    encSize: number = 133
    id: KemId = KemId.DhkemP521HkdfSha512
    privateKeySize: number = 64
    publicKeySize: number = 133
    secretSize: number = 64

    Methods

    • Derives a key pair from the byte string ikm.

      If the error occurred, throws DeriveKeyPairError.

      Parameters

      • ikm: ArrayBuffer

        An input keying material.

      Returns Promise<CryptoKeyPair>

      A key pair derived.

    • Deserializes a private key as a byte string of length Nsk to CryptoKey.

      If the error occurred, throws DeserializeError.

      Parameters

      • key: ArrayBuffer

        A key as bytes.

      Returns Promise<CryptoKey>

      A CryptoKey.

    • Deserializes a public key as a byte string of length Npk to CryptoKey.

      If the error occurred, throws DeserializeError.

      Parameters

      • key: ArrayBuffer

        A key as bytes.

      Returns Promise<CryptoKey>

      A CryptoKey.

    • Generates an ephemeral, fixed-length symmetric key and a fixed-length encapsulation of the key that can be decapsulated by the holder of the private key corresponding to pkR.

      If the error occurred, throws EncapError.

      Parameters

      Returns Promise<{ enc: ArrayBuffer; sharedSecret: ArrayBuffer }>

      A shared secret and an encapsulated key as the output of the encapsulation step.

      EncapError

    • Imports a public or private key and converts to a CryptoKey.

      Since key parameters for createSenderContext or createRecipientContext are CryptoKey format, you have to use this function to convert provided keys to CryptoKey.

      Basically, this is a thin wrapper function of SubtleCrypto.importKey.

      If the error occurred, throws DeserializeError.

      Parameters

      • format: "raw" | "jwk"

        For now, 'raw' and 'jwk' are supported.

      • key: ArrayBuffer | JsonWebKey

        A byte string of a raw key or A JsonWebKey object.

      • isPublic: boolean = true

        The indicator whether the provided key is a public key or not, which is used only for 'raw' format.

      Returns Promise<CryptoKey>

      A public or private CryptoKey.

    • Serializes a private key as CryptoKey to a byte string of length Nsk.

      If the error occurred, throws SerializeError.

      Parameters

      • key: CryptoKey

        A CryptoKey.

      Returns Promise<ArrayBuffer>

      A key as bytes.

    • Serializes a public key as CryptoKey to a byte string of length Npk.

      If the error occurred, throws SerializeError.

      Parameters

      • key: CryptoKey

        A CryptoKey.

      Returns Promise<ArrayBuffer>

      A key as bytes.