@hackbg/miscreant-esm
Version:
(ESM port) Misuse resistant symmetric encryption library providing AES-SIV (RFC 5297), AES-PMAC-SIV, and STREAM constructions
27 lines (26 loc) • 1.19 kB
TypeScript
import { ICryptoProvider, ICTRLike, IMACLike, ISIVLike } from "./interfaces.dist";
/** Maximum number of associated data items */
export declare const MAX_ASSOCIATED_DATA = 126;
/** The AES-SIV mode of authenticated encryption */
export declare class SIV implements ISIVLike {
/** Create a new AES-SIV instance with the given 32-byte or 64-byte key */
static importKey(keyData: Uint8Array, alg: string, provider?: ICryptoProvider): Promise<SIV>;
private _mac;
private _ctr;
private _tmp1;
private _tmp2;
constructor(mac: IMACLike, ctr: ICTRLike);
/** Encrypt and authenticate data using AES-SIV */
seal(plaintext: Uint8Array, associatedData: Uint8Array[]): Promise<Uint8Array>;
/** Decrypt and authenticate data using AES-SIV */
open(sealed: Uint8Array, associatedData: Uint8Array[]): Promise<Uint8Array>;
/** Make a best effort to wipe memory used by this instance */
clear(): this;
/**
* The S2V operation consists of the doubling and XORing of the outputs
* of the pseudo-random function CMAC (or PMAC in the case of AES-PMAC-SIV).
*
* See Section 2.4 of RFC 5297 for more information
*/
private _s2v;
}