Skip to content

AddTrustedCertificate

Adds the specified certificate as a trusted root certificate.

1
$Crypto.AddTrustedCertificate(cert: Certificate):void

Parameters

Certificate cert
    The certificate to add as a trusted root certificate.

Remarks

The certificate is added to the trusted root certificates to be used in verification operations.

Examples

Trust a private root certificate before verifying

1
2
3
4
5
6
// Base64 content and password of a PFX file that contains the root certificate
var root = $Crypto.GetCertificate($Files.GetBase64($Xml.Evaluate('RootCertificateFile')), '')[0];
$Crypto.AddTrustedCertificate(root);

var result = $Crypto.VerifyFile($Xml.Evaluate('SignedFile'));
$Xml.SetValue('SignatureValid', result.AllValid);