@gct-paas/core 0.1.4-dev.3 → 0.1.4-dev.4

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 (122) hide show
  1. package/dist/index.min.cjs +1 -1
  2. package/dist/index.system.min.js +1 -1
  3. package/es/controller/form/form.controller.mjs +1 -2
  4. package/es/controller/gct-form/gct-form.controller.mjs +1 -2
  5. package/es/global/gct/gct.d.ts +1 -1
  6. package/es/interface/controller/form/form.controller.mjs +1 -1
  7. package/es/interface/hooks/i-designer-hooks.mjs +1 -1
  8. package/es/interface/i-modal/i-modal.mjs +1 -1
  9. package/es/modules/api-service/api-manage.mjs +1 -1
  10. package/es/modules/api-service/api-service.interface.d.ts +2 -2
  11. package/es/modules/api-service/api-service.interface.mjs +2 -2
  12. package/es/modules/api-service/api-service.mjs +1 -1
  13. package/es/modules/api-service/index.mjs +2 -4
  14. package/es/modules/env-manager/env-manager.d.ts +1 -1
  15. package/es/modules/env-manager/env-manager.interface.d.ts +1 -1
  16. package/es/modules/platform-config/useBasicSetting.d.ts +2 -2
  17. package/es/modules/platform-config/useDeploySetting.d.ts +1 -1
  18. package/es/modules/platform-config/useLoginSetting.d.ts +1 -1
  19. package/es/modules/platform-config/useOrgSetting.d.ts +1 -1
  20. package/es/modules/platform-config/useSecuritySetting.d.ts +1 -1
  21. package/es/modules/platform-config/useThemeSetting.d.ts +1 -1
  22. package/es/modules/platform-config/useWatermarkSetting.d.ts +1 -1
  23. package/es/register/designer-register/designer-register.mjs +1 -2
  24. package/es/register/render-register/render-register.mjs +1 -2
  25. package/es/store/global-store.mjs +1 -1
  26. package/es/types/index.d.ts +2 -2
  27. package/es/utils/plugin-pkg-util/plugin-pkg-util.mjs +1 -1
  28. package/es/utils/plugin-static-resource/plugin-static-resource.mjs +1 -1
  29. package/es/utils/tools/tools.mjs +1 -2
  30. package/package.json +6 -8
  31. package/es/_virtual/_commonjs-dynamic-modules.mjs +0 -5
  32. package/es/_virtual/_commonjsHelpers.mjs +0 -44
  33. package/es/_virtual/aes.mjs +0 -3
  34. package/es/_virtual/blowfish.mjs +0 -3
  35. package/es/_virtual/cipher-core.mjs +0 -3
  36. package/es/_virtual/core.mjs +0 -3
  37. package/es/_virtual/enc-base64.mjs +0 -3
  38. package/es/_virtual/enc-base64url.mjs +0 -3
  39. package/es/_virtual/enc-utf16.mjs +0 -3
  40. package/es/_virtual/evpkdf.mjs +0 -3
  41. package/es/_virtual/format-hex.mjs +0 -3
  42. package/es/_virtual/hmac.mjs +0 -3
  43. package/es/_virtual/index.mjs +0 -7
  44. package/es/_virtual/index2.mjs +0 -7
  45. package/es/_virtual/index3.mjs +0 -3
  46. package/es/_virtual/lib-typedarrays.mjs +0 -3
  47. package/es/_virtual/md5.mjs +0 -3
  48. package/es/_virtual/mode-cfb.mjs +0 -3
  49. package/es/_virtual/mode-ctr-gladman.mjs +0 -3
  50. package/es/_virtual/mode-ctr.mjs +0 -3
  51. package/es/_virtual/mode-ecb.mjs +0 -3
  52. package/es/_virtual/mode-ofb.mjs +0 -3
  53. package/es/_virtual/pad-ansix923.mjs +0 -3
  54. package/es/_virtual/pad-iso10126.mjs +0 -3
  55. package/es/_virtual/pad-iso97971.mjs +0 -3
  56. package/es/_virtual/pad-nopadding.mjs +0 -3
  57. package/es/_virtual/pad-zeropadding.mjs +0 -3
  58. package/es/_virtual/pbkdf2.mjs +0 -3
  59. package/es/_virtual/rabbit-legacy.mjs +0 -3
  60. package/es/_virtual/rabbit.mjs +0 -3
  61. package/es/_virtual/rc4.mjs +0 -3
  62. package/es/_virtual/ripemd160.mjs +0 -3
  63. package/es/_virtual/sha1.mjs +0 -3
  64. package/es/_virtual/sha224.mjs +0 -3
  65. package/es/_virtual/sha256.mjs +0 -3
  66. package/es/_virtual/sha3.mjs +0 -3
  67. package/es/_virtual/sha384.mjs +0 -3
  68. package/es/_virtual/sha512.mjs +0 -3
  69. package/es/_virtual/tripledes.mjs +0 -3
  70. package/es/_virtual/x64-core.mjs +0 -3
  71. package/es/node_modules/.pnpm/@gct-paas_api-apaas@0.0.2-dev.4/node_modules/@gct-paas/api-apaas/es/index.mjs +0 -3
  72. package/es/node_modules/.pnpm/@gct-paas_api-apaas@0.0.2-dev.4/node_modules/@gct-paas/api-apaas/es/service/api-config.mjs +0 -8213
  73. package/es/node_modules/.pnpm/@gct-paas_api-platform@0.0.2-dev.4/node_modules/@gct-paas/api-platform/es/index.mjs +0 -3
  74. package/es/node_modules/.pnpm/@gct-paas_api-platform@0.0.2-dev.4/node_modules/@gct-paas/api-platform/es/service/api-config.mjs +0 -7156
  75. package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.mjs +0 -255
  76. package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/blowfish.mjs +0 -492
  77. package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/cipher-core.mjs +0 -913
  78. package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/core.mjs +0 -824
  79. package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-base64.mjs +0 -153
  80. package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-base64url.mjs +0 -165
  81. package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf16.mjs +0 -166
  82. package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/evpkdf.mjs +0 -153
  83. package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/format-hex.mjs +0 -84
  84. package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/hmac.mjs +0 -160
  85. package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/index.mjs +0 -69
  86. package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/lib-typedarrays.mjs +0 -93
  87. package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/md5.mjs +0 -285
  88. package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-cfb.mjs +0 -98
  89. package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ctr-gladman.mjs +0 -134
  90. package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ctr.mjs +0 -76
  91. package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.mjs +0 -58
  92. package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ofb.mjs +0 -72
  93. package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-ansix923.mjs +0 -67
  94. package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-iso10126.mjs +0 -62
  95. package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-iso97971.mjs +0 -58
  96. package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-nopadding.mjs +0 -48
  97. package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-zeropadding.mjs +0 -65
  98. package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pbkdf2.mjs +0 -164
  99. package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/rabbit-legacy.mjs +0 -211
  100. package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/rabbit.mjs +0 -213
  101. package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/rc4.mjs +0 -160
  102. package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/ripemd160.mjs +0 -284
  103. package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha1.mjs +0 -167
  104. package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha224.mjs +0 -98
  105. package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha256.mjs +0 -216
  106. package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha3.mjs +0 -344
  107. package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha384.mjs +0 -102
  108. package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha512.mjs +0 -344
  109. package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/tripledes.mjs +0 -800
  110. package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/x64-core.mjs +0 -321
  111. package/es/node_modules/.pnpm/path-browserify@1.0.1/node_modules/path-browserify/index.mjs +0 -541
  112. package/es/node_modules/.pnpm/qx-util@0.4.8/node_modules/qx-util/out/hook/async-series-hook/async-series-hook.mjs +0 -73
  113. package/es/node_modules/.pnpm/qx-util@0.4.8/node_modules/qx-util/out/hook/index.mjs +0 -2
  114. package/es/node_modules/.pnpm/qx-util@0.4.8/node_modules/qx-util/out/hook/sync-series-hook/sync-series-hook.mjs +0 -100
  115. package/es/node_modules/.pnpm/qx-util@0.4.8/node_modules/qx-util/out/index.mjs +0 -2
  116. package/es/node_modules/.pnpm/qx-util@0.4.8/node_modules/qx-util/out/utils/array/array.mjs +0 -47
  117. package/es/node_modules/.pnpm/qx-util@0.4.8/node_modules/qx-util/out/utils/index.mjs +0 -5
  118. package/es/node_modules/.pnpm/qx-util@0.4.8/node_modules/qx-util/out/utils/object/object.mjs +0 -24
  119. package/es/node_modules/.pnpm/qx-util@0.4.8/node_modules/qx-util/out/utils/qx-event/qx-event.mjs +0 -94
  120. package/es/node_modules/.pnpm/qx-util@0.4.8/node_modules/qx-util/out/utils/qx-event-emitter/qx-event-emitter.mjs +0 -146
  121. package/es/node_modules/.pnpm/qx-util@0.4.8/node_modules/qx-util/out/utils/type-util/type-util.mjs +0 -149
  122. package/es/node_modules/.pnpm/qx-util@0.4.8/node_modules/qx-util/out/utils/util/util.mjs +0 -227
