egovamap 0.35.48 → 0.35.50
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/egovamap/egovagis.js +16 -0
- package/egovamap/egovagisviewer.js +2 -2
- package/egovamap/utils/aesUtils.js +128 -0
- package/egovamap/utils/crypto-js.js +5988 -0
- package/package.json +1 -1
package/egovamap/egovagis.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import EGovaMMSMap from "./egovamms";
|
|
2
2
|
import MapUtils from "./mapUtils";
|
|
3
|
+
import aesUtils from './utils/aesUtils';
|
|
3
4
|
var scene = null;
|
|
4
5
|
|
|
5
6
|
function getCookie(name) {
|
|
@@ -15,6 +16,13 @@ function setCookie(name, value) {
|
|
|
15
16
|
window.document.cookie = name + "=" + value;
|
|
16
17
|
}
|
|
17
18
|
|
|
19
|
+
function trimEnd(str,c){
|
|
20
|
+
var rg = new RegExp(c);
|
|
21
|
+
var i = str.length;
|
|
22
|
+
while (rg.test(str.charAt(--i)));
|
|
23
|
+
return str.slice(0, i + 1);
|
|
24
|
+
}
|
|
25
|
+
|
|
18
26
|
function checkGisServerURL(url, callback) {
|
|
19
27
|
if (!url) return;
|
|
20
28
|
|
|
@@ -182,6 +190,11 @@ var EGovaGISMap = function (
|
|
|
182
190
|
var gisServerURL = (context.gisServerURL = gisurl);
|
|
183
191
|
var gisProxyURL = context.gisServerURL + "/home/gis/proxy.htm";
|
|
184
192
|
var misServerURL = context.rootPath;
|
|
193
|
+
if(context.encrypt) {
|
|
194
|
+
gisServerURL = aesUtils.egovaEncrypt(trimEnd(context.gisServerURL,"/"), '5E6178C574F953CF', new Date);
|
|
195
|
+
gisProxyURL = aesUtils.egovaEncrypt(trimEnd(context.gisServerURL,"/") + '/home/gis/proxy.htm', '5E6178C574F953CF', new Date);
|
|
196
|
+
misServerURL = aesUtils.egovaEncrypt(misServerURL, '5E6178C574F953CF', new Date);
|
|
197
|
+
}
|
|
185
198
|
var url =
|
|
186
199
|
context.rootPath +
|
|
187
200
|
context.assetsPath +
|
|
@@ -199,6 +212,9 @@ var EGovaGISMap = function (
|
|
|
199
212
|
misServerURL +
|
|
200
213
|
"&humanID=" +
|
|
201
214
|
context.humanID;
|
|
215
|
+
if(context.encrypt) {
|
|
216
|
+
url += "&encrypt=true";
|
|
217
|
+
}
|
|
202
218
|
if (mapConfig != undefined && mapConfig.params != undefined) {
|
|
203
219
|
for (var item in mapConfig.params) {
|
|
204
220
|
url +=
|
|
@@ -711,12 +711,12 @@ var EGovaGISMap = function (
|
|
|
711
711
|
mouseMoveCallback
|
|
712
712
|
) {
|
|
713
713
|
if (scene == null) return;
|
|
714
|
-
var cb = function (type, data) {
|
|
714
|
+
var cb = function (type, data, layerName) {
|
|
715
715
|
if (callback && type == "locateFeatureByIDsCallback") {
|
|
716
716
|
callback(data);
|
|
717
717
|
}
|
|
718
718
|
if (mouseMoveCallback && type != "locateFeatureByIDsCallback") {
|
|
719
|
-
mouseMoveCallback(type, data);
|
|
719
|
+
mouseMoveCallback(type, data, layerName);
|
|
720
720
|
}
|
|
721
721
|
};
|
|
722
722
|
that.callMap(
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import cryptojs from "crypto-js";
|
|
2
|
+
|
|
3
|
+
var lvLength = 16;
|
|
4
|
+
var randomIvBit = "RANDOM_IV";
|
|
5
|
+
var isInitAesParam = false;
|
|
6
|
+
var DEC_CODE = "5E6178C574F953CF";
|
|
7
|
+
var AESUtils = function () {};
|
|
8
|
+
|
|
9
|
+
AESUtils.egovaEncrypt = function (data, aesKey, cbciv) {
|
|
10
|
+
if (aesKey == "" || cbciv == "" || aesKey == null || cbciv == null) {
|
|
11
|
+
return data;
|
|
12
|
+
}
|
|
13
|
+
// 不推荐使用固定IV向量值,建议使用随机IV向量值
|
|
14
|
+
if (randomIvBit) {
|
|
15
|
+
cbciv = AESUtils.genRandomIv();
|
|
16
|
+
}
|
|
17
|
+
// 加密选项
|
|
18
|
+
var CBCOptions = {
|
|
19
|
+
iv: cryptojs.enc.Utf8.parse(cbciv),
|
|
20
|
+
mode: cryptojs.mode.CBC,
|
|
21
|
+
padding: cryptojs.pad.Pkcs7,
|
|
22
|
+
};
|
|
23
|
+
var utf8AesKey = cryptojs.enc.Utf8.parse(aesKey);
|
|
24
|
+
var secretData = cryptojs.enc.Utf8.parse(data);
|
|
25
|
+
var encrypted = cryptojs.AES.encrypt(secretData, utf8AesKey, CBCOptions);
|
|
26
|
+
if (randomIvBit) {
|
|
27
|
+
return randomIvBit + cbciv + encrypted.toString();
|
|
28
|
+
} else {
|
|
29
|
+
return encrypted.toString();
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
AESUtils.egovaDecrypt = function (data) {
|
|
33
|
+
var iv;
|
|
34
|
+
var str;
|
|
35
|
+
if (data.indexOf(randomIvBit) > -1) {
|
|
36
|
+
iv = data.substring(randomIvBit.length, randomIvBit.length + lvLength);
|
|
37
|
+
str = data.substring(randomIvBit.length + lvLength);
|
|
38
|
+
} else {
|
|
39
|
+
// MIS的加密工具,init是异步,兼容没有初始化aesUtils时的加密参数
|
|
40
|
+
iv = new Date();
|
|
41
|
+
str = data;
|
|
42
|
+
}
|
|
43
|
+
var CBCOptions = {
|
|
44
|
+
iv: cryptojs.enc.Utf8.parse(iv),
|
|
45
|
+
mode: cryptojs.mode.CBC,
|
|
46
|
+
padding: cryptojs.pad.Pkcs7,
|
|
47
|
+
};
|
|
48
|
+
var decrypt = cryptojs.AES.decrypt(
|
|
49
|
+
str,
|
|
50
|
+
cryptojs.enc.Utf8.parse(DEC_CODE),
|
|
51
|
+
CBCOptions
|
|
52
|
+
);
|
|
53
|
+
return decrypt.toString(cryptojs.enc.Utf8).toString() || data;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
AESUtils.randomString = function (randomLen, min, max) {
|
|
57
|
+
var str = "",
|
|
58
|
+
range = min,
|
|
59
|
+
arr = [
|
|
60
|
+
"a",
|
|
61
|
+
"b",
|
|
62
|
+
"c",
|
|
63
|
+
"d",
|
|
64
|
+
"e",
|
|
65
|
+
"f",
|
|
66
|
+
"g",
|
|
67
|
+
"h",
|
|
68
|
+
"i",
|
|
69
|
+
"j",
|
|
70
|
+
"k",
|
|
71
|
+
"l",
|
|
72
|
+
"m",
|
|
73
|
+
"n",
|
|
74
|
+
"o",
|
|
75
|
+
"p",
|
|
76
|
+
"q",
|
|
77
|
+
"r",
|
|
78
|
+
"s",
|
|
79
|
+
"t",
|
|
80
|
+
"u",
|
|
81
|
+
"v",
|
|
82
|
+
"w",
|
|
83
|
+
"x",
|
|
84
|
+
"y",
|
|
85
|
+
"z",
|
|
86
|
+
"A",
|
|
87
|
+
"B",
|
|
88
|
+
"C",
|
|
89
|
+
"D",
|
|
90
|
+
"E",
|
|
91
|
+
"F",
|
|
92
|
+
"G",
|
|
93
|
+
"H",
|
|
94
|
+
"I",
|
|
95
|
+
"J",
|
|
96
|
+
"K",
|
|
97
|
+
"L",
|
|
98
|
+
"M",
|
|
99
|
+
"N",
|
|
100
|
+
"O",
|
|
101
|
+
"P",
|
|
102
|
+
"Q",
|
|
103
|
+
"R",
|
|
104
|
+
"S",
|
|
105
|
+
"T",
|
|
106
|
+
"U",
|
|
107
|
+
"V",
|
|
108
|
+
"W",
|
|
109
|
+
"X",
|
|
110
|
+
"Y",
|
|
111
|
+
"Z",
|
|
112
|
+
];
|
|
113
|
+
// 随机产生
|
|
114
|
+
if (randomLen) {
|
|
115
|
+
range = Math.round(Math.random() * (max - min)) + min;
|
|
116
|
+
}
|
|
117
|
+
for (var i = 0; i < range; i++) {
|
|
118
|
+
var pos = Math.round(Math.random() * (arr.length - 1));
|
|
119
|
+
str += arr[pos];
|
|
120
|
+
}
|
|
121
|
+
return str;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
AESUtils.genRandomIv = function () {
|
|
125
|
+
return AESUtils.randomString(false, lvLength);
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
export default AESUtils;
|