$Crypto.GetCertificate

Overview

Finds a certificate by given context

Certificate $Crypto.GetCertificate(cert: CertificateContext)

Loads certificate from PFX content

Certificate $Crypto.GetCertificate(cert: string, password: string)

Arguments

CertificateContext cert

Certificate context to find certificate

string password

Password of PFX content

Returns

Certificate if found, otherwise null Array of certificates found in PFX content

Remarks

If multiple certificates found, first one is returned.

If no certificate found, null is returned.

Throws error exception if PKCS11 library or PFX file is not found or failed to load.

Example

Find a certificates from list

var cert = $Crypto.GetCertificate({ Filter: { CommonName: 'The Name' // SerialNumber : '1234' } });

Example

Load certificate from PKCS11 library

var cert = $Crypto.GetCertificate({ Filter: { CommonName: 'The Name' // SerialNumber : '1234' }, Pin: '1111', Library: '<path to PKCS11 library>' });

Example

Load certificate from PFX file

var cert = $Crypto.GetCertificate('base64 encoded pfx content', 'password');

Copyright © 2010 - 2023 Emakin. All rights reserved.