@easyv/biz-components 0.0.30 → 0.0.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/_commonjsHelpers.es.js +0 -25
- package/dist/_virtual/_commonjsHelpers.es.js.map +1 -1
- package/dist/_virtual/index.es2.js +2 -2
- package/dist/_virtual/index.es3.js +2 -2
- package/dist/_virtual/index.es4.js +2 -2
- package/dist/_virtual/index.es5.js +2 -2
- package/dist/_virtual/index.es6.js +2 -2
- package/dist/node_modules/.pnpm/classnames@2.3.2/node_modules/classnames/index.es.js +1 -1
- package/dist/node_modules/.pnpm/co-web-worker@1.0.1/node_modules/co-web-worker/index.es.js +1 -1
- package/dist/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/index.es.js +1 -1
- package/dist/node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/index.es.js +1 -1
- package/dist/node_modules/.pnpm/style-to-js@1.1.16/node_modules/style-to-js/cjs/index.es.js +1 -1
- package/dist/node_modules/.pnpm/style-to-object@1.0.8/node_modules/style-to-object/cjs/index.es.js +1 -1
- package/dist/utils/xunFeiVoice/RecorderManager/RecorderManager.es.js +1 -15
- package/dist/utils/xunFeiVoice/RecorderManager/RecorderManager.es.js.map +1 -1
- package/dist/utils/xunFeiVoice/XFStreamVoiceManager.d.ts +12 -4
- package/dist/utils/xunFeiVoice/XFStreamVoiceManager.es.js +39 -26
- package/dist/utils/xunFeiVoice/XFStreamVoiceManager.es.js.map +1 -1
- package/dist/utils/xunFeiVoice/utils.d.ts +15 -0
- package/dist/utils/xunFeiVoice/utils.es.js +28 -0
- package/dist/utils/xunFeiVoice/utils.es.js.map +1 -1
- package/package.json +1 -1
- package/dist/_virtual/___vite-browser-external.es.js +0 -7
- package/dist/_virtual/___vite-browser-external.es.js.map +0 -1
- package/dist/_virtual/__vite-browser-external.es.js +0 -5
- package/dist/_virtual/__vite-browser-external.es.js.map +0 -1
- package/dist/_virtual/_commonjs-dynamic-modules.es.js +0 -7
- package/dist/_virtual/_commonjs-dynamic-modules.es.js.map +0 -1
- package/dist/_virtual/aes.es.js +0 -5
- package/dist/_virtual/aes.es.js.map +0 -1
- package/dist/_virtual/blowfish.es.js +0 -5
- package/dist/_virtual/blowfish.es.js.map +0 -1
- package/dist/_virtual/cipher-core.es.js +0 -5
- package/dist/_virtual/cipher-core.es.js.map +0 -1
- package/dist/_virtual/core.es.js +0 -5
- package/dist/_virtual/core.es.js.map +0 -1
- package/dist/_virtual/enc-base64.es.js +0 -5
- package/dist/_virtual/enc-base64.es.js.map +0 -1
- package/dist/_virtual/enc-base64url.es.js +0 -5
- package/dist/_virtual/enc-base64url.es.js.map +0 -1
- package/dist/_virtual/enc-utf16.es.js +0 -5
- package/dist/_virtual/enc-utf16.es.js.map +0 -1
- package/dist/_virtual/evpkdf.es.js +0 -5
- package/dist/_virtual/evpkdf.es.js.map +0 -1
- package/dist/_virtual/format-hex.es.js +0 -5
- package/dist/_virtual/format-hex.es.js.map +0 -1
- package/dist/_virtual/hmac.es.js +0 -5
- package/dist/_virtual/hmac.es.js.map +0 -1
- package/dist/_virtual/index.es7.js +0 -5
- package/dist/_virtual/index.es7.js.map +0 -1
- package/dist/_virtual/lib-typedarrays.es.js +0 -5
- package/dist/_virtual/lib-typedarrays.es.js.map +0 -1
- package/dist/_virtual/md5.es.js +0 -5
- package/dist/_virtual/md5.es.js.map +0 -1
- package/dist/_virtual/mode-cfb.es.js +0 -5
- package/dist/_virtual/mode-cfb.es.js.map +0 -1
- package/dist/_virtual/mode-ctr-gladman.es.js +0 -5
- package/dist/_virtual/mode-ctr-gladman.es.js.map +0 -1
- package/dist/_virtual/mode-ctr.es.js +0 -5
- package/dist/_virtual/mode-ctr.es.js.map +0 -1
- package/dist/_virtual/mode-ecb.es.js +0 -5
- package/dist/_virtual/mode-ecb.es.js.map +0 -1
- package/dist/_virtual/mode-ofb.es.js +0 -5
- package/dist/_virtual/mode-ofb.es.js.map +0 -1
- package/dist/_virtual/pad-ansix923.es.js +0 -5
- package/dist/_virtual/pad-ansix923.es.js.map +0 -1
- package/dist/_virtual/pad-iso10126.es.js +0 -5
- package/dist/_virtual/pad-iso10126.es.js.map +0 -1
- package/dist/_virtual/pad-iso97971.es.js +0 -5
- package/dist/_virtual/pad-iso97971.es.js.map +0 -1
- package/dist/_virtual/pad-nopadding.es.js +0 -5
- package/dist/_virtual/pad-nopadding.es.js.map +0 -1
- package/dist/_virtual/pad-zeropadding.es.js +0 -5
- package/dist/_virtual/pad-zeropadding.es.js.map +0 -1
- package/dist/_virtual/pbkdf2.es.js +0 -5
- package/dist/_virtual/pbkdf2.es.js.map +0 -1
- package/dist/_virtual/rabbit-legacy.es.js +0 -5
- package/dist/_virtual/rabbit-legacy.es.js.map +0 -1
- package/dist/_virtual/rabbit.es.js +0 -5
- package/dist/_virtual/rabbit.es.js.map +0 -1
- package/dist/_virtual/rc4.es.js +0 -5
- package/dist/_virtual/rc4.es.js.map +0 -1
- package/dist/_virtual/ripemd160.es.js +0 -5
- package/dist/_virtual/ripemd160.es.js.map +0 -1
- package/dist/_virtual/sha1.es.js +0 -5
- package/dist/_virtual/sha1.es.js.map +0 -1
- package/dist/_virtual/sha224.es.js +0 -5
- package/dist/_virtual/sha224.es.js.map +0 -1
- package/dist/_virtual/sha256.es.js +0 -5
- package/dist/_virtual/sha256.es.js.map +0 -1
- package/dist/_virtual/sha3.es.js +0 -5
- package/dist/_virtual/sha3.es.js.map +0 -1
- package/dist/_virtual/sha384.es.js +0 -5
- package/dist/_virtual/sha384.es.js.map +0 -1
- package/dist/_virtual/sha512.es.js +0 -5
- package/dist/_virtual/sha512.es.js.map +0 -1
- package/dist/_virtual/tripledes.es.js +0 -5
- package/dist/_virtual/tripledes.es.js.map +0 -1
- package/dist/_virtual/x64-core.es.js +0 -5
- package/dist/_virtual/x64-core.es.js.map +0 -1
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.es.js +0 -163
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.es.js.map +0 -1
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/blowfish.es.js +0 -1198
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/blowfish.es.js.map +0 -1
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/cipher-core.es.js +0 -650
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/cipher-core.es.js.map +0 -1
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/core.es.js +0 -614
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/core.es.js.map +0 -1
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-base64.es.js +0 -113
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-base64.es.js.map +0 -1
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-base64url.es.js +0 -124
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-base64url.es.js.map +0 -1
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf16.es.js +0 -123
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf16.es.js.map +0 -1
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/evpkdf.es.js +0 -98
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/evpkdf.es.js.map +0 -1
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/format-hex.es.js +0 -66
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/format-hex.es.js.map +0 -1
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/hmac.es.js +0 -112
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/hmac.es.js.map +0 -1
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/index.es.js +0 -52
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/index.es.js.map +0 -1
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/lib-typedarrays.es.js +0 -50
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/lib-typedarrays.es.js.map +0 -1
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/md5.es.js +0 -184
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/md5.es.js.map +0 -1
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-cfb.es.js +0 -58
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-cfb.es.js.map +0 -1
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ctr-gladman.es.js +0 -86
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ctr-gladman.es.js.map +0 -1
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ctr.es.js +0 -46
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ctr.es.js.map +0 -1
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.es.js +0 -37
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.es.js.map +0 -1
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ofb.es.js +0 -44
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ofb.es.js.map +0 -1
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-ansix923.es.js +0 -38
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-ansix923.es.js.map +0 -1
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-iso10126.es.js +0 -34
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-iso10126.es.js.map +0 -1
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-iso97971.es.js +0 -33
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-iso97971.es.js.map +0 -1
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-nopadding.es.js +0 -29
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-nopadding.es.js.map +0 -1
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-zeropadding.es.js +0 -40
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-zeropadding.es.js.map +0 -1
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pbkdf2.es.js +0 -105
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pbkdf2.es.js.map +0 -1
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/rabbit-legacy.es.js +0 -135
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/rabbit-legacy.es.js.map +0 -1
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/rabbit.es.js +0 -138
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/rabbit.es.js.map +0 -1
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/rc4.es.js +0 -92
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/rc4.es.js.map +0 -1
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/ripemd160.es.js +0 -486
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/ripemd160.es.js.map +0 -1
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha1.es.js +0 -96
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha1.es.js.map +0 -1
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha224.es.js +0 -51
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha224.es.js.map +0 -1
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha256.es.js +0 -126
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha256.es.js.map +0 -1
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha3.es.js +0 -208
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha3.es.js.map +0 -1
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha384.es.js +0 -53
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha384.es.js.map +0 -1
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha512.es.js +0 -288
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha512.es.js.map +0 -1
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/tripledes.es.js +0 -790
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/tripledes.es.js.map +0 -1
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/x64-core.es.js +0 -262
- package/dist/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/x64-core.es.js.map +0 -1
|
@@ -1,650 +0,0 @@
|
|
|
1
|
-
import { commonjsGlobal } from "../../../../../_virtual/_commonjsHelpers.es.js";
|
|
2
|
-
import { __module as cipherCore } from "../../../../../_virtual/cipher-core.es.js";
|
|
3
|
-
import { __require as requireCore } from "./core.es.js";
|
|
4
|
-
import { __require as requireEvpkdf } from "./evpkdf.es.js";
|
|
5
|
-
var hasRequiredCipherCore;
|
|
6
|
-
function requireCipherCore() {
|
|
7
|
-
if (hasRequiredCipherCore) return cipherCore.exports;
|
|
8
|
-
hasRequiredCipherCore = 1;
|
|
9
|
-
(function(module, exports) {
|
|
10
|
-
(function(root, factory, undef) {
|
|
11
|
-
{
|
|
12
|
-
module.exports = factory(requireCore(), requireEvpkdf());
|
|
13
|
-
}
|
|
14
|
-
})(commonjsGlobal, function(CryptoJS) {
|
|
15
|
-
CryptoJS.lib.Cipher || function(undefined$1) {
|
|
16
|
-
var C = CryptoJS;
|
|
17
|
-
var C_lib = C.lib;
|
|
18
|
-
var Base = C_lib.Base;
|
|
19
|
-
var WordArray = C_lib.WordArray;
|
|
20
|
-
var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm;
|
|
21
|
-
var C_enc = C.enc;
|
|
22
|
-
C_enc.Utf8;
|
|
23
|
-
var Base64 = C_enc.Base64;
|
|
24
|
-
var C_algo = C.algo;
|
|
25
|
-
var EvpKDF = C_algo.EvpKDF;
|
|
26
|
-
var Cipher = C_lib.Cipher = BufferedBlockAlgorithm.extend({
|
|
27
|
-
/**
|
|
28
|
-
* Configuration options.
|
|
29
|
-
*
|
|
30
|
-
* @property {WordArray} iv The IV to use for this operation.
|
|
31
|
-
*/
|
|
32
|
-
cfg: Base.extend(),
|
|
33
|
-
/**
|
|
34
|
-
* Creates this cipher in encryption mode.
|
|
35
|
-
*
|
|
36
|
-
* @param {WordArray} key The key.
|
|
37
|
-
* @param {Object} cfg (Optional) The configuration options to use for this operation.
|
|
38
|
-
*
|
|
39
|
-
* @return {Cipher} A cipher instance.
|
|
40
|
-
*
|
|
41
|
-
* @static
|
|
42
|
-
*
|
|
43
|
-
* @example
|
|
44
|
-
*
|
|
45
|
-
* var cipher = CryptoJS.algo.AES.createEncryptor(keyWordArray, { iv: ivWordArray });
|
|
46
|
-
*/
|
|
47
|
-
createEncryptor: function(key, cfg) {
|
|
48
|
-
return this.create(this._ENC_XFORM_MODE, key, cfg);
|
|
49
|
-
},
|
|
50
|
-
/**
|
|
51
|
-
* Creates this cipher in decryption mode.
|
|
52
|
-
*
|
|
53
|
-
* @param {WordArray} key The key.
|
|
54
|
-
* @param {Object} cfg (Optional) The configuration options to use for this operation.
|
|
55
|
-
*
|
|
56
|
-
* @return {Cipher} A cipher instance.
|
|
57
|
-
*
|
|
58
|
-
* @static
|
|
59
|
-
*
|
|
60
|
-
* @example
|
|
61
|
-
*
|
|
62
|
-
* var cipher = CryptoJS.algo.AES.createDecryptor(keyWordArray, { iv: ivWordArray });
|
|
63
|
-
*/
|
|
64
|
-
createDecryptor: function(key, cfg) {
|
|
65
|
-
return this.create(this._DEC_XFORM_MODE, key, cfg);
|
|
66
|
-
},
|
|
67
|
-
/**
|
|
68
|
-
* Initializes a newly created cipher.
|
|
69
|
-
*
|
|
70
|
-
* @param {number} xformMode Either the encryption or decryption transormation mode constant.
|
|
71
|
-
* @param {WordArray} key The key.
|
|
72
|
-
* @param {Object} cfg (Optional) The configuration options to use for this operation.
|
|
73
|
-
*
|
|
74
|
-
* @example
|
|
75
|
-
*
|
|
76
|
-
* var cipher = CryptoJS.algo.AES.create(CryptoJS.algo.AES._ENC_XFORM_MODE, keyWordArray, { iv: ivWordArray });
|
|
77
|
-
*/
|
|
78
|
-
init: function(xformMode, key, cfg) {
|
|
79
|
-
this.cfg = this.cfg.extend(cfg);
|
|
80
|
-
this._xformMode = xformMode;
|
|
81
|
-
this._key = key;
|
|
82
|
-
this.reset();
|
|
83
|
-
},
|
|
84
|
-
/**
|
|
85
|
-
* Resets this cipher to its initial state.
|
|
86
|
-
*
|
|
87
|
-
* @example
|
|
88
|
-
*
|
|
89
|
-
* cipher.reset();
|
|
90
|
-
*/
|
|
91
|
-
reset: function() {
|
|
92
|
-
BufferedBlockAlgorithm.reset.call(this);
|
|
93
|
-
this._doReset();
|
|
94
|
-
},
|
|
95
|
-
/**
|
|
96
|
-
* Adds data to be encrypted or decrypted.
|
|
97
|
-
*
|
|
98
|
-
* @param {WordArray|string} dataUpdate The data to encrypt or decrypt.
|
|
99
|
-
*
|
|
100
|
-
* @return {WordArray} The data after processing.
|
|
101
|
-
*
|
|
102
|
-
* @example
|
|
103
|
-
*
|
|
104
|
-
* var encrypted = cipher.process('data');
|
|
105
|
-
* var encrypted = cipher.process(wordArray);
|
|
106
|
-
*/
|
|
107
|
-
process: function(dataUpdate) {
|
|
108
|
-
this._append(dataUpdate);
|
|
109
|
-
return this._process();
|
|
110
|
-
},
|
|
111
|
-
/**
|
|
112
|
-
* Finalizes the encryption or decryption process.
|
|
113
|
-
* Note that the finalize operation is effectively a destructive, read-once operation.
|
|
114
|
-
*
|
|
115
|
-
* @param {WordArray|string} dataUpdate The final data to encrypt or decrypt.
|
|
116
|
-
*
|
|
117
|
-
* @return {WordArray} The data after final processing.
|
|
118
|
-
*
|
|
119
|
-
* @example
|
|
120
|
-
*
|
|
121
|
-
* var encrypted = cipher.finalize();
|
|
122
|
-
* var encrypted = cipher.finalize('data');
|
|
123
|
-
* var encrypted = cipher.finalize(wordArray);
|
|
124
|
-
*/
|
|
125
|
-
finalize: function(dataUpdate) {
|
|
126
|
-
if (dataUpdate) {
|
|
127
|
-
this._append(dataUpdate);
|
|
128
|
-
}
|
|
129
|
-
var finalProcessedData = this._doFinalize();
|
|
130
|
-
return finalProcessedData;
|
|
131
|
-
},
|
|
132
|
-
keySize: 128 / 32,
|
|
133
|
-
ivSize: 128 / 32,
|
|
134
|
-
_ENC_XFORM_MODE: 1,
|
|
135
|
-
_DEC_XFORM_MODE: 2,
|
|
136
|
-
/**
|
|
137
|
-
* Creates shortcut functions to a cipher's object interface.
|
|
138
|
-
*
|
|
139
|
-
* @param {Cipher} cipher The cipher to create a helper for.
|
|
140
|
-
*
|
|
141
|
-
* @return {Object} An object with encrypt and decrypt shortcut functions.
|
|
142
|
-
*
|
|
143
|
-
* @static
|
|
144
|
-
*
|
|
145
|
-
* @example
|
|
146
|
-
*
|
|
147
|
-
* var AES = CryptoJS.lib.Cipher._createHelper(CryptoJS.algo.AES);
|
|
148
|
-
*/
|
|
149
|
-
_createHelper: /* @__PURE__ */ function() {
|
|
150
|
-
function selectCipherStrategy(key) {
|
|
151
|
-
if (typeof key == "string") {
|
|
152
|
-
return PasswordBasedCipher;
|
|
153
|
-
} else {
|
|
154
|
-
return SerializableCipher;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
return function(cipher) {
|
|
158
|
-
return {
|
|
159
|
-
encrypt: function(message, key, cfg) {
|
|
160
|
-
return selectCipherStrategy(key).encrypt(cipher, message, key, cfg);
|
|
161
|
-
},
|
|
162
|
-
decrypt: function(ciphertext, key, cfg) {
|
|
163
|
-
return selectCipherStrategy(key).decrypt(cipher, ciphertext, key, cfg);
|
|
164
|
-
}
|
|
165
|
-
};
|
|
166
|
-
};
|
|
167
|
-
}()
|
|
168
|
-
});
|
|
169
|
-
C_lib.StreamCipher = Cipher.extend({
|
|
170
|
-
_doFinalize: function() {
|
|
171
|
-
var finalProcessedBlocks = this._process(true);
|
|
172
|
-
return finalProcessedBlocks;
|
|
173
|
-
},
|
|
174
|
-
blockSize: 1
|
|
175
|
-
});
|
|
176
|
-
var C_mode = C.mode = {};
|
|
177
|
-
var BlockCipherMode = C_lib.BlockCipherMode = Base.extend({
|
|
178
|
-
/**
|
|
179
|
-
* Creates this mode for encryption.
|
|
180
|
-
*
|
|
181
|
-
* @param {Cipher} cipher A block cipher instance.
|
|
182
|
-
* @param {Array} iv The IV words.
|
|
183
|
-
*
|
|
184
|
-
* @static
|
|
185
|
-
*
|
|
186
|
-
* @example
|
|
187
|
-
*
|
|
188
|
-
* var mode = CryptoJS.mode.CBC.createEncryptor(cipher, iv.words);
|
|
189
|
-
*/
|
|
190
|
-
createEncryptor: function(cipher, iv) {
|
|
191
|
-
return this.Encryptor.create(cipher, iv);
|
|
192
|
-
},
|
|
193
|
-
/**
|
|
194
|
-
* Creates this mode for decryption.
|
|
195
|
-
*
|
|
196
|
-
* @param {Cipher} cipher A block cipher instance.
|
|
197
|
-
* @param {Array} iv The IV words.
|
|
198
|
-
*
|
|
199
|
-
* @static
|
|
200
|
-
*
|
|
201
|
-
* @example
|
|
202
|
-
*
|
|
203
|
-
* var mode = CryptoJS.mode.CBC.createDecryptor(cipher, iv.words);
|
|
204
|
-
*/
|
|
205
|
-
createDecryptor: function(cipher, iv) {
|
|
206
|
-
return this.Decryptor.create(cipher, iv);
|
|
207
|
-
},
|
|
208
|
-
/**
|
|
209
|
-
* Initializes a newly created mode.
|
|
210
|
-
*
|
|
211
|
-
* @param {Cipher} cipher A block cipher instance.
|
|
212
|
-
* @param {Array} iv The IV words.
|
|
213
|
-
*
|
|
214
|
-
* @example
|
|
215
|
-
*
|
|
216
|
-
* var mode = CryptoJS.mode.CBC.Encryptor.create(cipher, iv.words);
|
|
217
|
-
*/
|
|
218
|
-
init: function(cipher, iv) {
|
|
219
|
-
this._cipher = cipher;
|
|
220
|
-
this._iv = iv;
|
|
221
|
-
}
|
|
222
|
-
});
|
|
223
|
-
var CBC = C_mode.CBC = function() {
|
|
224
|
-
var CBC2 = BlockCipherMode.extend();
|
|
225
|
-
CBC2.Encryptor = CBC2.extend({
|
|
226
|
-
/**
|
|
227
|
-
* Processes the data block at offset.
|
|
228
|
-
*
|
|
229
|
-
* @param {Array} words The data words to operate on.
|
|
230
|
-
* @param {number} offset The offset where the block starts.
|
|
231
|
-
*
|
|
232
|
-
* @example
|
|
233
|
-
*
|
|
234
|
-
* mode.processBlock(data.words, offset);
|
|
235
|
-
*/
|
|
236
|
-
processBlock: function(words, offset) {
|
|
237
|
-
var cipher = this._cipher;
|
|
238
|
-
var blockSize = cipher.blockSize;
|
|
239
|
-
xorBlock.call(this, words, offset, blockSize);
|
|
240
|
-
cipher.encryptBlock(words, offset);
|
|
241
|
-
this._prevBlock = words.slice(offset, offset + blockSize);
|
|
242
|
-
}
|
|
243
|
-
});
|
|
244
|
-
CBC2.Decryptor = CBC2.extend({
|
|
245
|
-
/**
|
|
246
|
-
* Processes the data block at offset.
|
|
247
|
-
*
|
|
248
|
-
* @param {Array} words The data words to operate on.
|
|
249
|
-
* @param {number} offset The offset where the block starts.
|
|
250
|
-
*
|
|
251
|
-
* @example
|
|
252
|
-
*
|
|
253
|
-
* mode.processBlock(data.words, offset);
|
|
254
|
-
*/
|
|
255
|
-
processBlock: function(words, offset) {
|
|
256
|
-
var cipher = this._cipher;
|
|
257
|
-
var blockSize = cipher.blockSize;
|
|
258
|
-
var thisBlock = words.slice(offset, offset + blockSize);
|
|
259
|
-
cipher.decryptBlock(words, offset);
|
|
260
|
-
xorBlock.call(this, words, offset, blockSize);
|
|
261
|
-
this._prevBlock = thisBlock;
|
|
262
|
-
}
|
|
263
|
-
});
|
|
264
|
-
function xorBlock(words, offset, blockSize) {
|
|
265
|
-
var block;
|
|
266
|
-
var iv = this._iv;
|
|
267
|
-
if (iv) {
|
|
268
|
-
block = iv;
|
|
269
|
-
this._iv = undefined$1;
|
|
270
|
-
} else {
|
|
271
|
-
block = this._prevBlock;
|
|
272
|
-
}
|
|
273
|
-
for (var i = 0; i < blockSize; i++) {
|
|
274
|
-
words[offset + i] ^= block[i];
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
return CBC2;
|
|
278
|
-
}();
|
|
279
|
-
var C_pad = C.pad = {};
|
|
280
|
-
var Pkcs7 = C_pad.Pkcs7 = {
|
|
281
|
-
/**
|
|
282
|
-
* Pads data using the algorithm defined in PKCS #5/7.
|
|
283
|
-
*
|
|
284
|
-
* @param {WordArray} data The data to pad.
|
|
285
|
-
* @param {number} blockSize The multiple that the data should be padded to.
|
|
286
|
-
*
|
|
287
|
-
* @static
|
|
288
|
-
*
|
|
289
|
-
* @example
|
|
290
|
-
*
|
|
291
|
-
* CryptoJS.pad.Pkcs7.pad(wordArray, 4);
|
|
292
|
-
*/
|
|
293
|
-
pad: function(data, blockSize) {
|
|
294
|
-
var blockSizeBytes = blockSize * 4;
|
|
295
|
-
var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes;
|
|
296
|
-
var paddingWord = nPaddingBytes << 24 | nPaddingBytes << 16 | nPaddingBytes << 8 | nPaddingBytes;
|
|
297
|
-
var paddingWords = [];
|
|
298
|
-
for (var i = 0; i < nPaddingBytes; i += 4) {
|
|
299
|
-
paddingWords.push(paddingWord);
|
|
300
|
-
}
|
|
301
|
-
var padding = WordArray.create(paddingWords, nPaddingBytes);
|
|
302
|
-
data.concat(padding);
|
|
303
|
-
},
|
|
304
|
-
/**
|
|
305
|
-
* Unpads data that had been padded using the algorithm defined in PKCS #5/7.
|
|
306
|
-
*
|
|
307
|
-
* @param {WordArray} data The data to unpad.
|
|
308
|
-
*
|
|
309
|
-
* @static
|
|
310
|
-
*
|
|
311
|
-
* @example
|
|
312
|
-
*
|
|
313
|
-
* CryptoJS.pad.Pkcs7.unpad(wordArray);
|
|
314
|
-
*/
|
|
315
|
-
unpad: function(data) {
|
|
316
|
-
var nPaddingBytes = data.words[data.sigBytes - 1 >>> 2] & 255;
|
|
317
|
-
data.sigBytes -= nPaddingBytes;
|
|
318
|
-
}
|
|
319
|
-
};
|
|
320
|
-
C_lib.BlockCipher = Cipher.extend({
|
|
321
|
-
/**
|
|
322
|
-
* Configuration options.
|
|
323
|
-
*
|
|
324
|
-
* @property {Mode} mode The block mode to use. Default: CBC
|
|
325
|
-
* @property {Padding} padding The padding strategy to use. Default: Pkcs7
|
|
326
|
-
*/
|
|
327
|
-
cfg: Cipher.cfg.extend({
|
|
328
|
-
mode: CBC,
|
|
329
|
-
padding: Pkcs7
|
|
330
|
-
}),
|
|
331
|
-
reset: function() {
|
|
332
|
-
var modeCreator;
|
|
333
|
-
Cipher.reset.call(this);
|
|
334
|
-
var cfg = this.cfg;
|
|
335
|
-
var iv = cfg.iv;
|
|
336
|
-
var mode = cfg.mode;
|
|
337
|
-
if (this._xformMode == this._ENC_XFORM_MODE) {
|
|
338
|
-
modeCreator = mode.createEncryptor;
|
|
339
|
-
} else {
|
|
340
|
-
modeCreator = mode.createDecryptor;
|
|
341
|
-
this._minBufferSize = 1;
|
|
342
|
-
}
|
|
343
|
-
if (this._mode && this._mode.__creator == modeCreator) {
|
|
344
|
-
this._mode.init(this, iv && iv.words);
|
|
345
|
-
} else {
|
|
346
|
-
this._mode = modeCreator.call(mode, this, iv && iv.words);
|
|
347
|
-
this._mode.__creator = modeCreator;
|
|
348
|
-
}
|
|
349
|
-
},
|
|
350
|
-
_doProcessBlock: function(words, offset) {
|
|
351
|
-
this._mode.processBlock(words, offset);
|
|
352
|
-
},
|
|
353
|
-
_doFinalize: function() {
|
|
354
|
-
var finalProcessedBlocks;
|
|
355
|
-
var padding = this.cfg.padding;
|
|
356
|
-
if (this._xformMode == this._ENC_XFORM_MODE) {
|
|
357
|
-
padding.pad(this._data, this.blockSize);
|
|
358
|
-
finalProcessedBlocks = this._process(true);
|
|
359
|
-
} else {
|
|
360
|
-
finalProcessedBlocks = this._process(true);
|
|
361
|
-
padding.unpad(finalProcessedBlocks);
|
|
362
|
-
}
|
|
363
|
-
return finalProcessedBlocks;
|
|
364
|
-
},
|
|
365
|
-
blockSize: 128 / 32
|
|
366
|
-
});
|
|
367
|
-
var CipherParams = C_lib.CipherParams = Base.extend({
|
|
368
|
-
/**
|
|
369
|
-
* Initializes a newly created cipher params object.
|
|
370
|
-
*
|
|
371
|
-
* @param {Object} cipherParams An object with any of the possible cipher parameters.
|
|
372
|
-
*
|
|
373
|
-
* @example
|
|
374
|
-
*
|
|
375
|
-
* var cipherParams = CryptoJS.lib.CipherParams.create({
|
|
376
|
-
* ciphertext: ciphertextWordArray,
|
|
377
|
-
* key: keyWordArray,
|
|
378
|
-
* iv: ivWordArray,
|
|
379
|
-
* salt: saltWordArray,
|
|
380
|
-
* algorithm: CryptoJS.algo.AES,
|
|
381
|
-
* mode: CryptoJS.mode.CBC,
|
|
382
|
-
* padding: CryptoJS.pad.PKCS7,
|
|
383
|
-
* blockSize: 4,
|
|
384
|
-
* formatter: CryptoJS.format.OpenSSL
|
|
385
|
-
* });
|
|
386
|
-
*/
|
|
387
|
-
init: function(cipherParams) {
|
|
388
|
-
this.mixIn(cipherParams);
|
|
389
|
-
},
|
|
390
|
-
/**
|
|
391
|
-
* Converts this cipher params object to a string.
|
|
392
|
-
*
|
|
393
|
-
* @param {Format} formatter (Optional) The formatting strategy to use.
|
|
394
|
-
*
|
|
395
|
-
* @return {string} The stringified cipher params.
|
|
396
|
-
*
|
|
397
|
-
* @throws Error If neither the formatter nor the default formatter is set.
|
|
398
|
-
*
|
|
399
|
-
* @example
|
|
400
|
-
*
|
|
401
|
-
* var string = cipherParams + '';
|
|
402
|
-
* var string = cipherParams.toString();
|
|
403
|
-
* var string = cipherParams.toString(CryptoJS.format.OpenSSL);
|
|
404
|
-
*/
|
|
405
|
-
toString: function(formatter) {
|
|
406
|
-
return (formatter || this.formatter).stringify(this);
|
|
407
|
-
}
|
|
408
|
-
});
|
|
409
|
-
var C_format = C.format = {};
|
|
410
|
-
var OpenSSLFormatter = C_format.OpenSSL = {
|
|
411
|
-
/**
|
|
412
|
-
* Converts a cipher params object to an OpenSSL-compatible string.
|
|
413
|
-
*
|
|
414
|
-
* @param {CipherParams} cipherParams The cipher params object.
|
|
415
|
-
*
|
|
416
|
-
* @return {string} The OpenSSL-compatible string.
|
|
417
|
-
*
|
|
418
|
-
* @static
|
|
419
|
-
*
|
|
420
|
-
* @example
|
|
421
|
-
*
|
|
422
|
-
* var openSSLString = CryptoJS.format.OpenSSL.stringify(cipherParams);
|
|
423
|
-
*/
|
|
424
|
-
stringify: function(cipherParams) {
|
|
425
|
-
var wordArray;
|
|
426
|
-
var ciphertext = cipherParams.ciphertext;
|
|
427
|
-
var salt = cipherParams.salt;
|
|
428
|
-
if (salt) {
|
|
429
|
-
wordArray = WordArray.create([1398893684, 1701076831]).concat(salt).concat(ciphertext);
|
|
430
|
-
} else {
|
|
431
|
-
wordArray = ciphertext;
|
|
432
|
-
}
|
|
433
|
-
return wordArray.toString(Base64);
|
|
434
|
-
},
|
|
435
|
-
/**
|
|
436
|
-
* Converts an OpenSSL-compatible string to a cipher params object.
|
|
437
|
-
*
|
|
438
|
-
* @param {string} openSSLStr The OpenSSL-compatible string.
|
|
439
|
-
*
|
|
440
|
-
* @return {CipherParams} The cipher params object.
|
|
441
|
-
*
|
|
442
|
-
* @static
|
|
443
|
-
*
|
|
444
|
-
* @example
|
|
445
|
-
*
|
|
446
|
-
* var cipherParams = CryptoJS.format.OpenSSL.parse(openSSLString);
|
|
447
|
-
*/
|
|
448
|
-
parse: function(openSSLStr) {
|
|
449
|
-
var salt;
|
|
450
|
-
var ciphertext = Base64.parse(openSSLStr);
|
|
451
|
-
var ciphertextWords = ciphertext.words;
|
|
452
|
-
if (ciphertextWords[0] == 1398893684 && ciphertextWords[1] == 1701076831) {
|
|
453
|
-
salt = WordArray.create(ciphertextWords.slice(2, 4));
|
|
454
|
-
ciphertextWords.splice(0, 4);
|
|
455
|
-
ciphertext.sigBytes -= 16;
|
|
456
|
-
}
|
|
457
|
-
return CipherParams.create({ ciphertext, salt });
|
|
458
|
-
}
|
|
459
|
-
};
|
|
460
|
-
var SerializableCipher = C_lib.SerializableCipher = Base.extend({
|
|
461
|
-
/**
|
|
462
|
-
* Configuration options.
|
|
463
|
-
*
|
|
464
|
-
* @property {Formatter} format The formatting strategy to convert cipher param objects to and from a string. Default: OpenSSL
|
|
465
|
-
*/
|
|
466
|
-
cfg: Base.extend({
|
|
467
|
-
format: OpenSSLFormatter
|
|
468
|
-
}),
|
|
469
|
-
/**
|
|
470
|
-
* Encrypts a message.
|
|
471
|
-
*
|
|
472
|
-
* @param {Cipher} cipher The cipher algorithm to use.
|
|
473
|
-
* @param {WordArray|string} message The message to encrypt.
|
|
474
|
-
* @param {WordArray} key The key.
|
|
475
|
-
* @param {Object} cfg (Optional) The configuration options to use for this operation.
|
|
476
|
-
*
|
|
477
|
-
* @return {CipherParams} A cipher params object.
|
|
478
|
-
*
|
|
479
|
-
* @static
|
|
480
|
-
*
|
|
481
|
-
* @example
|
|
482
|
-
*
|
|
483
|
-
* var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key);
|
|
484
|
-
* var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv });
|
|
485
|
-
* var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv, format: CryptoJS.format.OpenSSL });
|
|
486
|
-
*/
|
|
487
|
-
encrypt: function(cipher, message, key, cfg) {
|
|
488
|
-
cfg = this.cfg.extend(cfg);
|
|
489
|
-
var encryptor = cipher.createEncryptor(key, cfg);
|
|
490
|
-
var ciphertext = encryptor.finalize(message);
|
|
491
|
-
var cipherCfg = encryptor.cfg;
|
|
492
|
-
return CipherParams.create({
|
|
493
|
-
ciphertext,
|
|
494
|
-
key,
|
|
495
|
-
iv: cipherCfg.iv,
|
|
496
|
-
algorithm: cipher,
|
|
497
|
-
mode: cipherCfg.mode,
|
|
498
|
-
padding: cipherCfg.padding,
|
|
499
|
-
blockSize: cipher.blockSize,
|
|
500
|
-
formatter: cfg.format
|
|
501
|
-
});
|
|
502
|
-
},
|
|
503
|
-
/**
|
|
504
|
-
* Decrypts serialized ciphertext.
|
|
505
|
-
*
|
|
506
|
-
* @param {Cipher} cipher The cipher algorithm to use.
|
|
507
|
-
* @param {CipherParams|string} ciphertext The ciphertext to decrypt.
|
|
508
|
-
* @param {WordArray} key The key.
|
|
509
|
-
* @param {Object} cfg (Optional) The configuration options to use for this operation.
|
|
510
|
-
*
|
|
511
|
-
* @return {WordArray} The plaintext.
|
|
512
|
-
*
|
|
513
|
-
* @static
|
|
514
|
-
*
|
|
515
|
-
* @example
|
|
516
|
-
*
|
|
517
|
-
* var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, key, { iv: iv, format: CryptoJS.format.OpenSSL });
|
|
518
|
-
* var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, key, { iv: iv, format: CryptoJS.format.OpenSSL });
|
|
519
|
-
*/
|
|
520
|
-
decrypt: function(cipher, ciphertext, key, cfg) {
|
|
521
|
-
cfg = this.cfg.extend(cfg);
|
|
522
|
-
ciphertext = this._parse(ciphertext, cfg.format);
|
|
523
|
-
var plaintext = cipher.createDecryptor(key, cfg).finalize(ciphertext.ciphertext);
|
|
524
|
-
return plaintext;
|
|
525
|
-
},
|
|
526
|
-
/**
|
|
527
|
-
* Converts serialized ciphertext to CipherParams,
|
|
528
|
-
* else assumed CipherParams already and returns ciphertext unchanged.
|
|
529
|
-
*
|
|
530
|
-
* @param {CipherParams|string} ciphertext The ciphertext.
|
|
531
|
-
* @param {Formatter} format The formatting strategy to use to parse serialized ciphertext.
|
|
532
|
-
*
|
|
533
|
-
* @return {CipherParams} The unserialized ciphertext.
|
|
534
|
-
*
|
|
535
|
-
* @static
|
|
536
|
-
*
|
|
537
|
-
* @example
|
|
538
|
-
*
|
|
539
|
-
* var ciphertextParams = CryptoJS.lib.SerializableCipher._parse(ciphertextStringOrParams, format);
|
|
540
|
-
*/
|
|
541
|
-
_parse: function(ciphertext, format) {
|
|
542
|
-
if (typeof ciphertext == "string") {
|
|
543
|
-
return format.parse(ciphertext, this);
|
|
544
|
-
} else {
|
|
545
|
-
return ciphertext;
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
});
|
|
549
|
-
var C_kdf = C.kdf = {};
|
|
550
|
-
var OpenSSLKdf = C_kdf.OpenSSL = {
|
|
551
|
-
/**
|
|
552
|
-
* Derives a key and IV from a password.
|
|
553
|
-
*
|
|
554
|
-
* @param {string} password The password to derive from.
|
|
555
|
-
* @param {number} keySize The size in words of the key to generate.
|
|
556
|
-
* @param {number} ivSize The size in words of the IV to generate.
|
|
557
|
-
* @param {WordArray|string} salt (Optional) A 64-bit salt to use. If omitted, a salt will be generated randomly.
|
|
558
|
-
*
|
|
559
|
-
* @return {CipherParams} A cipher params object with the key, IV, and salt.
|
|
560
|
-
*
|
|
561
|
-
* @static
|
|
562
|
-
*
|
|
563
|
-
* @example
|
|
564
|
-
*
|
|
565
|
-
* var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32);
|
|
566
|
-
* var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32, 'saltsalt');
|
|
567
|
-
*/
|
|
568
|
-
execute: function(password, keySize, ivSize, salt, hasher) {
|
|
569
|
-
if (!salt) {
|
|
570
|
-
salt = WordArray.random(64 / 8);
|
|
571
|
-
}
|
|
572
|
-
if (!hasher) {
|
|
573
|
-
var key = EvpKDF.create({ keySize: keySize + ivSize }).compute(password, salt);
|
|
574
|
-
} else {
|
|
575
|
-
var key = EvpKDF.create({ keySize: keySize + ivSize, hasher }).compute(password, salt);
|
|
576
|
-
}
|
|
577
|
-
var iv = WordArray.create(key.words.slice(keySize), ivSize * 4);
|
|
578
|
-
key.sigBytes = keySize * 4;
|
|
579
|
-
return CipherParams.create({ key, iv, salt });
|
|
580
|
-
}
|
|
581
|
-
};
|
|
582
|
-
var PasswordBasedCipher = C_lib.PasswordBasedCipher = SerializableCipher.extend({
|
|
583
|
-
/**
|
|
584
|
-
* Configuration options.
|
|
585
|
-
*
|
|
586
|
-
* @property {KDF} kdf The key derivation function to use to generate a key and IV from a password. Default: OpenSSL
|
|
587
|
-
*/
|
|
588
|
-
cfg: SerializableCipher.cfg.extend({
|
|
589
|
-
kdf: OpenSSLKdf
|
|
590
|
-
}),
|
|
591
|
-
/**
|
|
592
|
-
* Encrypts a message using a password.
|
|
593
|
-
*
|
|
594
|
-
* @param {Cipher} cipher The cipher algorithm to use.
|
|
595
|
-
* @param {WordArray|string} message The message to encrypt.
|
|
596
|
-
* @param {string} password The password.
|
|
597
|
-
* @param {Object} cfg (Optional) The configuration options to use for this operation.
|
|
598
|
-
*
|
|
599
|
-
* @return {CipherParams} A cipher params object.
|
|
600
|
-
*
|
|
601
|
-
* @static
|
|
602
|
-
*
|
|
603
|
-
* @example
|
|
604
|
-
*
|
|
605
|
-
* var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password');
|
|
606
|
-
* var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password', { format: CryptoJS.format.OpenSSL });
|
|
607
|
-
*/
|
|
608
|
-
encrypt: function(cipher, message, password, cfg) {
|
|
609
|
-
cfg = this.cfg.extend(cfg);
|
|
610
|
-
var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, cfg.salt, cfg.hasher);
|
|
611
|
-
cfg.iv = derivedParams.iv;
|
|
612
|
-
var ciphertext = SerializableCipher.encrypt.call(this, cipher, message, derivedParams.key, cfg);
|
|
613
|
-
ciphertext.mixIn(derivedParams);
|
|
614
|
-
return ciphertext;
|
|
615
|
-
},
|
|
616
|
-
/**
|
|
617
|
-
* Decrypts serialized ciphertext using a password.
|
|
618
|
-
*
|
|
619
|
-
* @param {Cipher} cipher The cipher algorithm to use.
|
|
620
|
-
* @param {CipherParams|string} ciphertext The ciphertext to decrypt.
|
|
621
|
-
* @param {string} password The password.
|
|
622
|
-
* @param {Object} cfg (Optional) The configuration options to use for this operation.
|
|
623
|
-
*
|
|
624
|
-
* @return {WordArray} The plaintext.
|
|
625
|
-
*
|
|
626
|
-
* @static
|
|
627
|
-
*
|
|
628
|
-
* @example
|
|
629
|
-
*
|
|
630
|
-
* var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, 'password', { format: CryptoJS.format.OpenSSL });
|
|
631
|
-
* var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, 'password', { format: CryptoJS.format.OpenSSL });
|
|
632
|
-
*/
|
|
633
|
-
decrypt: function(cipher, ciphertext, password, cfg) {
|
|
634
|
-
cfg = this.cfg.extend(cfg);
|
|
635
|
-
ciphertext = this._parse(ciphertext, cfg.format);
|
|
636
|
-
var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, ciphertext.salt, cfg.hasher);
|
|
637
|
-
cfg.iv = derivedParams.iv;
|
|
638
|
-
var plaintext = SerializableCipher.decrypt.call(this, cipher, ciphertext, derivedParams.key, cfg);
|
|
639
|
-
return plaintext;
|
|
640
|
-
}
|
|
641
|
-
});
|
|
642
|
-
}();
|
|
643
|
-
});
|
|
644
|
-
})(cipherCore);
|
|
645
|
-
return cipherCore.exports;
|
|
646
|
-
}
|
|
647
|
-
export {
|
|
648
|
-
requireCipherCore as __require
|
|
649
|
-
};
|
|
650
|
-
//# sourceMappingURL=cipher-core.es.js.map
|