module-develop-kit 0.5.13 → 1.0.0

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.
Files changed (100) hide show
  1. package/dist/commonjs-virtual-dir/_commonjsHelpers.js +4 -6
  2. package/dist/commonjs-virtual-dir/_virtual_mobile-compatibility-detection.js +1 -1
  3. package/dist/commonjs-virtual-dir/index.js +3 -3
  4. package/dist/commonjs-virtual-dir/index2.js +5 -3
  5. package/dist/commonjs-virtual-dir/index3.js +3 -5
  6. package/dist/commonjs-virtual-dir/index4.js +2 -5
  7. package/dist/commonjs-virtual-dir/index5.js +2 -2
  8. package/dist/commonjs-virtual-dir/index6.js +2 -2
  9. package/dist/main.d.ts +74 -104
  10. package/dist/main.js +16 -20
  11. package/dist/src/outside-call/utils.js +1 -1
  12. package/dist/src/shield/crypto/const.js +4 -0
  13. package/dist/src/shield/crypto/index.js +53 -0
  14. package/dist/src/shield/crypto/sm2.js +7 -0
  15. package/dist/src/shield/crypto/sm4.js +15 -0
  16. package/dist/src/shield/crypto/util.js +29 -0
  17. package/dist/src/shield/html-sanitize.js +21 -0
  18. package/dist/src/vite-plugins/getCompatibilityPlugins.js +19 -8
  19. package/dist/src/vite-plugins/vitePluginCompatibilityDetection.js +8 -10
  20. package/dist/vendor/base64-js/index.js +1 -1
  21. package/dist/vendor/jsbn/index.js +1 -1
  22. package/dist/vendor/sdp-transform/lib/index.js +1 -1
  23. package/dist/vite-plugins/index.d.ts +5 -5
  24. package/package.json +3 -3
  25. package/dist/commonjs-virtual-dir/_commonjs-dynamic-modules.js +0 -6
  26. package/dist/commonjs-virtual-dir/aes.js +0 -4
  27. package/dist/commonjs-virtual-dir/blowfish.js +0 -4
  28. package/dist/commonjs-virtual-dir/cipher-core.js +0 -4
  29. package/dist/commonjs-virtual-dir/core.js +0 -4
  30. package/dist/commonjs-virtual-dir/enc-base64.js +0 -4
  31. package/dist/commonjs-virtual-dir/enc-base64url.js +0 -4
  32. package/dist/commonjs-virtual-dir/enc-utf16.js +0 -4
  33. package/dist/commonjs-virtual-dir/evpkdf.js +0 -4
  34. package/dist/commonjs-virtual-dir/format-hex.js +0 -4
  35. package/dist/commonjs-virtual-dir/hmac.js +0 -4
  36. package/dist/commonjs-virtual-dir/index7.js +0 -4
  37. package/dist/commonjs-virtual-dir/index8.js +0 -4
  38. package/dist/commonjs-virtual-dir/lib-typedarrays.js +0 -4
  39. package/dist/commonjs-virtual-dir/md5.js +0 -4
  40. package/dist/commonjs-virtual-dir/mode-cfb.js +0 -4
  41. package/dist/commonjs-virtual-dir/mode-ctr-gladman.js +0 -4
  42. package/dist/commonjs-virtual-dir/mode-ctr.js +0 -4
  43. package/dist/commonjs-virtual-dir/mode-ecb.js +0 -4
  44. package/dist/commonjs-virtual-dir/mode-ofb.js +0 -4
  45. package/dist/commonjs-virtual-dir/pad-ansix923.js +0 -4
  46. package/dist/commonjs-virtual-dir/pad-iso10126.js +0 -4
  47. package/dist/commonjs-virtual-dir/pad-iso97971.js +0 -4
  48. package/dist/commonjs-virtual-dir/pad-nopadding.js +0 -4
  49. package/dist/commonjs-virtual-dir/pad-zeropadding.js +0 -4
  50. package/dist/commonjs-virtual-dir/pbkdf2.js +0 -4
  51. package/dist/commonjs-virtual-dir/rabbit-legacy.js +0 -4
  52. package/dist/commonjs-virtual-dir/rabbit.js +0 -4
  53. package/dist/commonjs-virtual-dir/rc4.js +0 -4
  54. package/dist/commonjs-virtual-dir/ripemd160.js +0 -4
  55. package/dist/commonjs-virtual-dir/sha1.js +0 -4
  56. package/dist/commonjs-virtual-dir/sha224.js +0 -4
  57. package/dist/commonjs-virtual-dir/sha256.js +0 -4
  58. package/dist/commonjs-virtual-dir/sha3.js +0 -4
  59. package/dist/commonjs-virtual-dir/sha384.js +0 -4
  60. package/dist/commonjs-virtual-dir/sha512.js +0 -4
  61. package/dist/commonjs-virtual-dir/tripledes.js +0 -4
  62. package/dist/commonjs-virtual-dir/x64-core.js +0 -4
  63. package/dist/src/shield/crypto.js +0 -28
  64. package/dist/src/shield/index.js +0 -59
  65. package/dist/vendor/crypto-js/aes.js +0 -69
  66. package/dist/vendor/crypto-js/blowfish.js +0 -1131
  67. package/dist/vendor/crypto-js/cipher-core.js +0 -544
  68. package/dist/vendor/crypto-js/core.js +0 -508
  69. package/dist/vendor/crypto-js/enc-base64.js +0 -80
  70. package/dist/vendor/crypto-js/enc-base64url.js +0 -87
  71. package/dist/vendor/crypto-js/enc-utf16.js +0 -99
  72. package/dist/vendor/crypto-js/evpkdf.js +0 -70
  73. package/dist/vendor/crypto-js/format-hex.js +0 -53
  74. package/dist/vendor/crypto-js/hmac.js +0 -83
  75. package/dist/vendor/crypto-js/index.js +0 -49
  76. package/dist/vendor/crypto-js/lib-typedarrays.js +0 -27
  77. package/dist/vendor/crypto-js/md5.js +0 -71
  78. package/dist/vendor/crypto-js/mode-cfb.js +0 -36
  79. package/dist/vendor/crypto-js/mode-ctr-gladman.js +0 -45
  80. package/dist/vendor/crypto-js/mode-ctr.js +0 -28
  81. package/dist/vendor/crypto-js/mode-ecb.js +0 -27
  82. package/dist/vendor/crypto-js/mode-ofb.js +0 -26
  83. package/dist/vendor/crypto-js/pad-ansix923.js +0 -25
  84. package/dist/vendor/crypto-js/pad-iso10126.js +0 -25
  85. package/dist/vendor/crypto-js/pad-iso97971.js +0 -23
  86. package/dist/vendor/crypto-js/pad-nopadding.js +0 -21
  87. package/dist/vendor/crypto-js/pad-zeropadding.js +0 -28
  88. package/dist/vendor/crypto-js/pbkdf2.js +0 -74
  89. package/dist/vendor/crypto-js/rabbit-legacy.js +0 -73
  90. package/dist/vendor/crypto-js/rabbit.js +0 -75
  91. package/dist/vendor/crypto-js/rc4.js +0 -63
  92. package/dist/vendor/crypto-js/ripemd160.js +0 -398
  93. package/dist/vendor/crypto-js/sha1.js +0 -49
  94. package/dist/vendor/crypto-js/sha224.js +0 -36
  95. package/dist/vendor/crypto-js/sha256.js +0 -57
  96. package/dist/vendor/crypto-js/sha3.js +0 -116
  97. package/dist/vendor/crypto-js/sha384.js +0 -37
  98. package/dist/vendor/crypto-js/sha512.js +0 -147
  99. package/dist/vendor/crypto-js/tripledes.js +0 -729
  100. package/dist/vendor/crypto-js/x64-core.js +0 -235
