Sample code for 30+ languages & platforms
Swift

Example: Crypt2.ClearSigningCerts method

Demonstrates how to call the ClearSigningCerts method.

Chilkat Swift Downloads

Swift

func chilkatTest() {
    var success: Bool = false

    let crypt = CkoCrypt2()!
    success = false

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

    let cert1 = CkoCert()!
    // ...
    // Load the cert from a source such as a .pfx/.p12 file, smart card, USB token, Apple keychain, Windows certificate store, etc.
    // ...
    crypt.addSigningCert(cert: cert1)

    let cert2 = CkoCert()!
    // ...
    crypt.addSigningCert(cert: cert2)

    let cert3 = CkoCert()!
    // ...
    crypt.addSigningCert(cert: cert3)

    let bd = CkoBinData()!
    // ...

    success = crypt.opaqueSignBd(bd: bd)

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

    let cert4 = CkoCert()!
    // ...
    crypt.addSigningCert(cert: cert4)

    let cert5 = CkoCert()!
    // ...
    crypt.addSigningCert(cert: cert5)

    // ...
    // ...

    // Sign using cert4 and cert5.
    success = crypt.opaqueSignBd(bd: bd)

}