UNPKG

tink-crypto

Version:

A multi-language, cross-platform library that provides cryptographic APIs that are secure, easy to use correctly, and hard(er) to misuse.

25 lines (24 loc) 1.15 kB
/** * @license * Copyright 2022 Google LLC * SPDX-License-Identifier: Apache-2.0 */ import * as ellipticCurves from '../../../subtle/elliptic_curves'; import { HpkeKem } from './hpke_kem'; import { HpkeKemEncapOutput } from './hpke_kem_encap_output'; import { HpkeKemPrivateKey } from './hpke_kem_private_key'; /** Diffie-Hellman-based P-256 and P-521 HPKE KEM variant. */ export declare class NistCurvesHpkeKem implements HpkeKem { private readonly hkdf; private readonly curve; private constructor(); TEST_ONLY: (recipientPublicKey: Uint8Array, senderKeyPair: HpkeKemPrivateKey) => Promise<HpkeKemEncapOutput>; /** Construct HPKE KEM using `curve`. */ static fromCurve(curve: ellipticCurves.CurveType.P256 | ellipticCurves.CurveType.P521): NistCurvesHpkeKem; private deriveKemSharedSecret; /** Helper function factored out (insecure) to facilitate unit testing. */ private encapsulateHelper; encapsulate(recipientPublicKey: Uint8Array): Promise<HpkeKemEncapOutput>; decapsulate(encapsulatedKey: Uint8Array, recipientPrivateKey: HpkeKemPrivateKey): Promise<Uint8Array>; getKemId(): Uint8Array; }