UNPKG

@unvision/jose

Version:

Implementation of the RFCs of the JOSE Working Group.

68 lines (67 loc) 2.79 kB
/// <reference types="node" /> import { JsonWebKey } from '../../../jwk/jsonwebkey'; import { SupportedJsonWebEncryptionKeyWrapAlgorithm } from './types/supported-jsonwebencryption-keywrap-algorithm'; import { JsonWebEncryptionContentEncryptionAlgorithm } from '../enc/jsonwebencryption-content-encryption.algorithm'; import { JsonWebEncryptionKeyWrapAlgorithm } from './jsonwebencryption-key-wrap.algorithm'; /** * Implementation of the JSON Web Encryption RSA Key Wrap Algorithm. * * @see https://www.rfc-editor.org/rfc/rfc7518.html#section-4.2 * @see https://www.rfc-editor.org/rfc/rfc7518.html#section-4.3 */ declare class RsaAlgorithm extends JsonWebEncryptionKeyWrapAlgorithm { /** * RSA Encryption Padding used by the JSON Web Encryption Key Wrap Algorithm. */ private readonly padding; /** * Name of the Hash Algorithm. */ private readonly hash?; /** * Instantiates a new JSON Web Encryption RSA Key Wrap Algorithm to Wrap and Unwrap Content Encryption Keys. * * @param algorithm Name of the JSON Web Encryption Key Wrap Algorithm. * @param padding RSA Encryption Padding used by the JSON Web Encryption Key Wrap Algorithm. * @param hash Name of the Hash Algorithm. */ constructor(algorithm: SupportedJsonWebEncryptionKeyWrapAlgorithm, padding: number, hash?: string); /** * Wraps the provided Content Encryption Key using the provide JSON Web Key. * * @param enc JSON Web Encryption Content Encryption Algorithm. * @param key JSON Web Key used to Wrap the provided Content Encryption Key. * @returns Generated Content Encryption Key, Wrapped Content Encryption Key and optional JSON Web Encryption Header. */ wrap(enc: JsonWebEncryptionContentEncryptionAlgorithm, key: JsonWebKey): Promise<[Buffer, Buffer]>; /** * Unwraps the provided Encrypted Key using the provided JSON Web Key. * * @param enc JSON Web Encrytpion Content Encryption Algorithm. * @param key JSON Web Key used to Unwrap the Wrapped Content Encryption Key. * @param ek Wrapped Content Encryption Key. * @returns Unwrapped Content Encryption Key. */ unwrap(enc: JsonWebEncryptionContentEncryptionAlgorithm, key: JsonWebKey, ek: Buffer): Promise<Buffer>; } /** * RSAES-PKCS1-v1_5. */ export declare const RSA1_5: RsaAlgorithm; /** * RSAES OAEP using default parameters. */ export declare const RSA_OAEP: RsaAlgorithm; /** * RSAES OAEP using SHA-256 and MGF1 with SHA-256. */ export declare const RSA_OAEP_256: RsaAlgorithm; /** * RSAES OAEP using SHA-384 and MGF1 with SHA-384. */ export declare const RSA_OAEP_384: RsaAlgorithm; /** * RSAES OAEP using SHA-512 and MGF1 with SHA-512. */ export declare const RSA_OAEP_512: RsaAlgorithm; export {};