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.
40 lines (39 loc) • 1.46 kB
TypeScript
/**
* @license
* Copyright 2023 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { PbHpkePrivateKey } from '../../../internal/proto';
import { HybridDecrypt } from '../hybrid_decrypt';
import { HpkeAead } from './hpke_aead';
import { HpkeKdf } from './hpke_kdf';
import { HpkeKem } from './hpke_kem';
import { HpkeKemPrivateKey } from './hpke_kem_private_key';
/**
* Hybrid Public Key Encryption (HPKE) decryption.
*
* @final
*/
export declare class HpkeDecrypt extends HybridDecrypt {
private static readonly EMPTY_ASSOCIATED_DATA;
private readonly recipientPrivateKey;
private readonly kem;
private readonly kdf;
private readonly aead;
private readonly encapsulatedKeyLength;
constructor(recipientPrivateKey: HpkeKemPrivateKey, kem: HpkeKem, kdf: HpkeKdf, aead: HpkeAead, encapsulatedKeyLength: number);
/**
* Returns the encapsulated key length (in bytes) for the specified
* `kemProtoEnum`. This value corresponds to the 'Nenc' column in the following
* table.
*
* <p>https://www.rfc-editor.org/rfc/rfc9180.html#name-key-encapsulation-mechanism.
*/
private static encodingSizeInBytes;
/**
* Returns an HPKE decryption primitive created from a given
* recipientPrivateKey.
*/
static createHpkeDecrypt(recipientPrivateKey: PbHpkePrivateKey): Promise<HpkeDecrypt>;
decrypt(ciphertext: Uint8Array, contextInfo?: Uint8Array): Promise<Uint8Array>;
}