/** * webapi.js */ import { HashTypes, ModulusLength, RSASignAlgorithm } from './typedef'; /** * Generate RSA public/private key pair. * @param {Number} modulusLength - Modulus length in bits, i.e., n. * @param {Uint8Array} publicExponent - Public exponent, i.e, e. * @param {Object} webCrypto - WebCryptoSubtle object, i.e., window.crypto.subtle * @return {Promise<{publicKey: JsonWebKey, privateKey: JsonWebKey}>} */ export declare const generateKey: (modulusLength: ModulusLength, publicExponent: Uint8Array, webCrypto: any) => Promise<{ publicKey: JsonWebKey; privateKey: JsonWebKey; }>; /** * RSA signing via RSA-PSS or RSASSA-PKCS1-v1_5 in WebAPI. * @param {Uint8Array} msg - Byte array of message to be signed. * @param {JsonWebKey} privateJwk - Private key for signing in JWK format. * @param {String} hash - Name of hash algorithm like 'SHA-256'. * @param {RSASignAlgorithm} algorithm - Object to specify algorithm parameters. * @param {Object} webCrypto - WebCryptoSubtle object * @return {Promise} - Byte array of raw signature. * @throws {Error} - if RSA-PSS in IE. */ export declare function signRsa(msg: Uint8Array, privateJwk: JsonWebKey, hash: HashTypes, algorithm: RSASignAlgorithm, webCrypto: any): Promise; /** * Verification of RSA signature via RSA-PSS or RSASSA-PKCS1-v1_5 in WebAPI. * @param {Uint8Array} msg - Byte array of message signed. * @param {Uint8Array} signature - Byte array of raw signature. * @param {JsonWebKey} publicJwk - public key for signing in JWK format. * @param {String} hash - Name of hash algorithm like 'SHA-256'. * @param {RSASignAlgorithm} algorithm - Object to specify algorithm parameters. * @param {Object} webCrypto - WebCryptoSubtle object * @return {Promise} - Result of verification. * @throws {Error} - if RSA-PSS in IE. */ export declare const verifyRsa: (msg: Uint8Array, signature: Uint8Array, publicJwk: JsonWebKey, hash: HashTypes, algorithm: RSASignAlgorithm, webCrypto: any) => Promise; /** * RSA Encryption via WebAPI. * @param {Uint8Array} msg - Byte array of message to be encrypted * @param {JsonWebKey} publicJwk - Public key in JWK format. * @param {String} hash - Name of hash algorithm like 'SHA-256' * @param {Uint8Array} label - RSA-OAEP label. * @param {Object} webCrypto - WebCryptoSubtle object * @return {Promise} - Encrypted message. * @throws {Error} - if RSA-OAEP label is specified in IE. */ export declare const encryptRsa: (msg: Uint8Array, publicJwk: JsonWebKey, hash: HashTypes, label: Uint8Array, webCrypto: any) => Promise; /** * RSA Decryption via WebAPI. * @param {Uint8Array} msg - encrypted message byte array. * @param {JsonWebKey} privateJwk - Private key in JWK format. * @param {String} hash - Name of hash algorithm like 'SHA-256' * @param {Uint8Array} label - RSA-OAEP label. * @param {Object} webCrypto - WebCryptoSubtle object. * @return {Promise} - Decrypted message. * @throws {Error} - if RSA-OAEP label is specified in IE. */ export declare const decryptRsa: (msg: Uint8Array, privateJwk: JsonWebKey, hash: HashTypes, label: Uint8Array, webCrypto: any) => Promise;