n20-common-lib 2.14.21 → 2.14.23

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n20-common-lib",
3
- "version": "2.14.21",
3
+ "version": "2.14.23",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -1,6 +1,8 @@
1
1
  .el-message {
2
2
  padding-top: 12px;
3
3
  padding-bottom: 12px;
4
+ overflow-wrap: anywhere;
5
+ max-width: 80%;
4
6
  }
5
7
 
6
8
  .el-message-box {
@@ -46,7 +48,7 @@
46
48
  border-color: var(--color-primary-hover);
47
49
  }
48
50
 
49
- & .el-button+.el-button {
51
+ & .el-button + .el-button {
50
52
  margin-left: 0;
51
53
  margin-right: 16px;
52
54
  }
@@ -101,7 +103,7 @@
101
103
  border-color: var(--color-primary-hover);
102
104
  }
103
105
 
104
- & .el-button+.el-button {
106
+ & .el-button + .el-button {
105
107
  margin-left: 0;
106
108
  margin-right: 16px;
107
109
  }
@@ -160,7 +162,7 @@
160
162
  }
161
163
 
162
164
  .el-message--success {
163
- border: 1px solid rgba(72, 210, 160, 0.40);
165
+ border: 1px solid rgba(72, 210, 160, 0.4);
164
166
  }
165
167
 
166
168
  .el-message--error {
@@ -171,7 +173,6 @@
171
173
  border: 1px solid #ffe28d;
172
174
  }
173
175
 
174
-
175
176
  .message-por.el-message--info {
176
177
  .el-message__icon {
177
178
  color: $--color-primary;
@@ -190,7 +191,6 @@
190
191
  color: $--color-text-regular;
191
192
  }
192
193
 
193
-
194
194
  .el-message--success .el-message__content {
195
195
  color: $--color-text-regular;
196
196
  }
@@ -213,4 +213,4 @@
213
213
 
214
214
  .el-message-box__status.el-icon-info {
215
215
  color: $--messagebox-warning-color;
216
- }
216
+ }
@@ -16,7 +16,9 @@ let {
16
16
  SKF_EnumContainer,
17
17
  SKF_OpenContainer,
18
18
  SKF_PKCS7SignData,
19
- SKF_VerifyPIN
19
+ SKF_VerifyPIN,
20
+ SKF_ExportCertificate,
21
+ SKF_ParseCert
20
22
  } = new SKF(location.port, 'http://127.0.0.1:2020/ssm/ukey/')
21
23
 
22
24
  function IWSAGetAvailable() {
@@ -73,6 +75,7 @@ export async function getSign(plain, dn = getDN()) {
73
75
 
74
76
  // 获取并验证证书信息
75
77
  const checkRes = await getCertInfo(dn)
78
+ console.log('checkRes', checkRes)
76
79
  if (checkRes === -1) {
77
80
  return ''
78
81
  }
@@ -85,9 +88,10 @@ export async function getSign(plain, dn = getDN()) {
85
88
  closeOnClickModal: false,
86
89
  inputType: 'password'
87
90
  })
91
+
88
92
  return await performSign(plainText, pin, checkRes)
89
93
  } catch (error) {
90
- return Promise.reject(error)
94
+ return ''
91
95
  }
92
96
  }
93
97
 
@@ -115,27 +119,45 @@ export async function getCertInfo(dn) {
115
119
  var rv = SKF_EnumDev(1) // 1: 获取ukey列表
116
120
  if (rv.DevList.length === 0) {
117
121
  Message.error('没有检测到Ukey!')
118
- reject()
119
- return -1
122
+ resolve(-1)
123
+ return
120
124
  }
121
125
  } catch (error) {
122
126
  checkAvailable()
123
- reject()
127
+ resolve(-1)
128
+ return
124
129
  }
125
-
126
- var rv1 = SKF_ConnectDev(rv.DevList) // 连接设备
127
- var rv2 = SKF_EnumApplication(rv1.DevHandle) // 获取容器
128
- var rv3 = SKF_OpenApplication(rv1.DevHandle, rv2.ApplicationList)
129
- var rv4 = SKF_EnumContainer(rv3.Application)
130
+ const rvList = rv.DevList?.split(',')
131
+ let indexDn = -1
132
+ let Container = ''
133
+ let Application = ''
134
+ let DNList = []
135
+ rvList.forEach((item) => {
136
+ var rv1 = SKF_ConnectDev(item) // 连接设备
137
+ var rv2 = SKF_EnumApplication(rv1.DevHandle) // 获取容器
138
+ var rv3 = SKF_OpenApplication(rv1.DevHandle, rv2.ApplicationList)
139
+ var rv4 = SKF_EnumContainer(rv3.Application)
140
+ var rvList4 = rv4.ContainerList?.split(',')
141
+ rvList4.forEach((item2, index) => {
142
+ var rv5 = SKF_OpenContainer(rv3.Application, item2)
143
+ var rv6 = SKF_ExportCertificate(rv5.Container, true)
144
+ var rv7 = SKF_ParseCert(rv6.Cert)
145
+ DNList.push(rv7.Subject)
146
+ if (rv7.Subject === dn) {
147
+ indexDn = index
148
+ Container = rv5.Container
149
+ Application = rv3.Application
150
+ }
151
+ })
152
+ })
130
153
  // 检测dn是否匹配
131
- /* if (rv4.ContainerList !== 'BBC92E49-4084-4d87-8037-45774F842202') {
154
+ if (indexDn === -1) {
155
+ console.log(DNList)
132
156
  Message.error('当前Ukey不匹配!')
133
- reject()
134
- return -1
157
+ resolve(-1)
135
158
  } else {
136
- resolve({ ContainerList: rv4.ContainerList, Application: rv3.Application })
137
- } */
138
- resolve({ ContainerList: rv4.ContainerList, Application: rv3.Application })
159
+ resolve({ Container, Application })
160
+ }
139
161
  })
140
162
  }
141
163
 
@@ -145,7 +167,7 @@ export async function getCertInfo(dn) {
145
167
  * @param value
146
168
  * @returns {Promise<*>}
147
169
  */
148
- async function performSign(plainText, value, { ContainerList, Application }) {
170
+ async function performSign(plainText, value, { Container, Application }) {
149
171
  return new Promise((resolve, reject) => {
150
172
  var rv5 = SKF_VerifyPIN(Application, 1, value)
151
173
  console.log(rv5)
@@ -154,31 +176,12 @@ async function performSign(plainText, value, { ContainerList, Application }) {
154
176
  reject()
155
177
  return false
156
178
  }
157
- var rv6 = SKF_OpenContainer(Application, ContainerList)
158
- var rv7 = SKF_PKCS7SignData(rv6.Container, plainText)
179
+ var rv7 = SKF_PKCS7SignData(Container, plainText)
159
180
  if (rv7.Status === 0) {
160
- resolve(rv7.Signature + '@@@' + rv6.Container)
181
+ resolve(rv7.Signature + '@@@' + Container)
161
182
  } else {
162
183
  Message.error('签名失败!')
163
184
  reject()
164
185
  }
165
186
  })
166
187
  }
167
-
168
- /* 签名解签 */
169
- export async function verifySign(signedMsg) {
170
- let plainText
171
- await new Promise((resolve, reject) => {
172
- IWSASkfVerifySignData(signedMsg, (errorCode, PlainText, certDN) => {
173
- if (errorCode === 0 || errorCode === '0') {
174
- plainText = PlainText
175
- resolve()
176
- } else {
177
- Message.error(codeDate[errorCode])
178
- reject()
179
- }
180
- })
181
- })
182
-
183
- return Promise.resolve(plainText)
184
- }