n20-common-lib 2.13.4 → 2.13.6
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/package.json
CHANGED
|
@@ -12,6 +12,7 @@ const {
|
|
|
12
12
|
IWSAGetAllCertsListInfo
|
|
13
13
|
} = new IWSAgent()
|
|
14
14
|
IWSASetTimeOut(6000)
|
|
15
|
+
let certType = 'RSA'
|
|
15
16
|
let certDN = ''
|
|
16
17
|
function getDN() {
|
|
17
18
|
let dn
|
|
@@ -111,7 +112,7 @@ export function getCertInfo(dn) {
|
|
|
111
112
|
reject()
|
|
112
113
|
}
|
|
113
114
|
if (dnList.length === 0) {
|
|
114
|
-
Message.error('
|
|
115
|
+
Message.error('用户证书信息与当前用户不匹配!')
|
|
115
116
|
reject()
|
|
116
117
|
}
|
|
117
118
|
|
|
@@ -128,12 +129,16 @@ export function getCertInfo(dn) {
|
|
|
128
129
|
* @returns {Promise<string>} 签名后的密文信息
|
|
129
130
|
*/
|
|
130
131
|
export async function performSign(plain, index) {
|
|
132
|
+
let certStoreType = 2
|
|
133
|
+
if (certType === 'RSA') {
|
|
134
|
+
certStoreType = 1
|
|
135
|
+
}
|
|
131
136
|
let signMethod = IWSAAttachedSignAdvDefaultDN
|
|
132
137
|
if (window.NetSignMethod === 'Detached') {
|
|
133
138
|
signMethod = IWSADetachedSignAdvDefaultDN
|
|
134
139
|
}
|
|
135
140
|
return new Promise((resolve, reject) => {
|
|
136
|
-
signMethod(plain, 'infosec.sm2',
|
|
141
|
+
signMethod(plain, 'infosec.sm2', certStoreType, certDN, '1', 'SHA1', (errorCode, signedData) => {
|
|
137
142
|
if (errorCode === 0 || errorCode === '0') {
|
|
138
143
|
resolve(signedData)
|
|
139
144
|
} else {
|
|
@@ -158,6 +163,7 @@ function verifyDn(dnList, dn) {
|
|
|
158
163
|
let dnAttrsArr = C.certDN.split(',').map((c) => c.trim())
|
|
159
164
|
if (dnAttrsArr.every((dnAttr) => userDnAttrsArr.includes(dnAttr))) {
|
|
160
165
|
index = i
|
|
166
|
+
certType = C.CertType
|
|
161
167
|
certDN = C.certDN // 保存证书DN到全局变量中 =
|
|
162
168
|
return true
|
|
163
169
|
}
|