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.
34 lines (33 loc) • 1.36 kB
TypeScript
/**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import * as EllipticCurves from './elliptic_curves';
/**
* HKDF-based ECIES-KEM (key encapsulation mechanism) for ECIES sender.
*/
export declare class EciesHkdfKemSender {
private readonly publicKey;
constructor(recipientPublicKey: CryptoKey);
/**
* @param keySizeInBytes The length of the generated pseudorandom
* string in bytes. The maximal size is 255 * DigestSize, where DigestSize
* is the size of the underlying HMAC.
* @param pointFormat The format of the
* public ephemeral point.
* @param hkdfHash the name of the hash function. Accepted names are
* SHA-1, SHA-256 and SHA-512.
* @param hkdfInfo Context and application specific
* information (can be a zero-length array).
* @param opt_hkdfSalt Salt value (a non-secret random
* value). If not provided, it is set to a string of hash length zeros.
* @return The KEM key and
* token.
*/
encapsulate(keySizeInBytes: number, pointFormat: EllipticCurves.PointFormatType, hkdfHash: string, hkdfInfo: Uint8Array, opt_hkdfSalt?: Uint8Array): Promise<{
key: Uint8Array;
token: Uint8Array;
}>;
}
export declare function fromJsonWebKey(jwk: JsonWebKey): Promise<EciesHkdfKemSender>;