11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ciconst { 41cb0ef41Sopenharmony_ci ObjectSetPrototypeOf, 51cb0ef41Sopenharmony_ci ReflectApply, 61cb0ef41Sopenharmony_ci StringPrototypeToLowerCase, 71cb0ef41Sopenharmony_ci} = primordials; 81cb0ef41Sopenharmony_ci 91cb0ef41Sopenharmony_ciconst { 101cb0ef41Sopenharmony_ci CipherBase, 111cb0ef41Sopenharmony_ci privateDecrypt: _privateDecrypt, 121cb0ef41Sopenharmony_ci privateEncrypt: _privateEncrypt, 131cb0ef41Sopenharmony_ci publicDecrypt: _publicDecrypt, 141cb0ef41Sopenharmony_ci publicEncrypt: _publicEncrypt, 151cb0ef41Sopenharmony_ci getCipherInfo: _getCipherInfo, 161cb0ef41Sopenharmony_ci} = internalBinding('crypto'); 171cb0ef41Sopenharmony_ci 181cb0ef41Sopenharmony_ciconst { 191cb0ef41Sopenharmony_ci crypto: { 201cb0ef41Sopenharmony_ci RSA_PKCS1_OAEP_PADDING, 211cb0ef41Sopenharmony_ci RSA_PKCS1_PADDING, 221cb0ef41Sopenharmony_ci }, 231cb0ef41Sopenharmony_ci} = internalBinding('constants'); 241cb0ef41Sopenharmony_ci 251cb0ef41Sopenharmony_ciconst { 261cb0ef41Sopenharmony_ci codes: { 271cb0ef41Sopenharmony_ci ERR_CRYPTO_INVALID_STATE, 281cb0ef41Sopenharmony_ci ERR_INVALID_ARG_TYPE, 291cb0ef41Sopenharmony_ci ERR_INVALID_ARG_VALUE, 301cb0ef41Sopenharmony_ci ERR_UNKNOWN_ENCODING, 311cb0ef41Sopenharmony_ci }, 321cb0ef41Sopenharmony_ci} = require('internal/errors'); 331cb0ef41Sopenharmony_ci 341cb0ef41Sopenharmony_ciconst { 351cb0ef41Sopenharmony_ci validateEncoding, 361cb0ef41Sopenharmony_ci validateInt32, 371cb0ef41Sopenharmony_ci validateObject, 381cb0ef41Sopenharmony_ci validateString, 391cb0ef41Sopenharmony_ci} = require('internal/validators'); 401cb0ef41Sopenharmony_ci 411cb0ef41Sopenharmony_ciconst { 421cb0ef41Sopenharmony_ci preparePrivateKey, 431cb0ef41Sopenharmony_ci preparePublicOrPrivateKey, 441cb0ef41Sopenharmony_ci prepareSecretKey, 451cb0ef41Sopenharmony_ci} = require('internal/crypto/keys'); 461cb0ef41Sopenharmony_ci 471cb0ef41Sopenharmony_ciconst { 481cb0ef41Sopenharmony_ci getDefaultEncoding, 491cb0ef41Sopenharmony_ci getArrayBufferOrView, 501cb0ef41Sopenharmony_ci getStringOption, 511cb0ef41Sopenharmony_ci kHandle, 521cb0ef41Sopenharmony_ci} = require('internal/crypto/util'); 531cb0ef41Sopenharmony_ci 541cb0ef41Sopenharmony_ciconst { 551cb0ef41Sopenharmony_ci isArrayBufferView, 561cb0ef41Sopenharmony_ci} = require('internal/util/types'); 571cb0ef41Sopenharmony_ci 581cb0ef41Sopenharmony_ciconst assert = require('internal/assert'); 591cb0ef41Sopenharmony_ci 601cb0ef41Sopenharmony_ciconst LazyTransform = require('internal/streams/lazy_transform'); 611cb0ef41Sopenharmony_ci 621cb0ef41Sopenharmony_ciconst { normalizeEncoding } = require('internal/util'); 631cb0ef41Sopenharmony_ci 641cb0ef41Sopenharmony_ciconst { StringDecoder } = require('string_decoder'); 651cb0ef41Sopenharmony_ci 661cb0ef41Sopenharmony_cifunction rsaFunctionFor(method, defaultPadding, keyType) { 671cb0ef41Sopenharmony_ci return (options, buffer) => { 681cb0ef41Sopenharmony_ci const { format, type, data, passphrase } = 691cb0ef41Sopenharmony_ci keyType === 'private' ? 701cb0ef41Sopenharmony_ci preparePrivateKey(options) : 711cb0ef41Sopenharmony_ci preparePublicOrPrivateKey(options); 721cb0ef41Sopenharmony_ci const padding = options.padding || defaultPadding; 731cb0ef41Sopenharmony_ci const { oaepHash, encoding } = options; 741cb0ef41Sopenharmony_ci let { oaepLabel } = options; 751cb0ef41Sopenharmony_ci if (oaepHash !== undefined) 761cb0ef41Sopenharmony_ci validateString(oaepHash, 'key.oaepHash'); 771cb0ef41Sopenharmony_ci if (oaepLabel !== undefined) 781cb0ef41Sopenharmony_ci oaepLabel = getArrayBufferOrView(oaepLabel, 'key.oaepLabel', encoding); 791cb0ef41Sopenharmony_ci buffer = getArrayBufferOrView(buffer, 'buffer', encoding); 801cb0ef41Sopenharmony_ci return method(data, format, type, passphrase, buffer, padding, oaepHash, 811cb0ef41Sopenharmony_ci oaepLabel); 821cb0ef41Sopenharmony_ci }; 831cb0ef41Sopenharmony_ci} 841cb0ef41Sopenharmony_ci 851cb0ef41Sopenharmony_ciconst publicEncrypt = rsaFunctionFor(_publicEncrypt, RSA_PKCS1_OAEP_PADDING, 861cb0ef41Sopenharmony_ci 'public'); 871cb0ef41Sopenharmony_ciconst publicDecrypt = rsaFunctionFor(_publicDecrypt, RSA_PKCS1_PADDING, 881cb0ef41Sopenharmony_ci 'public'); 891cb0ef41Sopenharmony_ciconst privateEncrypt = rsaFunctionFor(_privateEncrypt, RSA_PKCS1_PADDING, 901cb0ef41Sopenharmony_ci 'private'); 911cb0ef41Sopenharmony_ciconst privateDecrypt = rsaFunctionFor(_privateDecrypt, RSA_PKCS1_OAEP_PADDING, 921cb0ef41Sopenharmony_ci 'private'); 931cb0ef41Sopenharmony_ci 941cb0ef41Sopenharmony_cifunction getDecoder(decoder, encoding) { 951cb0ef41Sopenharmony_ci const normalizedEncoding = normalizeEncoding(encoding); 961cb0ef41Sopenharmony_ci decoder = decoder || new StringDecoder(encoding); 971cb0ef41Sopenharmony_ci if (decoder.encoding !== normalizedEncoding) { 981cb0ef41Sopenharmony_ci if (normalizedEncoding === undefined) { 991cb0ef41Sopenharmony_ci throw new ERR_UNKNOWN_ENCODING(encoding); 1001cb0ef41Sopenharmony_ci } 1011cb0ef41Sopenharmony_ci assert(false, 'Cannot change encoding'); 1021cb0ef41Sopenharmony_ci } 1031cb0ef41Sopenharmony_ci return decoder; 1041cb0ef41Sopenharmony_ci} 1051cb0ef41Sopenharmony_ci 1061cb0ef41Sopenharmony_cifunction getUIntOption(options, key) { 1071cb0ef41Sopenharmony_ci let value; 1081cb0ef41Sopenharmony_ci if (options && (value = options[key]) != null) { 1091cb0ef41Sopenharmony_ci if (value >>> 0 !== value) 1101cb0ef41Sopenharmony_ci throw new ERR_INVALID_ARG_VALUE(`options.${key}`, value); 1111cb0ef41Sopenharmony_ci return value; 1121cb0ef41Sopenharmony_ci } 1131cb0ef41Sopenharmony_ci return -1; 1141cb0ef41Sopenharmony_ci} 1151cb0ef41Sopenharmony_ci 1161cb0ef41Sopenharmony_cifunction createCipherBase(cipher, credential, options, decipher, iv) { 1171cb0ef41Sopenharmony_ci const authTagLength = getUIntOption(options, 'authTagLength'); 1181cb0ef41Sopenharmony_ci this[kHandle] = new CipherBase(decipher); 1191cb0ef41Sopenharmony_ci if (iv === undefined) { 1201cb0ef41Sopenharmony_ci this[kHandle].init(cipher, credential, authTagLength); 1211cb0ef41Sopenharmony_ci } else { 1221cb0ef41Sopenharmony_ci this[kHandle].initiv(cipher, credential, iv, authTagLength); 1231cb0ef41Sopenharmony_ci } 1241cb0ef41Sopenharmony_ci this._decoder = null; 1251cb0ef41Sopenharmony_ci 1261cb0ef41Sopenharmony_ci ReflectApply(LazyTransform, this, [options]); 1271cb0ef41Sopenharmony_ci} 1281cb0ef41Sopenharmony_ci 1291cb0ef41Sopenharmony_cifunction createCipher(cipher, password, options, decipher) { 1301cb0ef41Sopenharmony_ci validateString(cipher, 'cipher'); 1311cb0ef41Sopenharmony_ci password = getArrayBufferOrView(password, 'password'); 1321cb0ef41Sopenharmony_ci 1331cb0ef41Sopenharmony_ci ReflectApply(createCipherBase, this, [cipher, password, options, decipher]); 1341cb0ef41Sopenharmony_ci} 1351cb0ef41Sopenharmony_ci 1361cb0ef41Sopenharmony_cifunction createCipherWithIV(cipher, key, options, decipher, iv) { 1371cb0ef41Sopenharmony_ci validateString(cipher, 'cipher'); 1381cb0ef41Sopenharmony_ci const encoding = getStringOption(options, 'encoding'); 1391cb0ef41Sopenharmony_ci key = prepareSecretKey(key, encoding); 1401cb0ef41Sopenharmony_ci iv = iv === null ? null : getArrayBufferOrView(iv, 'iv'); 1411cb0ef41Sopenharmony_ci ReflectApply(createCipherBase, this, [cipher, key, options, decipher, iv]); 1421cb0ef41Sopenharmony_ci} 1431cb0ef41Sopenharmony_ci 1441cb0ef41Sopenharmony_ci// The Cipher class is part of the legacy Node.js crypto API. It exposes 1451cb0ef41Sopenharmony_ci// a stream-based encryption/decryption model. For backwards compatibility 1461cb0ef41Sopenharmony_ci// the Cipher class is defined using the legacy function syntax rather than 1471cb0ef41Sopenharmony_ci// ES6 classes. 1481cb0ef41Sopenharmony_ci 1491cb0ef41Sopenharmony_cifunction Cipher(cipher, password, options) { 1501cb0ef41Sopenharmony_ci if (!(this instanceof Cipher)) 1511cb0ef41Sopenharmony_ci return new Cipher(cipher, password, options); 1521cb0ef41Sopenharmony_ci 1531cb0ef41Sopenharmony_ci ReflectApply(createCipher, this, [cipher, password, options, true]); 1541cb0ef41Sopenharmony_ci} 1551cb0ef41Sopenharmony_ci 1561cb0ef41Sopenharmony_ciObjectSetPrototypeOf(Cipher.prototype, LazyTransform.prototype); 1571cb0ef41Sopenharmony_ciObjectSetPrototypeOf(Cipher, LazyTransform); 1581cb0ef41Sopenharmony_ci 1591cb0ef41Sopenharmony_ciCipher.prototype._transform = function _transform(chunk, encoding, callback) { 1601cb0ef41Sopenharmony_ci this.push(this[kHandle].update(chunk, encoding)); 1611cb0ef41Sopenharmony_ci callback(); 1621cb0ef41Sopenharmony_ci}; 1631cb0ef41Sopenharmony_ci 1641cb0ef41Sopenharmony_ciCipher.prototype._flush = function _flush(callback) { 1651cb0ef41Sopenharmony_ci try { 1661cb0ef41Sopenharmony_ci this.push(this[kHandle].final()); 1671cb0ef41Sopenharmony_ci } catch (e) { 1681cb0ef41Sopenharmony_ci callback(e); 1691cb0ef41Sopenharmony_ci return; 1701cb0ef41Sopenharmony_ci } 1711cb0ef41Sopenharmony_ci callback(); 1721cb0ef41Sopenharmony_ci}; 1731cb0ef41Sopenharmony_ci 1741cb0ef41Sopenharmony_ciCipher.prototype.update = function update(data, inputEncoding, outputEncoding) { 1751cb0ef41Sopenharmony_ci const encoding = getDefaultEncoding(); 1761cb0ef41Sopenharmony_ci inputEncoding = inputEncoding || encoding; 1771cb0ef41Sopenharmony_ci outputEncoding = outputEncoding || encoding; 1781cb0ef41Sopenharmony_ci 1791cb0ef41Sopenharmony_ci if (typeof data === 'string') { 1801cb0ef41Sopenharmony_ci validateEncoding(data, inputEncoding); 1811cb0ef41Sopenharmony_ci } else if (!isArrayBufferView(data)) { 1821cb0ef41Sopenharmony_ci throw new ERR_INVALID_ARG_TYPE( 1831cb0ef41Sopenharmony_ci 'data', ['string', 'Buffer', 'TypedArray', 'DataView'], data); 1841cb0ef41Sopenharmony_ci } 1851cb0ef41Sopenharmony_ci 1861cb0ef41Sopenharmony_ci const ret = this[kHandle].update(data, inputEncoding); 1871cb0ef41Sopenharmony_ci 1881cb0ef41Sopenharmony_ci if (outputEncoding && outputEncoding !== 'buffer') { 1891cb0ef41Sopenharmony_ci this._decoder = getDecoder(this._decoder, outputEncoding); 1901cb0ef41Sopenharmony_ci return this._decoder.write(ret); 1911cb0ef41Sopenharmony_ci } 1921cb0ef41Sopenharmony_ci 1931cb0ef41Sopenharmony_ci return ret; 1941cb0ef41Sopenharmony_ci}; 1951cb0ef41Sopenharmony_ci 1961cb0ef41Sopenharmony_ci 1971cb0ef41Sopenharmony_ciCipher.prototype.final = function final(outputEncoding) { 1981cb0ef41Sopenharmony_ci outputEncoding = outputEncoding || getDefaultEncoding(); 1991cb0ef41Sopenharmony_ci const ret = this[kHandle].final(); 2001cb0ef41Sopenharmony_ci 2011cb0ef41Sopenharmony_ci if (outputEncoding && outputEncoding !== 'buffer') { 2021cb0ef41Sopenharmony_ci this._decoder = getDecoder(this._decoder, outputEncoding); 2031cb0ef41Sopenharmony_ci return this._decoder.end(ret); 2041cb0ef41Sopenharmony_ci } 2051cb0ef41Sopenharmony_ci 2061cb0ef41Sopenharmony_ci return ret; 2071cb0ef41Sopenharmony_ci}; 2081cb0ef41Sopenharmony_ci 2091cb0ef41Sopenharmony_ci 2101cb0ef41Sopenharmony_ciCipher.prototype.setAutoPadding = function setAutoPadding(ap) { 2111cb0ef41Sopenharmony_ci if (!this[kHandle].setAutoPadding(!!ap)) 2121cb0ef41Sopenharmony_ci throw new ERR_CRYPTO_INVALID_STATE('setAutoPadding'); 2131cb0ef41Sopenharmony_ci return this; 2141cb0ef41Sopenharmony_ci}; 2151cb0ef41Sopenharmony_ci 2161cb0ef41Sopenharmony_ciCipher.prototype.getAuthTag = function getAuthTag() { 2171cb0ef41Sopenharmony_ci const ret = this[kHandle].getAuthTag(); 2181cb0ef41Sopenharmony_ci if (ret === undefined) 2191cb0ef41Sopenharmony_ci throw new ERR_CRYPTO_INVALID_STATE('getAuthTag'); 2201cb0ef41Sopenharmony_ci return ret; 2211cb0ef41Sopenharmony_ci}; 2221cb0ef41Sopenharmony_ci 2231cb0ef41Sopenharmony_ci 2241cb0ef41Sopenharmony_cifunction setAuthTag(tagbuf, encoding) { 2251cb0ef41Sopenharmony_ci tagbuf = getArrayBufferOrView(tagbuf, 'buffer', encoding); 2261cb0ef41Sopenharmony_ci if (!this[kHandle].setAuthTag(tagbuf)) 2271cb0ef41Sopenharmony_ci throw new ERR_CRYPTO_INVALID_STATE('setAuthTag'); 2281cb0ef41Sopenharmony_ci return this; 2291cb0ef41Sopenharmony_ci} 2301cb0ef41Sopenharmony_ci 2311cb0ef41Sopenharmony_ciCipher.prototype.setAAD = function setAAD(aadbuf, options) { 2321cb0ef41Sopenharmony_ci const encoding = getStringOption(options, 'encoding'); 2331cb0ef41Sopenharmony_ci const plaintextLength = getUIntOption(options, 'plaintextLength'); 2341cb0ef41Sopenharmony_ci aadbuf = getArrayBufferOrView(aadbuf, 'aadbuf', encoding); 2351cb0ef41Sopenharmony_ci if (!this[kHandle].setAAD(aadbuf, plaintextLength)) 2361cb0ef41Sopenharmony_ci throw new ERR_CRYPTO_INVALID_STATE('setAAD'); 2371cb0ef41Sopenharmony_ci return this; 2381cb0ef41Sopenharmony_ci}; 2391cb0ef41Sopenharmony_ci 2401cb0ef41Sopenharmony_ci// The Cipheriv class is part of the legacy Node.js crypto API. It exposes 2411cb0ef41Sopenharmony_ci// a stream-based encryption/decryption model. For backwards compatibility 2421cb0ef41Sopenharmony_ci// the Cipheriv class is defined using the legacy function syntax rather than 2431cb0ef41Sopenharmony_ci// ES6 classes. 2441cb0ef41Sopenharmony_ci 2451cb0ef41Sopenharmony_cifunction Cipheriv(cipher, key, iv, options) { 2461cb0ef41Sopenharmony_ci if (!(this instanceof Cipheriv)) 2471cb0ef41Sopenharmony_ci return new Cipheriv(cipher, key, iv, options); 2481cb0ef41Sopenharmony_ci 2491cb0ef41Sopenharmony_ci ReflectApply(createCipherWithIV, this, [cipher, key, options, true, iv]); 2501cb0ef41Sopenharmony_ci} 2511cb0ef41Sopenharmony_ci 2521cb0ef41Sopenharmony_cifunction addCipherPrototypeFunctions(constructor) { 2531cb0ef41Sopenharmony_ci constructor.prototype._transform = Cipher.prototype._transform; 2541cb0ef41Sopenharmony_ci constructor.prototype._flush = Cipher.prototype._flush; 2551cb0ef41Sopenharmony_ci constructor.prototype.update = Cipher.prototype.update; 2561cb0ef41Sopenharmony_ci constructor.prototype.final = Cipher.prototype.final; 2571cb0ef41Sopenharmony_ci constructor.prototype.setAutoPadding = Cipher.prototype.setAutoPadding; 2581cb0ef41Sopenharmony_ci if (constructor === Cipheriv) { 2591cb0ef41Sopenharmony_ci constructor.prototype.getAuthTag = Cipher.prototype.getAuthTag; 2601cb0ef41Sopenharmony_ci } else { 2611cb0ef41Sopenharmony_ci constructor.prototype.setAuthTag = setAuthTag; 2621cb0ef41Sopenharmony_ci } 2631cb0ef41Sopenharmony_ci constructor.prototype.setAAD = Cipher.prototype.setAAD; 2641cb0ef41Sopenharmony_ci} 2651cb0ef41Sopenharmony_ci 2661cb0ef41Sopenharmony_ciObjectSetPrototypeOf(Cipheriv.prototype, LazyTransform.prototype); 2671cb0ef41Sopenharmony_ciObjectSetPrototypeOf(Cipheriv, LazyTransform); 2681cb0ef41Sopenharmony_ciaddCipherPrototypeFunctions(Cipheriv); 2691cb0ef41Sopenharmony_ci 2701cb0ef41Sopenharmony_ci// The Decipher class is part of the legacy Node.js crypto API. It exposes 2711cb0ef41Sopenharmony_ci// a stream-based encryption/decryption model. For backwards compatibility 2721cb0ef41Sopenharmony_ci// the Decipher class is defined using the legacy function syntax rather than 2731cb0ef41Sopenharmony_ci// ES6 classes. 2741cb0ef41Sopenharmony_ci 2751cb0ef41Sopenharmony_cifunction Decipher(cipher, password, options) { 2761cb0ef41Sopenharmony_ci if (!(this instanceof Decipher)) 2771cb0ef41Sopenharmony_ci return new Decipher(cipher, password, options); 2781cb0ef41Sopenharmony_ci 2791cb0ef41Sopenharmony_ci ReflectApply(createCipher, this, [cipher, password, options, false]); 2801cb0ef41Sopenharmony_ci} 2811cb0ef41Sopenharmony_ci 2821cb0ef41Sopenharmony_ciObjectSetPrototypeOf(Decipher.prototype, LazyTransform.prototype); 2831cb0ef41Sopenharmony_ciObjectSetPrototypeOf(Decipher, LazyTransform); 2841cb0ef41Sopenharmony_ciaddCipherPrototypeFunctions(Decipher); 2851cb0ef41Sopenharmony_ci 2861cb0ef41Sopenharmony_ci// The Decipheriv class is part of the legacy Node.js crypto API. It exposes 2871cb0ef41Sopenharmony_ci// a stream-based encryption/decryption model. For backwards compatibility 2881cb0ef41Sopenharmony_ci// the Decipheriv class is defined using the legacy function syntax rather than 2891cb0ef41Sopenharmony_ci// ES6 classes. 2901cb0ef41Sopenharmony_ci 2911cb0ef41Sopenharmony_cifunction Decipheriv(cipher, key, iv, options) { 2921cb0ef41Sopenharmony_ci if (!(this instanceof Decipheriv)) 2931cb0ef41Sopenharmony_ci return new Decipheriv(cipher, key, iv, options); 2941cb0ef41Sopenharmony_ci 2951cb0ef41Sopenharmony_ci ReflectApply(createCipherWithIV, this, [cipher, key, options, false, iv]); 2961cb0ef41Sopenharmony_ci} 2971cb0ef41Sopenharmony_ci 2981cb0ef41Sopenharmony_ciObjectSetPrototypeOf(Decipheriv.prototype, LazyTransform.prototype); 2991cb0ef41Sopenharmony_ciObjectSetPrototypeOf(Decipheriv, LazyTransform); 3001cb0ef41Sopenharmony_ciaddCipherPrototypeFunctions(Decipheriv); 3011cb0ef41Sopenharmony_ci 3021cb0ef41Sopenharmony_cifunction getCipherInfo(nameOrNid, options) { 3031cb0ef41Sopenharmony_ci if (typeof nameOrNid !== 'string' && typeof nameOrNid !== 'number') { 3041cb0ef41Sopenharmony_ci throw new ERR_INVALID_ARG_TYPE( 3051cb0ef41Sopenharmony_ci 'nameOrNid', 3061cb0ef41Sopenharmony_ci ['string', 'number'], 3071cb0ef41Sopenharmony_ci nameOrNid); 3081cb0ef41Sopenharmony_ci } 3091cb0ef41Sopenharmony_ci if (typeof nameOrNid === 'number') 3101cb0ef41Sopenharmony_ci validateInt32(nameOrNid, 'nameOrNid'); 3111cb0ef41Sopenharmony_ci let keyLength, ivLength; 3121cb0ef41Sopenharmony_ci if (options !== undefined) { 3131cb0ef41Sopenharmony_ci validateObject(options, 'options'); 3141cb0ef41Sopenharmony_ci ({ keyLength, ivLength } = options); 3151cb0ef41Sopenharmony_ci if (keyLength !== undefined) 3161cb0ef41Sopenharmony_ci validateInt32(keyLength, 'options.keyLength'); 3171cb0ef41Sopenharmony_ci if (ivLength !== undefined) 3181cb0ef41Sopenharmony_ci validateInt32(ivLength, 'options.ivLength'); 3191cb0ef41Sopenharmony_ci } 3201cb0ef41Sopenharmony_ci 3211cb0ef41Sopenharmony_ci const ret = _getCipherInfo({}, nameOrNid, keyLength, ivLength); 3221cb0ef41Sopenharmony_ci if (ret !== undefined) { 3231cb0ef41Sopenharmony_ci if (ret.name) ret.name = StringPrototypeToLowerCase(ret.name); 3241cb0ef41Sopenharmony_ci if (ret.type) ret.type = StringPrototypeToLowerCase(ret.type); 3251cb0ef41Sopenharmony_ci } 3261cb0ef41Sopenharmony_ci return ret; 3271cb0ef41Sopenharmony_ci} 3281cb0ef41Sopenharmony_ci 3291cb0ef41Sopenharmony_cimodule.exports = { 3301cb0ef41Sopenharmony_ci Cipher, 3311cb0ef41Sopenharmony_ci Cipheriv, 3321cb0ef41Sopenharmony_ci Decipher, 3331cb0ef41Sopenharmony_ci Decipheriv, 3341cb0ef41Sopenharmony_ci privateDecrypt, 3351cb0ef41Sopenharmony_ci privateEncrypt, 3361cb0ef41Sopenharmony_ci publicDecrypt, 3371cb0ef41Sopenharmony_ci publicEncrypt, 3381cb0ef41Sopenharmony_ci getCipherInfo, 3391cb0ef41Sopenharmony_ci}; 340