Skip to content

Commit bb58fd0

Browse files
committed
fix(examples): Error on PEM certificate parsing
1 parent 253ac40 commit bb58fd0

File tree

1 file changed

+5
-1
lines changed
  • examples/CertificateComplexExample

1 file changed

+5
-1
lines changed

examples/CertificateComplexExample/es6.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ function parseCertificate() {
3737
//#endregion
3838

3939
//#region Decode existing X.509 certificate
40-
const certificate = pkijs.Certificate.fromBER(certificateBuffer);
40+
const certificates = common.parseCertificate(certificateBuffer);
41+
if (!certificates.length) {
42+
throw new Error("Cannot get certificate from the file");
43+
}
44+
const certificate = certificates[0];
4145
//#endregion
4246

4347
//#region Put information about X.509 certificate issuer

0 commit comments

Comments
 (0)