@@ -1,544 +0,0 @@
1
- import { __module as f } from "../../commonjs-virtual-dir/cipher-core.js";
2
- import { __require as X } from "./core.js";
3
- import { __require as A } from "./evpkdf.js";
4
- var W = f.exports, B;
5
- function I() {
6
- return B ? f.exports : (B = 1, function(S, L) {
7
- (function(l, _, s) {
8
- S.exports = _(X(), A());
9
- })(W, function(l) {
10
- l.lib.Cipher || function(_) {
11
- var s = l, c = s.lib, p = c.Base, h = c.WordArray, x = c.BufferedBlockAlgorithm, y = s.enc;
12
- y.Utf8;
13
- var C = y.Base64, g = s.algo, k = g.EvpKDF, v = c.Cipher = x.extend({
14
- /**
15
- * Configuration options.
16
- *
17
- * @property {WordArray} iv The IV to use for this operation.
18
- */
19
- cfg: p.extend(),
20
- /**
21
- * Creates this cipher in encryption mode.
22
- *
23
- * @param {WordArray} key The key.
24
- * @param {Object} cfg (Optional) The configuration options to use for this operation.
25
- *
26
- * @return {Cipher} A cipher instance.
27
- *
28
- * @static
29
- *
30
- * @example
31
- *
32
- * var cipher = CryptoJS.algo.AES.createEncryptor(keyWordArray, { iv: ivWordArray });
33
- */
34
- createEncryptor: function(e, t) {
35
- return this.create(this._ENC_XFORM_MODE, e, t);
36
- },
37
- /**
38
- * Creates this cipher in decryption mode.
39
- *
40
- * @param {WordArray} key The key.
41
- * @param {Object} cfg (Optional) The configuration options to use for this operation.
42
- *
43
- * @return {Cipher} A cipher instance.
44
- *
45
- * @static
46
- *
47
- * @example
48
- *
49
- * var cipher = CryptoJS.algo.AES.createDecryptor(keyWordArray, { iv: ivWordArray });
50
- */
51
- createDecryptor: function(e, t) {
52
- return this.create(this._DEC_XFORM_MODE, e, t);
53
- },
54
- /**
55
- * Initializes a newly created cipher.
56
- *
57
- * @param {number} xformMode Either the encryption or decryption transormation mode constant.
58
- * @param {WordArray} key The key.
59
- * @param {Object} cfg (Optional) The configuration options to use for this operation.
60
- *
61
- * @example
62
- *
63
- * var cipher = CryptoJS.algo.AES.create(CryptoJS.algo.AES._ENC_XFORM_MODE, keyWordArray, { iv: ivWordArray });
64
- */
65
- init: function(e, t, i) {
66
- this.cfg = this.cfg.extend(i), this._xformMode = e, this._key = t, this.reset();
67
- },
68
- /**
69
- * Resets this cipher to its initial state.
70
- *
71
- * @example
72
- *
73
- * cipher.reset();
74
- */
75
- reset: function() {
76
- x.reset.call(this), this._doReset();
77
- },
78
- /**
79
- * Adds data to be encrypted or decrypted.
80
- *
81
- * @param {WordArray|string} dataUpdate The data to encrypt or decrypt.
82
- *
83
- * @return {WordArray} The data after processing.
84
- *
85
- * @example
86
- *
87
- * var encrypted = cipher.process('data');
88
- * var encrypted = cipher.process(wordArray);
89
- */
90
- process: function(e) {
91
- return this._append(e), this._process();
92
- },
93
- /**
94
- * Finalizes the encryption or decryption process.
95
- * Note that the finalize operation is effectively a destructive, read-once operation.
96
- *
97
- * @param {WordArray|string} dataUpdate The final data to encrypt or decrypt.
98
- *
99
- * @return {WordArray} The data after final processing.
100
- *
101
- * @example
102
- *
103
- * var encrypted = cipher.finalize();
104
- * var encrypted = cipher.finalize('data');
105
- * var encrypted = cipher.finalize(wordArray);
106
- */
107
- finalize: function(e) {
108
- e && this._append(e);
109
- var t = this._doFinalize();
110
- return t;
111
- },
112
- keySize: 128 / 32,
113
- ivSize: 128 / 32,
114
- _ENC_XFORM_MODE: 1,
115
- _DEC_XFORM_MODE: 2,
116
- /**
117
- * Creates shortcut functions to a cipher's object interface.
118
- *
119
- * @param {Cipher} cipher The cipher to create a helper for.
120
- *
121
- * @return {Object} An object with encrypt and decrypt shortcut functions.
122
- *
123
- * @static
124
- *
125
- * @example
126
- *
127
- * var AES = CryptoJS.lib.Cipher._createHelper(CryptoJS.algo.AES);
128
- */
129
- _createHelper: /* @__PURE__ */ function() {
130
- function e(t) {
131
- return typeof t == "string" ? q : u;
132
- }
133
- return function(t) {
134
- return {
135
- encrypt: function(i, r, n) {
136
- return e(r).encrypt(t, i, r, n);
137
- },
138
- decrypt: function(i, r, n) {
139
- return e(r).decrypt(t, i, r, n);
140
- }
141
- };
142
- };
143
- }()
144
- });
145
- c.StreamCipher = v.extend({
146
- _doFinalize: function() {
147
- var e = this._process(!0);
148
- return e;
149
- },
150
- blockSize: 1
151
- });
152
- var z = s.mode = {}, E = c.BlockCipherMode = p.extend({
153
- /**
154
- * Creates this mode for encryption.
155
- *
156
- * @param {Cipher} cipher A block cipher instance.
157
- * @param {Array} iv The IV words.
158
- *
159
- * @static
160
- *
161
- * @example
162
- *
163
- * var mode = CryptoJS.mode.CBC.createEncryptor(cipher, iv.words);
164
- */
165
- createEncryptor: function(e, t) {
166
- return this.Encryptor.create(e, t);
167
- },
168
- /**
169
- * Creates this mode for decryption.
170
- *
171
- * @param {Cipher} cipher A block cipher instance.
172
- * @param {Array} iv The IV words.
173
- *
174
- * @static
175
- *
176
- * @example
177
- *
178
- * var mode = CryptoJS.mode.CBC.createDecryptor(cipher, iv.words);
179
- */
180
- createDecryptor: function(e, t) {
181
- return this.Decryptor.create(e, t);
182
- },
183
- /**
184
- * Initializes a newly created mode.
185
- *
186
- * @param {Cipher} cipher A block cipher instance.
187
- * @param {Array} iv The IV words.
188
- *
189
- * @example
190
- *
191
- * var mode = CryptoJS.mode.CBC.Encryptor.create(cipher, iv.words);
192
- */
193
- init: function(e, t) {
194
- this._cipher = e, this._iv = t;
195
- }
196
- }), D = z.CBC = function() {
197
- var e = E.extend();
198
- e.Encryptor = e.extend({
199
- /**
200
- * Processes the data block at offset.
201
- *
202
- * @param {Array} words The data words to operate on.
203
- * @param {number} offset The offset where the block starts.
204
- *
205
- * @example
206
- *
207
- * mode.processBlock(data.words, offset);
208
- */
209
- processBlock: function(i, r) {
210
- var n = this._cipher, a = n.blockSize;
211
- t.call(this, i, r, a), n.encryptBlock(i, r), this._prevBlock = i.slice(r, r + a);
212
- }
213
- }), e.Decryptor = e.extend({
214
- /**
215
- * Processes the data block at offset.
216
- *
217
- * @param {Array} words The data words to operate on.
218
- * @param {number} offset The offset where the block starts.
219
- *
220
- * @example
221
- *
222
- * mode.processBlock(data.words, offset);
223
- */
224
- processBlock: function(i, r) {
225
- var n = this._cipher, a = n.blockSize, o = i.slice(r, r + a);
226
- n.decryptBlock(i, r), t.call(this, i, r, a), this._prevBlock = o;
227
- }
228
- });
229
- function t(i, r, n) {
230
- var a, o = this._iv;
231
- o ? (a = o, this._iv = _) : a = this._prevBlock;
232
- for (var d = 0; d < n; d++)
233
- i[r + d] ^= a[d];
234
- }
235
- return e;
236
- }(), M = s.pad = {}, b = M.Pkcs7 = {
237
- /**
238
- * Pads data using the algorithm defined in PKCS #5/7.
239
- *
240
- * @param {WordArray} data The data to pad.
241
- * @param {number} blockSize The multiple that the data should be padded to.
242
- *
243
- * @static
244
- *
245
- * @example
246
- *
247
- * CryptoJS.pad.Pkcs7.pad(wordArray, 4);
248
- */
249
- pad: function(e, t) {
250
- for (var i = t * 4, r = i - e.sigBytes % i, n = r << 24 | r << 16 | r << 8 | r, a = [], o = 0; o < r; o += 4)
251
- a.push(n);
252
- var d = h.create(a, r);
253
- e.concat(d);
254
- },
255
- /**
256
- * Unpads data that had been padded using the algorithm defined in PKCS #5/7.
257
- *
258
- * @param {WordArray} data The data to unpad.
259
- *
260
- * @static
261
- *
262
- * @example
263
- *
264
- * CryptoJS.pad.Pkcs7.unpad(wordArray);
265
- */
266
- unpad: function(e) {
267
- var t = e.words[e.sigBytes - 1 >>> 2] & 255;
268
- e.sigBytes -= t;
269
- }
270
- };
271
- c.BlockCipher = v.extend({
272
- /**
273
- * Configuration options.
274
- *
275
- * @property {Mode} mode The block mode to use. Default: CBC
276
- * @property {Padding} padding The padding strategy to use. Default: Pkcs7
277
- */
278
- cfg: v.cfg.extend({
279
- mode: D,
280
- padding: b
281
- }),
282
- reset: function() {
283
- var e;
284
- v.reset.call(this);
285
- var t = this.cfg, i = t.iv, r = t.mode;
286
- this._xformMode == this._ENC_XFORM_MODE ? e = r.createEncryptor : (e = r.createDecryptor, this._minBufferSize = 1), this._mode && this._mode.__creator == e ? this._mode.init(this, i && i.words) : (this._mode = e.call(r, this, i && i.words), this._mode.__creator = e);
287
- },
288
- _doProcessBlock: function(e, t) {
289
- this._mode.processBlock(e, t);
290
- },
291
- _doFinalize: function() {
292
- var e, t = this.cfg.padding;
293
- return this._xformMode == this._ENC_XFORM_MODE ? (t.pad(this._data, this.blockSize), e = this._process(!0)) : (e = this._process(!0), t.unpad(e)), e;
294
- },
295
- blockSize: 128 / 32
296
- });
297
- var m = c.CipherParams = p.extend({
298
- /**
299
- * Initializes a newly created cipher params object.
300
- *
301
- * @param {Object} cipherParams An object with any of the possible cipher parameters.
302
- *
303
- * @example
304
- *
305
- * var cipherParams = CryptoJS.lib.CipherParams.create({
306
- * ciphertext: ciphertextWordArray,
307
- * key: keyWordArray,
308
- * iv: ivWordArray,
309
- * salt: saltWordArray,
310
- * algorithm: CryptoJS.algo.AES,
311
- * mode: CryptoJS.mode.CBC,
312
- * padding: CryptoJS.pad.PKCS7,
313
- * blockSize: 4,
314
- * formatter: CryptoJS.format.OpenSSL
315
- * });
316
- */
317
- init: function(e) {
318
- this.mixIn(e);
319
- },
320
- /**
321
- * Converts this cipher params object to a string.
322
- *
323
- * @param {Format} formatter (Optional) The formatting strategy to use.
324
- *
325
- * @return {string} The stringified cipher params.
326
- *
327
- * @throws Error If neither the formatter nor the default formatter is set.
328
- *
329
- * @example
330
- *
331
- * var string = cipherParams + '';
332
- * var string = cipherParams.toString();
333
- * var string = cipherParams.toString(CryptoJS.format.OpenSSL);
334
- */
335
- toString: function(e) {
336
- return (e || this.formatter).stringify(this);
337
- }
338
- }), O = s.format = {}, P = O.OpenSSL = {
339
- /**
340
- * Converts a cipher params object to an OpenSSL-compatible string.
341
- *
342
- * @param {CipherParams} cipherParams The cipher params object.
343
- *
344
- * @return {string} The OpenSSL-compatible string.
345
- *
346
- * @static
347
- *
348
- * @example
349
- *
350
- * var openSSLString = CryptoJS.format.OpenSSL.stringify(cipherParams);
351
- */
352
- stringify: function(e) {
353
- var t, i = e.ciphertext, r = e.salt;
354
- return r ? t = h.create([1398893684, 1701076831]).concat(r).concat(i) : t = i, t.toString(C);
355
- },
356
- /**
357
- * Converts an OpenSSL-compatible string to a cipher params object.
358
- *
359
- * @param {string} openSSLStr The OpenSSL-compatible string.
360
- *
361
- * @return {CipherParams} The cipher params object.
362
- *
363
- * @static
364
- *
365
- * @example
366
- *
367
- * var cipherParams = CryptoJS.format.OpenSSL.parse(openSSLString);
368
- */
369
- parse: function(e) {
370
- var t, i = C.parse(e), r = i.words;
371
- return r[0] == 1398893684 && r[1] == 1701076831 && (t = h.create(r.slice(2, 4)), r.splice(0, 4), i.sigBytes -= 16), m.create({ ciphertext: i, salt: t });
372
- }
373
- }, u = c.SerializableCipher = p.extend({
374
- /**
375
- * Configuration options.
376
- *
377
- * @property {Formatter} format The formatting strategy to convert cipher param objects to and from a string. Default: OpenSSL
378
- */
379
- cfg: p.extend({
380
- format: P
381
- }),
382
- /**
383
- * Encrypts a message.
384
- *
385
- * @param {Cipher} cipher The cipher algorithm to use.
386
- * @param {WordArray|string} message The message to encrypt.
387
- * @param {WordArray} key The key.
388
- * @param {Object} cfg (Optional) The configuration options to use for this operation.
389
- *
390
- * @return {CipherParams} A cipher params object.
391
- *
392
- * @static
393
- *
394
- * @example
395
- *
396
- * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key);
397
- * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv });
398
- * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv, format: CryptoJS.format.OpenSSL });
399
- */
400
- encrypt: function(e, t, i, r) {
401
- r = this.cfg.extend(r);
402
- var n = e.createEncryptor(i, r), a = n.finalize(t), o = n.cfg;
403
- return m.create({
404
- ciphertext: a,
405
- key: i,
406
- iv: o.iv,
407
- algorithm: e,
408
- mode: o.mode,
409
- padding: o.padding,
410
- blockSize: e.blockSize,
411
- formatter: r.format
412
- });
413
- },
414
- /**
415
- * Decrypts serialized ciphertext.
416
- *
417
- * @param {Cipher} cipher The cipher algorithm to use.
418
- * @param {CipherParams|string} ciphertext The ciphertext to decrypt.
419
- * @param {WordArray} key The key.
420
- * @param {Object} cfg (Optional) The configuration options to use for this operation.
421
- *
422
- * @return {WordArray} The plaintext.
423
- *
424
- * @static
425
- *
426
- * @example
427
- *
428
- * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, key, { iv: iv, format: CryptoJS.format.OpenSSL });
429
- * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, key, { iv: iv, format: CryptoJS.format.OpenSSL });
430
- */
431
- decrypt: function(e, t, i, r) {
432
- r = this.cfg.extend(r), t = this._parse(t, r.format);
433
- var n = e.createDecryptor(i, r).finalize(t.ciphertext);
434
- return n;
435
- },
436
- /**
437
- * Converts serialized ciphertext to CipherParams,
438
- * else assumed CipherParams already and returns ciphertext unchanged.
439
- *
440
- * @param {CipherParams|string} ciphertext The ciphertext.
441
- * @param {Formatter} format The formatting strategy to use to parse serialized ciphertext.
442
- *
443
- * @return {CipherParams} The unserialized ciphertext.
444
- *
445
- * @static
446
- *
447
- * @example
448
- *
449
- * var ciphertextParams = CryptoJS.lib.SerializableCipher._parse(ciphertextStringOrParams, format);
450
- */
451
- _parse: function(e, t) {
452
- return typeof e == "string" ? t.parse(e, this) : e;
453
- }
454
- }), F = s.kdf = {}, R = F.OpenSSL = {
455
- /**
456
- * Derives a key and IV from a password.
457
- *
458
- * @param {string} password The password to derive from.
459
- * @param {number} keySize The size in words of the key to generate.
460
- * @param {number} ivSize The size in words of the IV to generate.
461
- * @param {WordArray|string} salt (Optional) A 64-bit salt to use. If omitted, a salt will be generated randomly.
462
- *
463
- * @return {CipherParams} A cipher params object with the key, IV, and salt.
464
- *
465
- * @static
466
- *
467
- * @example
468
- *
469
- * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32);
470
- * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32, 'saltsalt');
471
- */
472
- execute: function(e, t, i, r, n) {
473
- if (r || (r = h.random(64 / 8)), n)
474
- var a = k.create({ keySize: t + i, hasher: n }).compute(e, r);
475
- else
476
- var a = k.create({ keySize: t + i }).compute(e, r);
477
- var o = h.create(a.words.slice(t), i * 4);
478
- return a.sigBytes = t * 4, m.create({ key: a, iv: o, salt: r });
479
- }
480
- }, q = c.PasswordBasedCipher = u.extend({
481
- /**
482
- * Configuration options.
483
- *
484
- * @property {KDF} kdf The key derivation function to use to generate a key and IV from a password. Default: OpenSSL
485
- */
486
- cfg: u.cfg.extend({
487
- kdf: R
488
- }),
489
- /**
490
- * Encrypts a message using a password.
491
- *
492
- * @param {Cipher} cipher The cipher algorithm to use.
493
- * @param {WordArray|string} message The message to encrypt.
494
- * @param {string} password The password.
495
- * @param {Object} cfg (Optional) The configuration options to use for this operation.
496
- *
497
- * @return {CipherParams} A cipher params object.
498
- *
499
- * @static
500
- *
501
- * @example
502
- *
503
- * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password');
504
- * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password', { format: CryptoJS.format.OpenSSL });
505
- */
506
- encrypt: function(e, t, i, r) {
507
- r = this.cfg.extend(r);
508
- var n = r.kdf.execute(i, e.keySize, e.ivSize, r.salt, r.hasher);
509
- r.iv = n.iv;
510
- var a = u.encrypt.call(this, e, t, n.key, r);
511
- return a.mixIn(n), a;
512
- },
513
- /**
514
- * Decrypts serialized ciphertext using a password.
515
- *
516
- * @param {Cipher} cipher The cipher algorithm to use.
517
- * @param {CipherParams|string} ciphertext The ciphertext to decrypt.
518
- * @param {string} password The password.
519
- * @param {Object} cfg (Optional) The configuration options to use for this operation.
520
- *
521
- * @return {WordArray} The plaintext.
522
- *
523
- * @static
524
- *
525
- * @example
526
- *
527
- * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, 'password', { format: CryptoJS.format.OpenSSL });
528
- * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, 'password', { format: CryptoJS.format.OpenSSL });
529
- */
530
- decrypt: function(e, t, i, r) {
531
- r = this.cfg.extend(r), t = this._parse(t, r.format);
532
- var n = r.kdf.execute(i, e.keySize, e.ivSize, t.salt, r.hasher);
533
- r.iv = n.iv;
534
- var a = u.decrypt.call(this, e, t, n.key, r);
535
- return a;
536
- }
537
- });
538
- }();
539
- });
540
- }(f), f.exports);
541
- }
542
- export {
543
- I as __require
544
- };