@guarani/jose
Version:
Implementation of the RFCs of the JOSE Working Group.
73 lines (72 loc) • 3.11 kB
TypeScript
/// <reference types="node" />
import { OctKey } from '../../../jwk/algorithms/oct/oct.key';
import { JsonWebEncryptionContentEncryptionAlgorithm } from '../enc/jsonwebencryption-contentencryption.algorithm';
import { JsonWebEncryptionKeyWrapAlgorithm } from './jsonwebencryption-keywrap.algorithm';
import { AesGcmWrappedKeyParams } from './types/aes-gcm-wrapped-key.params';
import { SupportedJsonWebEncryptionKeyWrapAlgorithm } from './types/supported-jsonwebencryption-keyencryption-algorithm';
import { WrappedKey } from './types/wrapped-key';
/**
* Implementation of the AES-GCM JSON Web Encryption Key Wrap Algorithm.
*/
declare class AESGCMKeyWrapAlgorithm extends JsonWebEncryptionKeyWrapAlgorithm {
/**
* Size of the Initialization Vector in bits.
*/
private readonly ivSize;
/**
* Size of the Authentication Tag in bytes.
*/
private readonly authTagLength;
/**
* 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-GCM 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<AesGcmWrappedKeyParams>>;
/**
* 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.
* @param header JSON Web Encryption Header containing the additional Parameters.
* @returns Unwrapped Content Encryption Key.
*/
unwrap(enc: JsonWebEncryptionContentEncryptionAlgorithm, key: OctKey, ek: Buffer, header: AesGcmWrappedKeyParams): Promise<Buffer>;
/**
* Checks if the provided JSON Web Key can be used by the requesting JSON Web Encryption AES-GCM 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;
}
/**
* Key wrapping with AES GCM using 128-bit key.
*/
export declare const A128GCMKW: AESGCMKeyWrapAlgorithm;
/**
* Key wrapping with AES GCM using 192-bit key.
*/
export declare const A192GCMKW: AESGCMKeyWrapAlgorithm;
/**
* Key wrapping with AES GCM using 256-bit key.
*/
export declare const A256GCMKW: AESGCMKeyWrapAlgorithm;
export {};