@@ -1,913 +0,0 @@
1
- import '../../../../../_virtual/_commonjsHelpers.mjs';
2
- import { __module as cipherCore$1 } from '../../../../../_virtual/cipher-core.mjs';
3
- import { __require as requireCore } from './core.mjs';
4
- import { __require as requireEvpkdf } from './evpkdf.mjs';
5
-
6
- var cipherCore = cipherCore$1.exports;
7
-
8
- var hasRequiredCipherCore;
9
-
10
- function requireCipherCore () {
11
- if (hasRequiredCipherCore) return cipherCore$1.exports;
12
- hasRequiredCipherCore = 1;
13
- (function (module, exports) {
14
- ;(function (root, factory, undef) {
15
- if ('object' === "object") {
16
- // CommonJS
17
- module.exports = exports = factory(requireCore(), requireEvpkdf());
18
- }
19
- else if (typeof undefined === "function" && undefined.amd) {
20
- // AMD
21
- undefined(["./core", "./evpkdf"], factory);
22
- }
23
- else {
24
- // Global (browser)
25
- factory(root.CryptoJS);
26
- }
27
- }(cipherCore, function (CryptoJS) {
28
-
29
- /**
30
- * Cipher core components.
31
- */
32
- CryptoJS.lib.Cipher || (function (undefined$1) {
33
- // Shortcuts
34
- var C = CryptoJS;
35
- var C_lib = C.lib;
36
- var Base = C_lib.Base;
37
- var WordArray = C_lib.WordArray;
38
- var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm;
39
- var C_enc = C.enc;
40
- var Utf8 = C_enc.Utf8;
41
- var Base64 = C_enc.Base64;
42
- var C_algo = C.algo;
43
- var EvpKDF = C_algo.EvpKDF;
44
-
45
- /**
46
- * Abstract base cipher template.
47
- *
48
- * @property {number} keySize This cipher's key size. Default: 4 (128 bits)
49
- * @property {number} ivSize This cipher's IV size. Default: 4 (128 bits)
50
- * @property {number} _ENC_XFORM_MODE A constant representing encryption mode.
51
- * @property {number} _DEC_XFORM_MODE A constant representing decryption mode.
52
- */
53
- var Cipher = C_lib.Cipher = BufferedBlockAlgorithm.extend({
54
- /**
55
- * Configuration options.
56
- *
57
- * @property {WordArray} iv The IV to use for this operation.
58
- */
59
- cfg: Base.extend(),
60
-
61
- /**
62
- * Creates this cipher in encryption mode.
63
- *
64
- * @param {WordArray} key The key.
65
- * @param {Object} cfg (Optional) The configuration options to use for this operation.
66
- *
67
- * @return {Cipher} A cipher instance.
68
- *
69
- * @static
70
- *
71
- * @example
72
- *
73
- * var cipher = CryptoJS.algo.AES.createEncryptor(keyWordArray, { iv: ivWordArray });
74
- */
75
- createEncryptor: function (key, cfg) {
76
- return this.create(this._ENC_XFORM_MODE, key, cfg);
77
- },
78
-
79
- /**
80
- * Creates this cipher in decryption mode.
81
- *
82
- * @param {WordArray} key The key.
83
- * @param {Object} cfg (Optional) The configuration options to use for this operation.
84
- *
85
- * @return {Cipher} A cipher instance.
86
- *
87
- * @static
88
- *
89
- * @example
90
- *
91
- * var cipher = CryptoJS.algo.AES.createDecryptor(keyWordArray, { iv: ivWordArray });
92
- */
93
- createDecryptor: function (key, cfg) {
94
- return this.create(this._DEC_XFORM_MODE, key, cfg);
95
- },
96
-
97
- /**
98
- * Initializes a newly created cipher.
99
- *
100
- * @param {number} xformMode Either the encryption or decryption transormation mode constant.
101
- * @param {WordArray} key The key.
102
- * @param {Object} cfg (Optional) The configuration options to use for this operation.
103
- *
104
- * @example
105
- *
106
- * var cipher = CryptoJS.algo.AES.create(CryptoJS.algo.AES._ENC_XFORM_MODE, keyWordArray, { iv: ivWordArray });
107
- */
108
- init: function (xformMode, key, cfg) {
109
- // Apply config defaults
110
- this.cfg = this.cfg.extend(cfg);
111
-
112
- // Store transform mode and key
113
- this._xformMode = xformMode;
114
- this._key = key;
115
-
116
- // Set initial values
117
- this.reset();
118
- },
119
-
120
- /**
121
- * Resets this cipher to its initial state.
122
- *
123
- * @example
124
- *
125
- * cipher.reset();
126
- */
127
- reset: function () {
128
- // Reset data buffer
129
- BufferedBlockAlgorithm.reset.call(this);
130
-
131
- // Perform concrete-cipher logic
132
- this._doReset();
133
- },
134
-
135
- /**
136
- * Adds data to be encrypted or decrypted.
137
- *
138
- * @param {WordArray|string} dataUpdate The data to encrypt or decrypt.
139
- *
140
- * @return {WordArray} The data after processing.
141
- *
142
- * @example
143
- *
144
- * var encrypted = cipher.process('data');
145
- * var encrypted = cipher.process(wordArray);
146
- */
147
- process: function (dataUpdate) {
148
- // Append
149
- this._append(dataUpdate);
150
-
151
- // Process available blocks
152
- return this._process();
153
- },
154
-
155
- /**
156
- * Finalizes the encryption or decryption process.
157
- * Note that the finalize operation is effectively a destructive, read-once operation.
158
- *
159
- * @param {WordArray|string} dataUpdate The final data to encrypt or decrypt.
160
- *
161
- * @return {WordArray} The data after final processing.
162
- *
163
- * @example
164
- *
165
- * var encrypted = cipher.finalize();
166
- * var encrypted = cipher.finalize('data');
167
- * var encrypted = cipher.finalize(wordArray);
168
- */
169
- finalize: function (dataUpdate) {
170
- // Final data update
171
- if (dataUpdate) {
172
- this._append(dataUpdate);
173
- }
174
-
175
- // Perform concrete-cipher logic
176
- var finalProcessedData = this._doFinalize();
177
-
178
- return finalProcessedData;
179
- },
180
-
181
- keySize: 128/32,
182
-
183
- ivSize: 128/32,
184
-
185
- _ENC_XFORM_MODE: 1,
186
-
187
- _DEC_XFORM_MODE: 2,
188
-
189
- /**
190
- * Creates shortcut functions to a cipher's object interface.
191
- *
192
- * @param {Cipher} cipher The cipher to create a helper for.
193
- *
194
- * @return {Object} An object with encrypt and decrypt shortcut functions.
195
- *
196
- * @static
197
- *
198
- * @example
199
- *
200
- * var AES = CryptoJS.lib.Cipher._createHelper(CryptoJS.algo.AES);
201
- */
202
- _createHelper: (function () {
203
- function selectCipherStrategy(key) {
204
- if (typeof key == 'string') {
205
- return PasswordBasedCipher;
206
- } else {
207
- return SerializableCipher;
208
- }
209
- }
210
-
211
- return function (cipher) {
212
- return {
213
- encrypt: function (message, key, cfg) {
214
- return selectCipherStrategy(key).encrypt(cipher, message, key, cfg);
215
- },
216
-
217
- decrypt: function (ciphertext, key, cfg) {
218
- return selectCipherStrategy(key).decrypt(cipher, ciphertext, key, cfg);
219
- }
220
- };
221
- };
222
- }())
223
- });
224
-
225
- /**
226
- * Abstract base stream cipher template.
227
- *
228
- * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 1 (32 bits)
229
- */
230
- var StreamCipher = C_lib.StreamCipher = Cipher.extend({
231
- _doFinalize: function () {
232
- // Process partial blocks
233
- var finalProcessedBlocks = this._process(!!'flush');
234
-
235
- return finalProcessedBlocks;
236
- },
237
-
238
- blockSize: 1
239
- });
240
-
241
- /**
242
- * Mode namespace.
243
- */
244
- var C_mode = C.mode = {};
245
-
246
- /**
247
- * Abstract base block cipher mode template.
248
- */
249
- var BlockCipherMode = C_lib.BlockCipherMode = Base.extend({
250
- /**
251
- * Creates this mode for encryption.
252
- *
253
- * @param {Cipher} cipher A block cipher instance.
254
- * @param {Array} iv The IV words.
255
- *
256
- * @static
257
- *
258
- * @example
259
- *
260
- * var mode = CryptoJS.mode.CBC.createEncryptor(cipher, iv.words);
261
- */
262
- createEncryptor: function (cipher, iv) {
263
- return this.Encryptor.create(cipher, iv);
264
- },
265
-
266
- /**
267
- * Creates this mode for decryption.
268
- *
269
- * @param {Cipher} cipher A block cipher instance.
270
- * @param {Array} iv The IV words.
271
- *
272
- * @static
273
- *
274
- * @example
275
- *
276
- * var mode = CryptoJS.mode.CBC.createDecryptor(cipher, iv.words);
277
- */
278
- createDecryptor: function (cipher, iv) {
279
- return this.Decryptor.create(cipher, iv);
280
- },
281
-
282
- /**
283
- * Initializes a newly created mode.
284
- *
285
- * @param {Cipher} cipher A block cipher instance.
286
- * @param {Array} iv The IV words.
287
- *
288
- * @example
289
- *
290
- * var mode = CryptoJS.mode.CBC.Encryptor.create(cipher, iv.words);
291
- */
292
- init: function (cipher, iv) {
293
- this._cipher = cipher;
294
- this._iv = iv;
295
- }
296
- });
297
-
298
- /**
299
- * Cipher Block Chaining mode.
300
- */
301
- var CBC = C_mode.CBC = (function () {
302
- /**
303
- * Abstract base CBC mode.
304
- */
305
- var CBC = BlockCipherMode.extend();
306
-
307
- /**
308
- * CBC encryptor.
309
- */
310
- CBC.Encryptor = CBC.extend({
311
- /**
312
- * Processes the data block at offset.
313
- *
314
- * @param {Array} words The data words to operate on.
315
- * @param {number} offset The offset where the block starts.
316
- *
317
- * @example
318
- *
319
- * mode.processBlock(data.words, offset);
320
- */
321
- processBlock: function (words, offset) {
322
- // Shortcuts
323
- var cipher = this._cipher;
324
- var blockSize = cipher.blockSize;
325
-
326
- // XOR and encrypt
327
- xorBlock.call(this, words, offset, blockSize);
328
- cipher.encryptBlock(words, offset);
329
-
330
- // Remember this block to use with next block
331
- this._prevBlock = words.slice(offset, offset + blockSize);
332
- }
333
- });
334
-
335
- /**
336
- * CBC decryptor.
337
- */
338
- CBC.Decryptor = CBC.extend({
339
- /**
340
- * Processes the data block at offset.
341
- *
342
- * @param {Array} words The data words to operate on.
343
- * @param {number} offset The offset where the block starts.
344
- *
345
- * @example
346
- *
347
- * mode.processBlock(data.words, offset);
348
- */
349
- processBlock: function (words, offset) {
350
- // Shortcuts
351
- var cipher = this._cipher;
352
- var blockSize = cipher.blockSize;
353
-
354
- // Remember this block to use with next block
355
- var thisBlock = words.slice(offset, offset + blockSize);
356
-
357
- // Decrypt and XOR
358
- cipher.decryptBlock(words, offset);
359
- xorBlock.call(this, words, offset, blockSize);
360
-
361
- // This block becomes the previous block
362
- this._prevBlock = thisBlock;
363
- }
364
- });
365
-
366
- function xorBlock(words, offset, blockSize) {
367
- var block;
368
-
369
- // Shortcut
370
- var iv = this._iv;
371
-
372
- // Choose mixing block
373
- if (iv) {
374
- block = iv;
375
-
376
- // Remove IV for subsequent blocks
377
- this._iv = undefined$1;
378
- } else {
379
- block = this._prevBlock;
380
- }
381
-
382
- // XOR blocks
383
- for (var i = 0; i < blockSize; i++) {
384
- words[offset + i] ^= block[i];
385
- }
386
- }
387
-
388
- return CBC;
389
- }());
390
-
391
- /**
392
- * Padding namespace.
393
- */
394
- var C_pad = C.pad = {};
395
-
396
- /**
397
- * PKCS #5/7 padding strategy.
398
- */
399
- var Pkcs7 = C_pad.Pkcs7 = {
400
- /**
401
- * Pads data using the algorithm defined in PKCS #5/7.
402
- *
403
- * @param {WordArray} data The data to pad.
404
- * @param {number} blockSize The multiple that the data should be padded to.
405
- *
406
- * @static
407
- *
408
- * @example
409
- *
410
- * CryptoJS.pad.Pkcs7.pad(wordArray, 4);
411
- */
412
- pad: function (data, blockSize) {
413
- // Shortcut
414
- var blockSizeBytes = blockSize * 4;
415
-
416
- // Count padding bytes
417
- var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes;
418
-
419
- // Create padding word
420
- var paddingWord = (nPaddingBytes << 24) | (nPaddingBytes << 16) | (nPaddingBytes << 8) | nPaddingBytes;
421
-
422
- // Create padding
423
- var paddingWords = [];
424
- for (var i = 0; i < nPaddingBytes; i += 4) {
425
- paddingWords.push(paddingWord);
426
- }
427
- var padding = WordArray.create(paddingWords, nPaddingBytes);
428
-
429
- // Add padding
430
- data.concat(padding);
431
- },
432
-
433
- /**
434
- * Unpads data that had been padded using the algorithm defined in PKCS #5/7.
435
- *
436
- * @param {WordArray} data The data to unpad.
437
- *
438
- * @static
439
- *
440
- * @example
441
- *
442
- * CryptoJS.pad.Pkcs7.unpad(wordArray);
443
- */
444
- unpad: function (data) {
445
- // Get number of padding bytes from last byte
446
- var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff;
447
-
448
- // Remove padding
449
- data.sigBytes -= nPaddingBytes;
450
- }
451
- };
452
-
453
- /**
454
- * Abstract base block cipher template.
455
- *
456
- * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 4 (128 bits)
457
- */
458
- var BlockCipher = C_lib.BlockCipher = Cipher.extend({
459
- /**
460
- * Configuration options.
461
- *
462
- * @property {Mode} mode The block mode to use. Default: CBC
463
- * @property {Padding} padding The padding strategy to use. Default: Pkcs7
464
- */
465
- cfg: Cipher.cfg.extend({
466
- mode: CBC,
467
- padding: Pkcs7
468
- }),
469
-
470
- reset: function () {
471
- var modeCreator;
472
-
473
- // Reset cipher
474
- Cipher.reset.call(this);
475
-
476
- // Shortcuts
477
- var cfg = this.cfg;
478
- var iv = cfg.iv;
479
- var mode = cfg.mode;
480
-
481
- // Reset block mode
482
- if (this._xformMode == this._ENC_XFORM_MODE) {
483
- modeCreator = mode.createEncryptor;
484
- } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ {
485
- modeCreator = mode.createDecryptor;
486
- // Keep at least one block in the buffer for unpadding
487
- this._minBufferSize = 1;
488
- }
489
-
490
- if (this._mode && this._mode.__creator == modeCreator) {
491
- this._mode.init(this, iv && iv.words);
492
- } else {
493
- this._mode = modeCreator.call(mode, this, iv && iv.words);
494
- this._mode.__creator = modeCreator;
495
- }
496
- },
497
-
498
- _doProcessBlock: function (words, offset) {
499
- this._mode.processBlock(words, offset);
500
- },
501
-
502
- _doFinalize: function () {
503
- var finalProcessedBlocks;
504
-
505
- // Shortcut
506
- var padding = this.cfg.padding;
507
-
508
- // Finalize
509
- if (this._xformMode == this._ENC_XFORM_MODE) {
510
- // Pad data
511
- padding.pad(this._data, this.blockSize);
512
-
513
- // Process final blocks
514
- finalProcessedBlocks = this._process(!!'flush');
515
- } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ {
516
- // Process final blocks
517
- finalProcessedBlocks = this._process(!!'flush');
518
-
519
- // Unpad data
520
- padding.unpad(finalProcessedBlocks);
521
- }
522
-
523
- return finalProcessedBlocks;
524
- },
525
-
526
- blockSize: 128/32
527
- });
528
-
529
- /**
530
- * A collection of cipher parameters.
531
- *
532
- * @property {WordArray} ciphertext The raw ciphertext.
533
- * @property {WordArray} key The key to this ciphertext.
534
- * @property {WordArray} iv The IV used in the ciphering operation.
535
- * @property {WordArray} salt The salt used with a key derivation function.
536
- * @property {Cipher} algorithm The cipher algorithm.
537
- * @property {Mode} mode The block mode used in the ciphering operation.
538
- * @property {Padding} padding The padding scheme used in the ciphering operation.
539
- * @property {number} blockSize The block size of the cipher.
540
- * @property {Format} formatter The default formatting strategy to convert this cipher params object to a string.
541
- */
542
- var CipherParams = C_lib.CipherParams = Base.extend({
543
- /**
544
- * Initializes a newly created cipher params object.
545
- *
546
- * @param {Object} cipherParams An object with any of the possible cipher parameters.
547
- *
548
- * @example
549
- *
550
- * var cipherParams = CryptoJS.lib.CipherParams.create({
551
- * ciphertext: ciphertextWordArray,
552
- * key: keyWordArray,
553
- * iv: ivWordArray,
554
- * salt: saltWordArray,
555
- * algorithm: CryptoJS.algo.AES,
556
- * mode: CryptoJS.mode.CBC,
557
- * padding: CryptoJS.pad.PKCS7,
558
- * blockSize: 4,
559
- * formatter: CryptoJS.format.OpenSSL
560
- * });
561
- */
562
- init: function (cipherParams) {
563
- this.mixIn(cipherParams);
564
- },
565
-
566
- /**
567
- * Converts this cipher params object to a string.
568
- *
569
- * @param {Format} formatter (Optional) The formatting strategy to use.
570
- *
571
- * @return {string} The stringified cipher params.
572
- *
573
- * @throws Error If neither the formatter nor the default formatter is set.
574
- *
575
- * @example
576
- *
577
- * var string = cipherParams + '';
578
- * var string = cipherParams.toString();
579
- * var string = cipherParams.toString(CryptoJS.format.OpenSSL);
580
- */
581
- toString: function (formatter) {
582
- return (formatter || this.formatter).stringify(this);
583
- }
584
- });
585
-
586
- /**
587
- * Format namespace.
588
- */
589
- var C_format = C.format = {};
590
-
591
- /**
592
- * OpenSSL formatting strategy.
593
- */
594
- var OpenSSLFormatter = C_format.OpenSSL = {
595
- /**
596
- * Converts a cipher params object to an OpenSSL-compatible string.
597
- *
598
- * @param {CipherParams} cipherParams The cipher params object.
599
- *
600
- * @return {string} The OpenSSL-compatible string.
601
- *
602
- * @static
603
- *
604
- * @example
605
- *
606
- * var openSSLString = CryptoJS.format.OpenSSL.stringify(cipherParams);
607
- */
608
- stringify: function (cipherParams) {
609
- var wordArray;
610
-
611
- // Shortcuts
612
- var ciphertext = cipherParams.ciphertext;
613
- var salt = cipherParams.salt;
614
-
615
- // Format
616
- if (salt) {
617
- wordArray = WordArray.create([0x53616c74, 0x65645f5f]).concat(salt).concat(ciphertext);
618
- } else {
619
- wordArray = ciphertext;
620
- }
621
-
622
- return wordArray.toString(Base64);
623
- },
624
-
625
- /**
626
- * Converts an OpenSSL-compatible string to a cipher params object.
627
- *
628
- * @param {string} openSSLStr The OpenSSL-compatible string.
629
- *
630
- * @return {CipherParams} The cipher params object.
631
- *
632
- * @static
633
- *
634
- * @example
635
- *
636
- * var cipherParams = CryptoJS.format.OpenSSL.parse(openSSLString);
637
- */
638
- parse: function (openSSLStr) {
639
- var salt;
640
-
641
- // Parse base64
642
- var ciphertext = Base64.parse(openSSLStr);
643
-
644
- // Shortcut
645
- var ciphertextWords = ciphertext.words;
646
-
647
- // Test for salt
648
- if (ciphertextWords[0] == 0x53616c74 && ciphertextWords[1] == 0x65645f5f) {
649
- // Extract salt
650
- salt = WordArray.create(ciphertextWords.slice(2, 4));
651
-
652
- // Remove salt from ciphertext
653
- ciphertextWords.splice(0, 4);
654
- ciphertext.sigBytes -= 16;
655
- }
656
-
657
- return CipherParams.create({ ciphertext: ciphertext, salt: salt });
658
- }
659
- };
660
-
661
- /**
662
- * A cipher wrapper that returns ciphertext as a serializable cipher params object.
663
- */
664
- var SerializableCipher = C_lib.SerializableCipher = Base.extend({
665
- /**
666
- * Configuration options.
667
- *
668
- * @property {Formatter} format The formatting strategy to convert cipher param objects to and from a string. Default: OpenSSL
669
- */
670
- cfg: Base.extend({
671
- format: OpenSSLFormatter
672
- }),
673
-
674
- /**
675
- * Encrypts a message.
676
- *
677
- * @param {Cipher} cipher The cipher algorithm to use.
678
- * @param {WordArray|string} message The message to encrypt.
679
- * @param {WordArray} key The key.
680
- * @param {Object} cfg (Optional) The configuration options to use for this operation.
681
- *
682
- * @return {CipherParams} A cipher params object.
683
- *
684
- * @static
685
- *
686
- * @example
687
- *
688
- * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key);
689
- * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv });
690
- * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv, format: CryptoJS.format.OpenSSL });
691
- */
692
- encrypt: function (cipher, message, key, cfg) {
693
- // Apply config defaults
694
- cfg = this.cfg.extend(cfg);
695
-
696
- // Encrypt
697
- var encryptor = cipher.createEncryptor(key, cfg);
698
- var ciphertext = encryptor.finalize(message);
699
-
700
- // Shortcut
701
- var cipherCfg = encryptor.cfg;
702
-
703
- // Create and return serializable cipher params
704
- return CipherParams.create({
705
- ciphertext: ciphertext,
706
- key: key,
707
- iv: cipherCfg.iv,
708
- algorithm: cipher,
709
- mode: cipherCfg.mode,
710
- padding: cipherCfg.padding,
711
- blockSize: cipher.blockSize,
712
- formatter: cfg.format
713
- });
714
- },
715
-
716
- /**
717
- * Decrypts serialized ciphertext.
718
- *
719
- * @param {Cipher} cipher The cipher algorithm to use.
720
- * @param {CipherParams|string} ciphertext The ciphertext to decrypt.
721
- * @param {WordArray} key The key.
722
- * @param {Object} cfg (Optional) The configuration options to use for this operation.
723
- *
724
- * @return {WordArray} The plaintext.
725
- *
726
- * @static
727
- *
728
- * @example
729
- *
730
- * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, key, { iv: iv, format: CryptoJS.format.OpenSSL });
731
- * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, key, { iv: iv, format: CryptoJS.format.OpenSSL });
732
- */
733
- decrypt: function (cipher, ciphertext, key, cfg) {
734
- // Apply config defaults
735
- cfg = this.cfg.extend(cfg);
736
-
737
- // Convert string to CipherParams
738
- ciphertext = this._parse(ciphertext, cfg.format);
739
-
740
- // Decrypt
741
- var plaintext = cipher.createDecryptor(key, cfg).finalize(ciphertext.ciphertext);
742
-
743
- return plaintext;
744
- },
745
-
746
- /**
747
- * Converts serialized ciphertext to CipherParams,
748
- * else assumed CipherParams already and returns ciphertext unchanged.
749
- *
750
- * @param {CipherParams|string} ciphertext The ciphertext.
751
- * @param {Formatter} format The formatting strategy to use to parse serialized ciphertext.
752
- *
753
- * @return {CipherParams} The unserialized ciphertext.
754
- *
755
- * @static
756
- *
757
- * @example
758
- *
759
- * var ciphertextParams = CryptoJS.lib.SerializableCipher._parse(ciphertextStringOrParams, format);
760
- */
761
- _parse: function (ciphertext, format) {
762
- if (typeof ciphertext == 'string') {
763
- return format.parse(ciphertext, this);
764
- } else {
765
- return ciphertext;
766
- }
767
- }
768
- });
769
-
770
- /**
771
- * Key derivation function namespace.
772
- */
773
- var C_kdf = C.kdf = {};
774
-
775
- /**
776
- * OpenSSL key derivation function.
777
- */
778
- var OpenSSLKdf = C_kdf.OpenSSL = {
779
- /**
780
- * Derives a key and IV from a password.
781
- *
782
- * @param {string} password The password to derive from.
783
- * @param {number} keySize The size in words of the key to generate.
784
- * @param {number} ivSize The size in words of the IV to generate.
785
- * @param {WordArray|string} salt (Optional) A 64-bit salt to use. If omitted, a salt will be generated randomly.
786
- *
787
- * @return {CipherParams} A cipher params object with the key, IV, and salt.
788
- *
789
- * @static
790
- *
791
- * @example
792
- *
793
- * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32);
794
- * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32, 'saltsalt');
795
- */
796
- execute: function (password, keySize, ivSize, salt, hasher) {
797
- // Generate random salt
798
- if (!salt) {
799
- salt = WordArray.random(64/8);
800
- }
801
-
802
- // Derive key and IV
803
- if (!hasher) {
804
- var key = EvpKDF.create({ keySize: keySize + ivSize }).compute(password, salt);
805
- } else {
806
- var key = EvpKDF.create({ keySize: keySize + ivSize, hasher: hasher }).compute(password, salt);
807
- }
808
-
809
-
810
- // Separate key and IV
811
- var iv = WordArray.create(key.words.slice(keySize), ivSize * 4);
812
- key.sigBytes = keySize * 4;
813
-
814
- // Return params
815
- return CipherParams.create({ key: key, iv: iv, salt: salt });
816
- }
817
- };
818
-
819
- /**
820
- * A serializable cipher wrapper that derives the key from a password,
821
- * and returns ciphertext as a serializable cipher params object.
822
- */
823
- var PasswordBasedCipher = C_lib.PasswordBasedCipher = SerializableCipher.extend({
824
- /**
825
- * Configuration options.
826
- *
827
- * @property {KDF} kdf The key derivation function to use to generate a key and IV from a password. Default: OpenSSL
828
- */
829
- cfg: SerializableCipher.cfg.extend({
830
- kdf: OpenSSLKdf
831
- }),
832
-
833
- /**
834
- * Encrypts a message using a password.
835
- *
836
- * @param {Cipher} cipher The cipher algorithm to use.
837
- * @param {WordArray|string} message The message to encrypt.
838
- * @param {string} password The password.
839
- * @param {Object} cfg (Optional) The configuration options to use for this operation.
840
- *
841
- * @return {CipherParams} A cipher params object.
842
- *
843
- * @static
844
- *
845
- * @example
846
- *
847
- * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password');
848
- * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password', { format: CryptoJS.format.OpenSSL });
849
- */
850
- encrypt: function (cipher, message, password, cfg) {
851
- // Apply config defaults
852
- cfg = this.cfg.extend(cfg);
853
-
854
- // Derive key and other params
855
- var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, cfg.salt, cfg.hasher);
856
-
857
- // Add IV to config
858
- cfg.iv = derivedParams.iv;
859
-
860
- // Encrypt
861
- var ciphertext = SerializableCipher.encrypt.call(this, cipher, message, derivedParams.key, cfg);
862
-
863
- // Mix in derived params
864
- ciphertext.mixIn(derivedParams);
865
-
866
- return ciphertext;
867
- },
868
-
869
- /**
870
- * Decrypts serialized ciphertext using a password.
871
- *
872
- * @param {Cipher} cipher The cipher algorithm to use.
873
- * @param {CipherParams|string} ciphertext The ciphertext to decrypt.
874
- * @param {string} password The password.
875
- * @param {Object} cfg (Optional) The configuration options to use for this operation.
876
- *
877
- * @return {WordArray} The plaintext.
878
- *
879
- * @static
880
- *
881
- * @example
882
- *
883
- * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, 'password', { format: CryptoJS.format.OpenSSL });
884
- * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, 'password', { format: CryptoJS.format.OpenSSL });
885
- */
886
- decrypt: function (cipher, ciphertext, password, cfg) {
887
- // Apply config defaults
888
- cfg = this.cfg.extend(cfg);
889
-
890
- // Convert string to CipherParams
891
- ciphertext = this._parse(ciphertext, cfg.format);
892
-
893
- // Derive key and other params
894
- var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, ciphertext.salt, cfg.hasher);
895
-
896
- // Add IV to config
897
- cfg.iv = derivedParams.iv;
898
-
899
- // Decrypt
900
- var plaintext = SerializableCipher.decrypt.call(this, cipher, ciphertext, derivedParams.key, cfg);
901
-
902
- return plaintext;
903
- }
904
- });
905
- }());
906
-
907
-
908
- }));
909
- } (cipherCore$1, cipherCore$1.exports));
910
- return cipherCore$1.exports;
911
- }
912
-
913
- export { requireCipherCore as __require };