@toolspack/ttd-common 1.1.7 → 1.3.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.
- package/README.md +12 -3
- package/lib/ttd-common.common.js +268 -270
- package/lib/ttd-common.umd.js +268 -270
- package/lib/ttd-common.umd.min.js +2 -2
- package/package.json +1 -1
- package/src/packages/ukey/SignNew.vue +0 -2
- package/src/packages/ukey/Ukey.vue +0 -6
- package/src/packages/ukey/WZHforChrome.js +22 -39
- package/src/packages/ukey/WzhSign.vue +5 -18
- package/src/packages/ukey/WzhSignChrome.vue +27 -17
- package/src/packages/ukey/nmCryptokit.ToToDi.js +0 -14
|
@@ -36,27 +36,38 @@ export default {
|
|
|
36
36
|
this.LoadObj()
|
|
37
37
|
},
|
|
38
38
|
|
|
39
|
-
getUkeyImage() {
|
|
39
|
+
async getUkeyImage(bstrP11Name) {
|
|
40
|
+
// 为了兼容 (新老ukey),获取证书的CSPName
|
|
41
|
+
// 老版本ukey CSPName: CFCA FOR UKEY CSP v1.1.0
|
|
42
|
+
// 新版本ukey CSPName: Uyee CSP v6.0 (Enterprise)
|
|
43
|
+
if (!bstrP11Name) {
|
|
44
|
+
let InfoContent = ''
|
|
45
|
+
await this.SelectCertificateOnClick()
|
|
46
|
+
try {
|
|
47
|
+
InfoContent = await this.GetCertInfoOnClick('CSPName');
|
|
48
|
+
} catch (e) {
|
|
49
|
+
console.log(e)
|
|
50
|
+
}
|
|
51
|
+
if (InfoContent.indexOf('CFCA FOR UKEY CSP') > -1) {
|
|
52
|
+
bstrP11Name = 'CFCA_UKEY_P11.dll'
|
|
53
|
+
} else {
|
|
54
|
+
bstrP11Name = 'UyeePKCS11.Enterprise.dll'
|
|
55
|
+
}
|
|
56
|
+
}
|
|
40
57
|
return new Promise((resolve, reject) => {
|
|
41
|
-
|
|
58
|
+
// 老ukey 获取图片 'CFCA_UKEY_P11.dll'
|
|
59
|
+
// 新ukey 获取图片 'UyeePKCS11.Enterprise.dll'
|
|
60
|
+
this.CryptoAgent.GetSealImage(bstrP11Name).then((response) => {
|
|
42
61
|
resolve(response.result)
|
|
43
|
-
}).catch((
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
resolve(response2.result)
|
|
47
|
-
}).catch((response2) => {
|
|
48
|
-
this.ShowErrorInfo(response2);
|
|
49
|
-
console.log('读取Ukey印章图片失败!')
|
|
50
|
-
reject(response2)
|
|
51
|
-
});
|
|
62
|
+
}).catch((response1) => {
|
|
63
|
+
this.ShowErrorInfo(response1);
|
|
64
|
+
reject(response1)
|
|
52
65
|
});
|
|
53
66
|
})
|
|
54
67
|
},
|
|
55
68
|
GetCertInfoOnClick(InfoTypeID) {
|
|
56
69
|
InfoTypeID = InfoTypeID || 'SubjectDN'
|
|
57
|
-
console.log('GetCertInfoOnClick:InfoTypeID ', InfoTypeID)
|
|
58
70
|
return this.CryptoAgent.GetSignCertInfo(InfoTypeID).then((response) => response.result).catch((e) => {
|
|
59
|
-
console.log('GetCertInfoOnClick-WzhSign: ', e)
|
|
60
71
|
this.ShowErrorInfo(e)
|
|
61
72
|
})
|
|
62
73
|
},
|
|
@@ -92,7 +103,6 @@ export default {
|
|
|
92
103
|
const version = await this.CryptoAgent.GetVersion()
|
|
93
104
|
console.log('CryptoAgent version ', version)
|
|
94
105
|
} catch (response) {
|
|
95
|
-
console.log('GetVersion error', response)
|
|
96
106
|
alert('扩展初始化失败,请联系管理员!')
|
|
97
107
|
this.ShowErrorInfo(response);
|
|
98
108
|
return Promise.reject()
|
|
@@ -104,7 +114,6 @@ export default {
|
|
|
104
114
|
resolve(response.result)
|
|
105
115
|
})
|
|
106
116
|
.catch((response) => {
|
|
107
|
-
console.log('SelectCertificate:', response)
|
|
108
117
|
this.ShowErrorInfo(response);
|
|
109
118
|
reject()
|
|
110
119
|
});
|
|
@@ -139,6 +148,7 @@ export default {
|
|
|
139
148
|
pageX: Number(label.X), // 签章页签章位置X坐标
|
|
140
149
|
pageY: Number(label.Y), // 签章页签章位置Y坐标
|
|
141
150
|
certBase64: CertContent, // 证书公钥
|
|
151
|
+
sealImageSize: params.sealImageSize, // 签章图片大小
|
|
142
152
|
},
|
|
143
153
|
},
|
|
144
154
|
})
|
|
@@ -168,7 +178,7 @@ export default {
|
|
|
168
178
|
},
|
|
169
179
|
async signFileKeyImage(item, fileItem, params) {
|
|
170
180
|
const res = await this.getSignHashValue(item, fileItem, params)
|
|
171
|
-
let errorMsg = '计算Hash
|
|
181
|
+
let errorMsg = '计算Hash失败!'
|
|
172
182
|
if (res) {
|
|
173
183
|
const { data, code } = await this.api.mergeHash({
|
|
174
184
|
jsonData: {
|
|
@@ -189,6 +199,7 @@ export default {
|
|
|
189
199
|
} else {
|
|
190
200
|
errorMsg = data.msg
|
|
191
201
|
}
|
|
202
|
+
console.error(errorMsg)
|
|
192
203
|
}
|
|
193
204
|
this.$message.error(errorMsg || 'error计算Hash失败!')
|
|
194
205
|
return false
|
|
@@ -205,7 +216,6 @@ export default {
|
|
|
205
216
|
return false
|
|
206
217
|
}
|
|
207
218
|
console.log('multipleSign-params= ', localParams)
|
|
208
|
-
|
|
209
219
|
for (let index = 0; index < labels.length; index++) {
|
|
210
220
|
const item = getUrl(labels[index])
|
|
211
221
|
// 此处for循环多个文件时候以前签署,所以提示无意义
|
|
@@ -132,7 +132,6 @@ nmCryptokit.SendMessage = function(browser, requestJSON) {
|
|
|
132
132
|
nmCryptokit.checkExtension = function(browser) {
|
|
133
133
|
return new Promise(function (resolve, reject) {
|
|
134
134
|
var result = new Object();
|
|
135
|
-
// console.log('444', browser)
|
|
136
135
|
if (nmCryptokit.Browser.Chrome == browser || nmCryptokit.Browser.Edg == browser) {
|
|
137
136
|
if(chrome.runtime) {
|
|
138
137
|
resolve(browser);
|
|
@@ -162,10 +161,7 @@ nmCryptokit.checkExtension = function(browser) {
|
|
|
162
161
|
}
|
|
163
162
|
|
|
164
163
|
nmCryptokit.prototype.init = function () {
|
|
165
|
-
|
|
166
164
|
var browser = this.browser;
|
|
167
|
-
console.log('2223', browser)
|
|
168
|
-
|
|
169
165
|
return nmCryptokit.checkExtension(browser)
|
|
170
166
|
.then(function (browser) {
|
|
171
167
|
var request = new Object();
|
|
@@ -190,37 +186,29 @@ nmCryptokit.prototype.init = function () {
|
|
|
190
186
|
|
|
191
187
|
|
|
192
188
|
nmCryptokit.prototype.uninit = function () {
|
|
193
|
-
|
|
194
189
|
var request = new Object();
|
|
195
190
|
request.action = "disconnect";
|
|
196
191
|
request.host = nmCryptokit.productID;
|
|
197
|
-
|
|
198
192
|
return nmCryptokit.SendMessage(this.browser, request);
|
|
199
193
|
}
|
|
200
194
|
|
|
201
195
|
|
|
202
196
|
nmCryptokit.prototype.getExtensionVersion = function ( ) {
|
|
203
|
-
|
|
204
197
|
var request = new Object();
|
|
205
198
|
var funcInfo = new Object();
|
|
206
|
-
|
|
207
199
|
funcInfo.function = "getExtensionVersion";
|
|
208
200
|
funcInfo.params = null;
|
|
209
201
|
request.action = "getExtensionVersion";
|
|
210
202
|
request.funcInfo = funcInfo;
|
|
211
|
-
|
|
212
203
|
return nmCryptokit.SendMessage(this.browser, request);
|
|
213
204
|
}
|
|
214
205
|
|
|
215
206
|
nmCryptokit.prototype.GetSealImage = function (bstrP11Name) {
|
|
216
|
-
|
|
217
207
|
var request = new Object();
|
|
218
208
|
var funcInfo = new Object();
|
|
219
209
|
var paramArr = new Array();
|
|
220
210
|
var randomId = GenerateRandomId();
|
|
221
|
-
|
|
222
211
|
paramArr.push(bstrP11Name);
|
|
223
|
-
|
|
224
212
|
funcInfo.function = "GetSealImage";
|
|
225
213
|
funcInfo.params = paramArr;
|
|
226
214
|
funcInfo.randomId = randomId;
|
|
@@ -240,10 +228,8 @@ nmCryptokit.prototype.getHostVersion = function () {
|
|
|
240
228
|
funcInfo.function = "GetVersion";
|
|
241
229
|
funcInfo.params = null;
|
|
242
230
|
funcInfo.randomId = randomId;
|
|
243
|
-
|
|
244
231
|
request.action = "invoke";
|
|
245
232
|
request.funcInfo = funcInfo;
|
|
246
|
-
|
|
247
233
|
return nmCryptokit.SendMessage(this.browser, request);
|
|
248
234
|
}
|
|
249
235
|
|