UNPKG

@unvision/jose

Version:

Implementation of the RFCs of the JOSE Working Group.

63 lines (62 loc) 2.33 kB
/// <reference types="node" /> import { JsonWebKey } from '../../jwk/jsonwebkey'; import { JsonWebSignatureAlgorithm } from './jsonwebsignature.algorithm'; import { SupportedJsonWebSignatureAlgorithm } from './types/supported-jsonwebsignature-algorithm'; /** * Implementation of the JSON Web Signature RSASSA Algorithm. */ declare class RsaSsaAlgorithm extends JsonWebSignatureAlgorithm { /** * RSA Padding used by the JSON Web Signature RSASSA Algorithm to Sign and Verify Messages. */ protected readonly padding: number; /** * Instantiates a new JSON Web Signature RSASSA Algorithm to Sign and Verify Messages. * * @param algorithm Name of the JSON Web Signature Algorithm. * @param hash Hash Algorithm used to Sign and Verify Messages. * @param padding RSA Padding used by the JSON Web Signature RSASSA Algorithm to Sign and Verify Messages. */ constructor(algorithm: SupportedJsonWebSignatureAlgorithm, hash: string, padding: number); /** * Signs a Message with the provided JSON Web Key. * * @param message Message to be Signed. * @param key JSON Web Key used to Sign the provided Message. * @returns Resulting Signature of the provided Message. */ sign(message: Buffer, key: JsonWebKey): Promise<Buffer>; /** * Checks if the provided Signature matches the provided Message based on the provide JSON Web Key. * * @param signature Signature to be matched against the provided Message. * @param message Message to be matched against the provided Signature. * @param key JSON Web Key used to verify the Signature and Message. */ verify(signature: Buffer, message: Buffer, key: JsonWebKey): Promise<void>; } /** * RSASSA-PKCS1-v1_5 using SHA-256. */ export declare const RS256: RsaSsaAlgorithm; /** * RSASSA-PKCS1-v1_5 using SHA-384. */ export declare const RS384: RsaSsaAlgorithm; /** * RSASSA-PKCS1-v1_5 using SHA-512. */ export declare const RS512: RsaSsaAlgorithm; /** * RSASSA-PSS using SHA-256 and MGF1 with SHA-256. */ export declare const PS256: RsaSsaAlgorithm; /** * RSASSA-PSS using SHA-384 and MGF1 with SHA-384. */ export declare const PS384: RsaSsaAlgorithm; /** * RSASSA-PSS using SHA-512 and MGF1 with SHA-512. */ export declare const PS512: RsaSsaAlgorithm; export {};