Sample code for 30+ languages & platforms
Xbase++

Example: Crypt2.ClearSigningCerts method

Demonstrates how to call the ClearSigningCerts method.

Chilkat Xbase++ Downloads

Xbase++
LOCAL nSuccess
LOCAL oCrypt
LOCAL oCert1
LOCAL oCert2
LOCAL oCert3
LOCAL oBd
LOCAL oCert4
LOCAL oCert5

nSuccess := 0

oCrypt := CreateObject("Chilkat.Crypt2")
nSuccess := 0

//  Tell the crypt object to use 3 certificates.
//  Do this by calling AddSigningCert for each certificate.

oCert1 := CreateObject("Chilkat.Cert")
//  ...
//  Load the cert from a source such as a .pfx/.p12 file, smart card, USB token, Apple keychain, Windows certificate store, etc.
//  ...
oCrypt:AddSigningCert(oCert1)

oCert2 := CreateObject("Chilkat.Cert")
//  ...
oCrypt:AddSigningCert(oCert2)

oCert3 := CreateObject("Chilkat.Cert")
//  ...
oCrypt:AddSigningCert(oCert3)

oBd := CreateObject("Chilkat.BinData")
//  ...

nSuccess := oCrypt:OpaqueSignBd(oBd)

//  Let's say we now want to sign something else with different certs..
//  First clear the signing certs.
oCrypt:ClearSigningCerts()

oCert4 := CreateObject("Chilkat.Cert")
//  ...
oCrypt:AddSigningCert(oCert4)

oCert5 := CreateObject("Chilkat.Cert")
//  ...
oCrypt:AddSigningCert(oCert5)

//  ...
//  ...

//  Sign using cert4 and cert5.
nSuccess := oCrypt:OpaqueSignBd(oBd)

oCrypt:destroy()
oCert1:destroy()
oCert2:destroy()
oCert3:destroy()
oBd:destroy()
oCert4:destroy()
oCert5:destroy()