Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/hpke/src/kems/dhkemX25519.ts>DhkemX25519HkdfSha256

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

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

This class is implemented using @noble/curves.

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

Examples

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 { DhkemX25519HkdfSha256 } from "https://deno.land/x/hpke/x/dhkem-x25519/mod.ts";

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

When using hpke-js (https://deno.land/x/hpke/mod.ts), KemId.DhkemX25519HkdfSha256 can be used. You don't need to use this class.

Example 2

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

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

Constructors

new
DhkemX25519HkdfSha256()

Properties

readonly
encSize: number

32

readonly
id: KemId

KemId.DhkemX25519HkdfSha256 (0x0020)

readonly
privateKeySize: number

32

readonly
publicKeySize: number

32

readonly
secretSize: number

32