UNPKG

@guarani/jose

Version:

Implementation of the RFCs of the JOSE Working Group.

63 lines (62 loc) 2.43 kB
/// <reference types="node" /> import { RsaPadding } from '../../jwk/algorithms/rsa/types/rsa-padding'; import { RsaKey } from '../../jwk/algorithms/rsa/rsa.key'; import { JsonWebSignatureAlgorithm } from './jsonwebsignature.algorithm'; import { SupportedJsonWebSignatureAlgorithm } from './types/supported-jsonwebsignature-algorithm'; /** * Implementation of the JSON Web Signature RSASSA Algorithm. */ export declare class RsaSsaAlgorithm extends JsonWebSignatureAlgorithm { /** * RSA Padding used by the JSON Web Signature RSASSA Algorithm to Sign and Verify the Messages. */ protected readonly padding: RsaPadding; /** * Instantiates a new JSON Web Signature RSASSA Algorithm to Sign and Verify the Messages. * * @param hash Hash Algorithm used to Sign and Verify the Messages. * @param algorithm Name of the JSON Web Signature Algorithm. * @param padding RSA Padding used by the JSON Web Signature RSASSA Algorithm to Sign and Verify the Messages. */ constructor(hash: string, algorithm: SupportedJsonWebSignatureAlgorithm, padding: RsaPadding); /** * 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: RsaKey): 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: RsaKey): 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;