forked from node-opcua/node-opcua-crypto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_certificate.ts
34 lines (32 loc) · 974 Bytes
/
test_certificate.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// tslint:disable: no-console
import * as fs from "fs";
import { exploreCertificate, readCertificate } from ".";
async function testCertificate(filename: string): Promise<void> {
const cert1 = await readCertificate(filename);
try {
const info = exploreCertificate(cert1);
// console.log(info);
} catch (err) {
console.log(filename, "err = ", err.message);
}
}
async function testCertificate1(filename: string): Promise<void> {
const cert1 = fs.readFileSync(filename);
try {
const info = exploreCertificate(cert1);
// console.log(info);
} catch (err) {
console.log(filename, "err = ", err.message);
console.log(err);
throw err;
}
}
(async () => {
try {
testCertificate1("./read.cer");
testCertificate1("./unsol.cer");
testCertificate1("./write.cer");
} catch (err) {
console.log("???? ERR !!!! ", err.message);
}
})();