@guarani/jose
Version:
Implementation of the RFCs of the JOSE Working Group.
64 lines (63 loc) • 2.75 kB
TypeScript
/// <reference types="node" />
import { Dict } from '@guarani/types';
import { OctKey } from '../../../jwk/algorithms/oct/oct.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 AES JSON Web Encryption Key Wrap Algorithm.
*/
declare class AESKeyWrapAlgorithm extends JsonWebEncryptionKeyWrapAlgorithm {
/**
* Size of the Content Encryption Key in bits.
*/
private readonly keySize;
/**
* Name of the Cipher Algorithm.
*/
private readonly cipherAlgorithm;
/**
* Instantiates a new JSON Web Encryption AES Key Wrap Algorithm to Wrap and Unwrap Content Encryption Keys.
*
* @param algorithm Name of the JSON Web Encryption Key Wrap Algorithm.
*/
constructor(algorithm: SupportedJsonWebEncryptionKeyWrapAlgorithm);
/**
* 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: OctKey): 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: OctKey, ek: Buffer): Promise<Buffer>;
/**
* Checks if the provided JSON Web Key can be used by the requesting JSON Web Encryption AES Key Wrap Algorithm.
*
* @param key JSON Web Key to be checked.
* @throws {InvalidJsonWebKeyException} The provided JSON Web Key is invalid.
*/
protected validateJsonWebKey(key: OctKey): void;
}
/**
* AES Key Wrap with default initial value using 128-bit key.
*/
export declare const A128KW: AESKeyWrapAlgorithm;
/**
* AES Key Wrap with default initial value using 192-bit key.
*/
export declare const A192KW: AESKeyWrapAlgorithm;
/**
* AES Key Wrap with default initial value using 256-bit key.
*/
export declare const A256KW: AESKeyWrapAlgorithm;
export {};