Sample code for 30+ languages & platforms
JavaScript

Example: Crypt2.SetSigningCert method

Demonstrates how to call the SetSigningCert method.
Note
This example is intended for running within a Chilkat.Js embedded JavaScript engine. All Chilkat JavaScript examples require Chilkat v11.4.0 or greater.
JavaScript
var success = false;

// Signing certificates can be obtained from many different sources..

// Load from a PFX
var cryptA = new CkCrypt2();
var certA = new CkCert();
success = certA.LoadPfxFile("c:/someDir/pfx_files/a.pfx","pfx_file_password");
success = cryptA.SetSigningCert(certA);
// ...

// Load from a smart card or USB token.
var cryptB = new CkCrypt2();
var certB = new CkCert();
certB.SmartCardPin = "123456";
success = certB.LoadFromSmartcard("");
success = cryptB.SetSigningCert(certB);
// ...

// Load from a the Windows certificate store or macOS keychain
var cryptC = new CkCrypt2();
var certC = new CkCert();
success = certC.LoadByCommonName("Xyz 123");
success = cryptC.SetSigningCert(certC);
// ...