Sample code for 30+ languages & platforms
PureBasic

Example: Crypt2.AddPfxSourceBd method

Demonstrates how to call the AddPfxSourceBd method.

Chilkat PureBasic Downloads

PureBasic
IncludeFile "CkCrypt2.pb"
IncludeFile "CkBinData.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")

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

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

    success = CkBinData::ckLoadFile(bdPfx,"c:/my_pfx_files/a.pfx")
    ; ...

    pfxPassword.s = "secret1"
    success = CkCrypt2::ckAddPfxSourceBd(crypt,bdPfx,pfxPassword)
    If success = 0
        Debug CkCrypt2::ckLastErrorText(crypt)
        CkCrypt2::ckDispose(crypt)
        CkBinData::ckDispose(bdPfx)
        ProcedureReturn
    EndIf

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

    ; ...
    ; ...


    CkCrypt2::ckDispose(crypt)
    CkBinData::ckDispose(bdPfx)


    ProcedureReturn
EndProcedure