/** * nodeapi */ import { HashTypes, JsonWebKeyPair, 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} nodeCrypto - NodeCrypto object. * @return {Promise<{publicKey: JsonWebKey, privateKey: JsonWebKey}>} * @throws {Error} - Throws if KeyGenerationFailedNode. */ export declare const generateKey: (modulusLength: ModulusLength, publicExponent: Uint8Array, nodeCrypto: any) => Promise; /** * RSA signing via RSA-PSS or RSASSA-PKCS1-v1_5 in Node.js. * @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 {Object} algorithm - Object to specify algorithm parameters. * @param {Object} nodeCrypto - NodeCrypto object * @return {Promise} - Byte array of raw signature. * @throws {Error} - Throws if NotPublicKeyForRSASign. */ export declare const signRsa: (msg: Uint8Array, privateJwk: JsonWebKey, hash: HashTypes, algorithm: RSASignAlgorithm, nodeCrypto: any) => Promise; /** /** * Verification of RSA signature via RSA-PSS or RSASSA-PKCS1-v1_5 in Node.js. * @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 {Object} algorithm - Object to specify algorithm parameters. * @param {Object} nodeCrypto - NodeCrypto object * @return {Promise} - Result of verification. * @throws {Error} - Throws if NotPublicKeyForRSAVerify. */ export declare const verifyRsa: (msg: Uint8Array, signature: Uint8Array, publicJwk: JsonWebKey, hash: HashTypes, algorithm: RSASignAlgorithm, nodeCrypto: any) => Promise; /** * RSA Encryption via NodeCrypto. * @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} nodeCrypto - NodeCrypto object. * @return {Promise} - Encrypted message. * @throws {Error} - Throws if NotPublicKeyForRSAEncrypt. */ export declare const encryptRsa: (msg: Uint8Array, publicJwk: JsonWebKey, hash: HashTypes | undefined, label: Uint8Array | undefined, nodeCrypto: any) => Promise; /** * RSA Decryption via NodeCrypto. * @param {Uint8Array} data - 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} nodeCrypto - NodeCrypto object. * @return {Promise} - Decrypted message. * @throws {Error} - Throws if NotPrivateKeyForRSADecrypt. */ export declare const decryptRsa: (data: Uint8Array, privateJwk: JsonWebKey, hash: HashTypes | undefined, label: Uint8Array | undefined, nodeCrypto: any) => Promise;