n20-common-lib 2.9.28 → 2.9.30
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 +1 -1
- package/src/components/AdvancedFilter/index.vue +1 -1
- package/src/components/ApprovalCard/index.vue +4 -1
- package/src/components/ApprovalRecord/approvalImgPro/index.vue +2 -0
- package/src/plugins/Sign/sign.js +56 -51
- package/src/plugins/Sign/{sign_fix.js → sign_back.js} +49 -53
package/package.json
CHANGED
|
@@ -401,7 +401,7 @@ export default {
|
|
|
401
401
|
}
|
|
402
402
|
}
|
|
403
403
|
this.checkList = this.GroupData.map((res) => res.id)
|
|
404
|
-
this.cancelCheck =
|
|
404
|
+
this.cancelCheck = XEUtils.clone(this.checkList, true)
|
|
405
405
|
// 查找排序,在this.filterList中查找this.checkList中的每一项,并将其排在前面
|
|
406
406
|
this.filterList = this.filterList.sort((a, b) => {
|
|
407
407
|
if (this.checkList.includes(a[this.onlyKey]) && !this.checkList.includes(b[this.onlyKey])) {
|
|
@@ -244,6 +244,8 @@ export default {
|
|
|
244
244
|
return prefix + 'danger'
|
|
245
245
|
case status.end:
|
|
246
246
|
return prefix + 'primary'
|
|
247
|
+
case status.revocation:
|
|
248
|
+
return prefix + 'warning'
|
|
247
249
|
default:
|
|
248
250
|
return undefined
|
|
249
251
|
}
|
|
@@ -272,7 +274,8 @@ export default {
|
|
|
272
274
|
approval: 2,
|
|
273
275
|
reject: 3,
|
|
274
276
|
invalid: 4,
|
|
275
|
-
end: 5
|
|
277
|
+
end: 5,
|
|
278
|
+
revocation: 6
|
|
276
279
|
})
|
|
277
280
|
},
|
|
278
281
|
approvalData: {
|
package/src/plugins/Sign/sign.js
CHANGED
|
@@ -55,10 +55,14 @@ function checkAvailable(fn, url, count) {
|
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
/**
|
|
59
|
+
* 签名解签函数
|
|
60
|
+
* @param {string} signedMsg 要解签的密文
|
|
61
|
+
* @returns {string} 解签后的明文
|
|
62
|
+
*/
|
|
59
63
|
export function verifySign(signedMsg) {
|
|
60
64
|
let plainText
|
|
61
|
-
IWSAAttachedVerify('1', signedMsg, (errorCode, PlainText
|
|
65
|
+
IWSAAttachedVerify('1', signedMsg, (errorCode, PlainText) => {
|
|
62
66
|
if (errorCode === 0 || errorCode === '0') {
|
|
63
67
|
plainText = PlainText
|
|
64
68
|
} else {
|
|
@@ -68,50 +72,46 @@ export function verifySign(signedMsg) {
|
|
|
68
72
|
return plainText
|
|
69
73
|
}
|
|
70
74
|
|
|
71
|
-
|
|
75
|
+
/**
|
|
76
|
+
* 签名函数
|
|
77
|
+
* @param {string} plain 要签名的明文
|
|
78
|
+
* @param {string} dn 用户对应的Dn
|
|
79
|
+
* @returns {Promise<string>} 签名后的密文信息
|
|
80
|
+
*/
|
|
72
81
|
export async function getSign(plain, dn) {
|
|
73
82
|
let index = await getCertInfo(dn)
|
|
74
|
-
if (index === -1
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
Message.warning('没有匹配到证书!')
|
|
78
|
-
break
|
|
79
|
-
case 'dnIsEmpty':
|
|
80
|
-
Message.warning('DN参数为空!')
|
|
81
|
-
break
|
|
82
|
-
case 'Empty':
|
|
83
|
-
Message.warning('当前Ukey不匹配!')
|
|
84
|
-
break
|
|
85
|
-
default:
|
|
86
|
-
Message.warning('没有匹配到证书!')
|
|
87
|
-
}
|
|
88
|
-
return ''
|
|
89
|
-
}
|
|
90
|
-
let plainText = ''
|
|
91
|
-
if (typeof plain === 'object') {
|
|
92
|
-
plainText = JSON.stringify(plain)
|
|
93
|
-
} else {
|
|
94
|
-
plainText = plain
|
|
95
|
-
}
|
|
83
|
+
if (index === -1) return
|
|
84
|
+
let plainText = typeof plain === 'object' ? JSON.stringify(plain) : plain
|
|
85
|
+
|
|
96
86
|
return await performSign(plainText, index)
|
|
97
87
|
}
|
|
98
88
|
|
|
99
89
|
/**
|
|
100
90
|
* 获取证书信息
|
|
101
|
-
* @param dn
|
|
102
|
-
* @returns {
|
|
91
|
+
* @param {string} dn 要验证的Dn
|
|
92
|
+
* @returns {Promise} - 解析后的证书信息
|
|
103
93
|
*/
|
|
104
94
|
export function getCertInfo(dn) {
|
|
105
95
|
if (dn === undefined) {
|
|
106
96
|
dn = getDN()
|
|
107
97
|
}
|
|
108
98
|
if (!dn) {
|
|
109
|
-
Message.error('
|
|
99
|
+
Message.error('没有获取到签名参数DN!')
|
|
110
100
|
return false
|
|
111
101
|
}
|
|
112
102
|
return new Promise((resolve, reject) => {
|
|
113
103
|
let certInfo
|
|
114
104
|
IWSAGetAllCertsListInfoByCertDN('', 'Sign', parseCA(dn), 0, (dnList) => {
|
|
105
|
+
if (!dn) {
|
|
106
|
+
reject('没有获取到签名参数DN!')
|
|
107
|
+
}
|
|
108
|
+
if (!dnList) {
|
|
109
|
+
reject('没有获取到证书列表!')
|
|
110
|
+
}
|
|
111
|
+
if (dnList.length === 0) {
|
|
112
|
+
reject('获取到的证书列表为空!')
|
|
113
|
+
}
|
|
114
|
+
|
|
115
115
|
certInfo = verifyDn(dnList, dn)
|
|
116
116
|
resolve(certInfo)
|
|
117
117
|
})
|
|
@@ -119,54 +119,59 @@ export function getCertInfo(dn) {
|
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
/**
|
|
122
|
-
*
|
|
123
|
-
* @param plain
|
|
124
|
-
* @param index
|
|
125
|
-
* @returns {
|
|
122
|
+
* 执行签名函数
|
|
123
|
+
* @param {string} plain 要签名的明文
|
|
124
|
+
* @param index 签名的证书索引
|
|
125
|
+
* @returns {Promise<string>} 签名后的密文信息
|
|
126
126
|
*/
|
|
127
127
|
export async function performSign(plain, index) {
|
|
128
128
|
return new Promise((resolve, reject) => {
|
|
129
|
-
let answer
|
|
130
129
|
IWSAAttachedSign('1', plain, index, 'SHA1', (errorCode, signedData) => {
|
|
131
130
|
if (errorCode === 0 || errorCode === '0') {
|
|
132
131
|
resolve(signedData)
|
|
133
132
|
} else {
|
|
134
133
|
Message.error('签名失败!')
|
|
135
|
-
reject()
|
|
134
|
+
reject(errorCode)
|
|
136
135
|
}
|
|
137
136
|
})
|
|
138
137
|
})
|
|
139
138
|
}
|
|
140
|
-
|
|
139
|
+
/**
|
|
140
|
+
* 从Dn中获取CN
|
|
141
|
+
* @param {string} dn 要解析的Dn
|
|
142
|
+
* @returns {string} 解析后的CN
|
|
143
|
+
*/
|
|
141
144
|
function parseCA(dn) {
|
|
142
145
|
const mark = /^CN=/
|
|
143
|
-
let
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
let booked = dn.split(',')
|
|
147
|
-
let dnC = booked.find((b) => mark.test(b))
|
|
148
|
-
dnC && (cn = dnC.replace(mark, ''))
|
|
149
|
-
return cn
|
|
146
|
+
let CN = dn.split(',').find((b) => mark.test(b))
|
|
147
|
+
return CN ? CN.replace(mark, '') : ''
|
|
150
148
|
}
|
|
151
149
|
|
|
150
|
+
/**
|
|
151
|
+
* 验证Dn是否存在于Dn列表中
|
|
152
|
+
* @param {Array} dnList 获取到的Dn列表
|
|
153
|
+
* @param {string} dn 要验证的Dn
|
|
154
|
+
* @returns {number} - 如果找到匹配的 DN,则返回其在 dnList 中的索引;如果未找到,则返回 -1
|
|
155
|
+
*/
|
|
152
156
|
function verifyDn(dnList, dn) {
|
|
153
|
-
if (dnList.length === 0) return 'dnListEmpty'
|
|
154
|
-
if (!dnList) return 'Empty'
|
|
155
|
-
if (!dn) return 'dnIsEmpty'
|
|
156
|
-
|
|
157
157
|
let userDnAttrsArr = dn.split(',').map((c) => c.trim())
|
|
158
158
|
|
|
159
|
-
let
|
|
160
|
-
let index = 0
|
|
159
|
+
let index = -1
|
|
161
160
|
dnList.find((C, i) => {
|
|
162
161
|
let dnAttrsArr = C.certDN.split(',').map((c) => c.trim())
|
|
163
162
|
if (dnAttrsArr.every((dnAttr) => userDnAttrsArr.includes(dnAttr))) {
|
|
164
163
|
index = i
|
|
165
|
-
return
|
|
164
|
+
return true
|
|
166
165
|
}
|
|
167
166
|
})
|
|
168
|
-
if (
|
|
169
|
-
|
|
167
|
+
if (index === -1) {
|
|
168
|
+
let dnList = dnList?.map((res) => res.certDN)?.join(',')
|
|
169
|
+
Message({
|
|
170
|
+
type: 'error',
|
|
171
|
+
text: `证书Dn不匹配:${dnList}里面无法匹配===>${dn}`,
|
|
172
|
+
duration: 5000
|
|
173
|
+
})
|
|
174
|
+
return index
|
|
170
175
|
}
|
|
171
176
|
return index
|
|
172
177
|
}
|
|
@@ -55,14 +55,10 @@ function checkAvailable(fn, url, count) {
|
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
* 签名解签函数
|
|
60
|
-
* @param {string} signedMsg 要解签的密文
|
|
61
|
-
* @returns {string} 解签后的明文
|
|
62
|
-
*/
|
|
58
|
+
/* 签名解签 */
|
|
63
59
|
export function verifySign(signedMsg) {
|
|
64
60
|
let plainText
|
|
65
|
-
IWSAAttachedVerify('1', signedMsg, (errorCode, PlainText) => {
|
|
61
|
+
IWSAAttachedVerify('1', signedMsg, (errorCode, PlainText, SigncertDN) => {
|
|
66
62
|
if (errorCode === 0 || errorCode === '0') {
|
|
67
63
|
plainText = PlainText
|
|
68
64
|
} else {
|
|
@@ -72,54 +68,50 @@ export function verifySign(signedMsg) {
|
|
|
72
68
|
return plainText
|
|
73
69
|
}
|
|
74
70
|
|
|
75
|
-
|
|
76
|
-
* 签名函数
|
|
77
|
-
* @param {string} plain 要签名的明文
|
|
78
|
-
* @param {string} dn 用户对应的Dn
|
|
79
|
-
* @returns {Promise<string>} 签名后的密文信息
|
|
80
|
-
*/
|
|
71
|
+
/* 给对象或字符串签名 */
|
|
81
72
|
export async function getSign(plain, dn) {
|
|
82
73
|
let index = await getCertInfo(dn)
|
|
83
|
-
if (index === -1) {
|
|
84
|
-
|
|
85
|
-
|
|
74
|
+
if (index === -1 || ['dnListEmpty', 'dnIsEmpty', 'Empty'].includes(index)) {
|
|
75
|
+
switch (index) {
|
|
76
|
+
case 'dnListEmpty':
|
|
77
|
+
Message.warning('没有匹配到证书!')
|
|
78
|
+
break
|
|
79
|
+
case 'dnIsEmpty':
|
|
80
|
+
Message.warning('DN参数为空!')
|
|
81
|
+
break
|
|
82
|
+
case 'Empty':
|
|
83
|
+
Message.warning('当前Ukey不匹配!')
|
|
84
|
+
break
|
|
85
|
+
default:
|
|
86
|
+
Message.warning('没有匹配到证书!')
|
|
87
|
+
}
|
|
88
|
+
return ''
|
|
86
89
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
+
let plainText = ''
|
|
91
|
+
if (typeof plain === 'object') {
|
|
92
|
+
plainText = JSON.stringify(plain)
|
|
93
|
+
} else {
|
|
94
|
+
plainText = plain
|
|
90
95
|
}
|
|
91
|
-
|
|
92
|
-
let plainText = typeof plain === 'object' ? JSON.stringify(plain) : plain
|
|
93
|
-
|
|
94
96
|
return await performSign(plainText, index)
|
|
95
97
|
}
|
|
96
98
|
|
|
97
99
|
/**
|
|
98
100
|
* 获取证书信息
|
|
99
|
-
* @param
|
|
100
|
-
* @returns {
|
|
101
|
+
* @param dn
|
|
102
|
+
* @returns {*|string|boolean}
|
|
101
103
|
*/
|
|
102
104
|
export function getCertInfo(dn) {
|
|
103
105
|
if (dn === undefined) {
|
|
104
106
|
dn = getDN()
|
|
105
107
|
}
|
|
106
108
|
if (!dn) {
|
|
107
|
-
Message.error('
|
|
109
|
+
Message.error('签名参数DN错误!')
|
|
108
110
|
return false
|
|
109
111
|
}
|
|
110
112
|
return new Promise((resolve, reject) => {
|
|
111
113
|
let certInfo
|
|
112
114
|
IWSAGetAllCertsListInfoByCertDN('', 'Sign', parseCA(dn), 0, (dnList) => {
|
|
113
|
-
if (!dn) {
|
|
114
|
-
reject('没有获取到签名参数DN!')
|
|
115
|
-
}
|
|
116
|
-
if (!dnList) {
|
|
117
|
-
reject('没有获取到证书列表!')
|
|
118
|
-
}
|
|
119
|
-
if (dnList.length === 0) {
|
|
120
|
-
reject('获取到的证书列表为空!')
|
|
121
|
-
}
|
|
122
|
-
|
|
123
115
|
certInfo = verifyDn(dnList, dn)
|
|
124
116
|
resolve(certInfo)
|
|
125
117
|
})
|
|
@@ -127,13 +119,14 @@ export function getCertInfo(dn) {
|
|
|
127
119
|
}
|
|
128
120
|
|
|
129
121
|
/**
|
|
130
|
-
*
|
|
131
|
-
* @param
|
|
132
|
-
* @param index
|
|
133
|
-
* @returns {
|
|
122
|
+
* 执行签名
|
|
123
|
+
* @param plain
|
|
124
|
+
* @param index
|
|
125
|
+
* @returns {*|string}
|
|
134
126
|
*/
|
|
135
127
|
export async function performSign(plain, index) {
|
|
136
128
|
return new Promise((resolve, reject) => {
|
|
129
|
+
let answer
|
|
137
130
|
IWSAAttachedSign('1', plain, index, 'SHA1', (errorCode, signedData) => {
|
|
138
131
|
if (errorCode === 0 || errorCode === '0') {
|
|
139
132
|
resolve(signedData)
|
|
@@ -144,33 +137,36 @@ export async function performSign(plain, index) {
|
|
|
144
137
|
})
|
|
145
138
|
})
|
|
146
139
|
}
|
|
147
|
-
|
|
148
|
-
* 从Dn中获取CN
|
|
149
|
-
* @param {string} dn 要解析的Dn
|
|
150
|
-
* @returns {string} 解析后的CN
|
|
151
|
-
*/
|
|
140
|
+
|
|
152
141
|
function parseCA(dn) {
|
|
153
142
|
const mark = /^CN=/
|
|
154
|
-
let
|
|
155
|
-
|
|
143
|
+
let cn = ''
|
|
144
|
+
if (dn == null) return cn
|
|
145
|
+
|
|
146
|
+
let booked = dn.split(',')
|
|
147
|
+
let dnC = booked.find((b) => mark.test(b))
|
|
148
|
+
dnC && (cn = dnC.replace(mark, ''))
|
|
149
|
+
return cn
|
|
156
150
|
}
|
|
157
151
|
|
|
158
|
-
/**
|
|
159
|
-
* 验证Dn是否存在于Dn列表中
|
|
160
|
-
* @param {Array} dnList 获取到的Dn列表
|
|
161
|
-
* @param {string} dn 要验证的Dn
|
|
162
|
-
* @returns {number} - 如果找到匹配的 DN,则返回其在 dnList 中的索引;如果未找到,则返回 -1
|
|
163
|
-
*/
|
|
164
152
|
function verifyDn(dnList, dn) {
|
|
153
|
+
if (dnList.length === 0) return 'dnListEmpty'
|
|
154
|
+
if (!dnList) return 'Empty'
|
|
155
|
+
if (!dn) return 'dnIsEmpty'
|
|
156
|
+
|
|
165
157
|
let userDnAttrsArr = dn.split(',').map((c) => c.trim())
|
|
166
158
|
|
|
167
|
-
let
|
|
159
|
+
let isIn = false
|
|
160
|
+
let index = 0
|
|
168
161
|
dnList.find((C, i) => {
|
|
169
162
|
let dnAttrsArr = C.certDN.split(',').map((c) => c.trim())
|
|
170
163
|
if (dnAttrsArr.every((dnAttr) => userDnAttrsArr.includes(dnAttr))) {
|
|
171
164
|
index = i
|
|
172
|
-
return true
|
|
165
|
+
return (isIn = true)
|
|
173
166
|
}
|
|
174
167
|
})
|
|
168
|
+
if (!isIn) {
|
|
169
|
+
index = -1
|
|
170
|
+
}
|
|
175
171
|
return index
|
|
176
172
|
}
|