@guarani/jose
Version:
Implementation of the RFCs of the JOSE Working Group.
68 lines (67 loc) • 2.91 kB
TypeScript
/// <reference types="node" />
import { Dict, Optional } from '@guarani/types';
import { RsaPadding } from '../../../jwk/algorithms/rsa/types/rsa-padding';
import { RsaKey } from '../../../jwk/algorithms/rsa/rsa.key';
import { JsonWebEncryptionContentEncryptionAlgorithm } from '../enc/jsonwebencryption-contentencryption.algorithm';
import { JsonWebEncryptionKeyWrapAlgorithm } from './jsonwebencryption-keywrap.algorithm';
import { SupportedJsonWebEncryptionKeyWrapAlgorithm } from './types/supported-jsonwebencryption-keyencryption-algorithm';
import { WrappedKey } from './types/wrapped-key';
/**
* Implementation of the RSA JSON Web Encryption Key Wrap Algorithm.
*/
declare class RSAKeyWrapAlgorithm extends JsonWebEncryptionKeyWrapAlgorithm {
/**
* RSA Encryption Padding used by the JSON Web Encryption Key Wrap Algorithm.
*/
private readonly padding;
/**
* Name of the Hash Algorithm.
*/
private readonly hashAlgorithm?;
/**
* 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 hashAlgorithm Name of the Hash Algorithm.
*/
constructor(algorithm: SupportedJsonWebEncryptionKeyWrapAlgorithm, padding: RsaPadding, hashAlgorithm?: Optional<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 Wrapped Content Encryption Key and optional additional JSON Web Encryption Header Parameters.
*/
wrap(enc: JsonWebEncryptionContentEncryptionAlgorithm, key: RsaKey): Promise<WrappedKey<Dict>>;
/**
* Unwraps the provided Encrypted Key using the provided JSON Web Key.
*
* @param enc JSON Web Encryption 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: RsaKey, ek: Buffer): Promise<Buffer>;
}
/**
* RSAES-PKCS1-v1_5.
*/
export declare const RSA1_5: RSAKeyWrapAlgorithm;
/**
* RSAES OAEP using default parameters.
*/
export declare const RSA_OAEP: RSAKeyWrapAlgorithm;
/**
* RSAES OAEP using SHA-256 and MGF1 with SHA-256.
*/
export declare const RSA_OAEP_256: RSAKeyWrapAlgorithm;
/**
* RSAES OAEP using SHA-384 and MGF1 with SHA-384.
*/
export declare const RSA_OAEP_384: RSAKeyWrapAlgorithm;
/**
* RSAES OAEP using SHA-512 and MGF1 with SHA-512.
*/
export declare const RSA_OAEP_512: RSAKeyWrapAlgorithm;
export {};