Sample code for 30+ languages & platforms
DataFlex

Example: Crypt2.AddPfxSourceBd method

Demonstrates how to call the AddPfxSourceBd method.

Chilkat DataFlex Downloads

DataFlex
Use ChilkatAx-win32.pkg

Procedure Test
    Boolean iSuccess
    Handle hoCrypt
    Variant vBdPfx
    Handle hoBdPfx
    String sPfxPassword
    String sTemp1

    Move False To iSuccess

    Get Create (RefClass(cComChilkatCrypt2)) To hoCrypt
    If (Not(IsComObjectCreated(hoCrypt))) Begin
        Send CreateComObject of hoCrypt
    End
    Move False To iSuccess

    // Do public-key decryption (RSA)
    Set ComCryptAlgorithm Of hoCrypt To "pki"

    // ...
    // ...
    // ...

    Get Create (RefClass(cComChilkatBinData)) To hoBdPfx
    If (Not(IsComObjectCreated(hoBdPfx))) Begin
        Send CreateComObject of hoBdPfx
    End
    Get ComLoadFile Of hoBdPfx "c:/my_pfx_files/a.pfx" To iSuccess
    // ...

    Move "secret1" To sPfxPassword
    Get pvComObject of hoBdPfx to vBdPfx
    Get ComAddPfxSourceBd Of hoCrypt vBdPfx sPfxPassword To iSuccess
    If (iSuccess = False) Begin
        Get ComLastErrorText Of hoCrypt To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    // Add as many as PFX sources as desired...
    Get ComLoadFile Of hoBdPfx "c:/my_pfx_files/b.pfx" To iSuccess
    Move "secret2" To sPfxPassword
    Get pvComObject of hoBdPfx to vBdPfx
    Get ComAddPfxSourceBd Of hoCrypt vBdPfx sPfxPassword To iSuccess
    If (iSuccess = False) Begin
        Get ComLastErrorText Of hoCrypt To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    // ...
    // ...


End_Procedure