n20-common-lib 2.8.27 → 2.8.28
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
|
@@ -2522,6 +2522,39 @@ function getDN() {
|
|
|
2522
2522
|
return dn
|
|
2523
2523
|
}
|
|
2524
2524
|
|
|
2525
|
+
export function getCert(dn) {
|
|
2526
|
+
if (dn === undefined) {
|
|
2527
|
+
dn = getDN()
|
|
2528
|
+
}
|
|
2529
|
+
if (!dn) {
|
|
2530
|
+
return 'dnIsEmpty'
|
|
2531
|
+
}
|
|
2532
|
+
|
|
2533
|
+
let certs = CertStore.listAllCerts()
|
|
2534
|
+
if (certs.size() > 0) {
|
|
2535
|
+
let sginCert = null
|
|
2536
|
+
for (let i = 0; i < certs.size(); i++) {
|
|
2537
|
+
let cert = certs.get(i)
|
|
2538
|
+
/**
|
|
2539
|
+
* cert.serialNumber()通过序列号校验唯一值 中兴项目需求
|
|
2540
|
+
*/
|
|
2541
|
+
let t =
|
|
2542
|
+
process.env.VUE_APP_NetSign_ARG_TYPE === 'serialNumber' || window.VUE_APP_NetSign_ARG_TYPE === 'serialNumber'
|
|
2543
|
+
? cert.serialNumber()
|
|
2544
|
+
: cert.subject()
|
|
2545
|
+
if (t == dn) {
|
|
2546
|
+
sginCert = cert
|
|
2547
|
+
break
|
|
2548
|
+
}
|
|
2549
|
+
}
|
|
2550
|
+
if (!sginCert) {
|
|
2551
|
+
return -1
|
|
2552
|
+
}
|
|
2553
|
+
} else {
|
|
2554
|
+
return 'dnListEmpty'
|
|
2555
|
+
}
|
|
2556
|
+
}
|
|
2557
|
+
|
|
2525
2558
|
// 签名方法
|
|
2526
2559
|
export function getSign(plain, dn) {
|
|
2527
2560
|
try {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import importG from '../../utils/importGlobal.js'
|
|
2
2
|
|
|
3
3
|
import CaMap from './CaMap.js'
|
|
4
|
+
import { getCert as itrusGetCert } from './Itrus/index'
|
|
4
5
|
import { getCertInfo as NetSM3 } from './NetSM3/index'
|
|
5
6
|
import { getCertInfo as SkfSign } from './SkfSign/index'
|
|
6
7
|
import { getCertInfo } from './sign'
|
|
@@ -118,6 +119,8 @@ export function getCert(dn) {
|
|
|
118
119
|
return SkfSign(dn)
|
|
119
120
|
} else if (signType === 'NetSM3') {
|
|
120
121
|
return NetSM3(dn)
|
|
122
|
+
} else if (signType === 'ItrusSign') {
|
|
123
|
+
return itrusGetCert(dn)
|
|
121
124
|
}
|
|
122
125
|
}
|
|
123
126
|
|