Skip to main content
Module

x/hpke/x/dhkem-secp256k1/mod.ts>DhkemSecp256k1HkdfSha256

A Hybrid Public Key Encryption (HPKE) module built on top of Web Cryptography API.
Latest
class DhkemSecp256k1HkdfSha256
extends Dhkem
import { DhkemSecp256k1HkdfSha256 } from "https://deno.land/x/hpke@1.2.7/x/dhkem-secp256k1/mod.ts";

The DHKEM(secp256k1, HKDF-SHA256) for HPKE KEM implementing KemInterface.

This class is implemented using @noble/curves.

The public keys are assumed to be compressed.

The instance of this class can be specified to the CipherSuiteParams as follows:

Examples

Use with hpke-js (https://deno.land/x/hpke/mod.ts).

import { AeadId, CipherSuite, KdfId } from "https://deno.land/x/hpke/mod.ts";
import { DhkemSecp256k1HkdfSha256 } from "https://deno.land/x/hpke/x/dhkem-secp256k1/mod.ts";

const suite = new CipherSuite({
  kem: new DhkemSecp256k1HkdfSha256(),
  kdf: KdfId.HkdfSha256,
  aead: AeadId.Aes128Gcm,
});

When using hpke-js (https://deno.land/x/hpke/mod.ts), KemId.DhkemSecp256k1HkdfSha256 cannot be used as well. So you need to specify the instance of this class as follows:

Use with @hpke/core (https://deno.land/x/hpke/core/mod.ts).

import {
  Aes128Gcm,
  CipherSuite,
  HkdfSha256,
} from "https://deno.land/x/hpke/core/mod.ts";
import { DhkemSecp256k1HkdfSha256 } from "https://deno.land/x/hpke/x/dhkem-secp256k1/mod.ts";

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

Constructors

new
DhkemSecp256k1HkdfSha256()

Properties

readonly
encSize: number

33

readonly
id: KemId

KemId.DhkemSecp256k1HkdfSha256 (0x0013) EXPERIMENTAL

readonly
privateKeySize: number

32

readonly
publicKeySize: number

33

readonly
secretSize: number

32