Sample code for 30+ languages & platforms
PureBasic

Example: Crypt2.AddPfxSourceFile method

Demonstrates how to call the AddPfxSourceFile method.

Chilkat PureBasic Downloads

PureBasic
IncludeFile "CkCrypt2.pb"

Procedure ChilkatExample()

    success.i = 0

    crypt.i = CkCrypt2::ckCreate()
    If crypt.i = 0
        Debug "Failed to create object."
        ProcedureReturn
    EndIf

    success = 0

    ; Do public-key decryption (RSA)
    CkCrypt2::setCkCryptAlgorithm(crypt, "pki")

    ; ...
    ; ...
    ; ...

    pfxPath.s = "c:/my_pfx_files/a.pfx"
    pfxPassword.s = "secret1"
    success = CkCrypt2::ckAddPfxSourceFile(crypt,pfxPath,pfxPassword)
    If success = 0
        Debug CkCrypt2::ckLastErrorText(crypt)
        CkCrypt2::ckDispose(crypt)
        ProcedureReturn
    EndIf

    ; Add as many as PFX sources as desired...
    pfxPath = "c:/my_pfx_files/b.pfx"
    pfxPassword = "secret2"
    success = CkCrypt2::ckAddPfxSourceFile(crypt,pfxPath,pfxPassword)
    If success = 0
        Debug CkCrypt2::ckLastErrorText(crypt)
        CkCrypt2::ckDispose(crypt)
        ProcedureReturn
    EndIf

    ; ...
    ; ...


    CkCrypt2::ckDispose(crypt)


    ProcedureReturn
EndProcedure