Sample code for 30+ languages & platforms
DataFlex

Create X509PKIPathv1 Containing one Certificate

See more Certificates Examples

Demonstrates how to create a X509PKIPathv1 containing one certificate.

Note: This example requires Chilkat v9.5.0.77 or later.

Chilkat DataFlex Downloads

DataFlex
Use ChilkatAx-win32.pkg

Procedure Test
    Boolean iSuccess
    Handle hoCert
    String s
    String sTemp1
    Boolean bTemp1

    Move False To iSuccess

    Get Create (RefClass(cComChilkatCert)) To hoCert
    If (Not(IsComObjectCreated(hoCert))) Begin
        Send CreateComObject of hoCert
    End

    // There are many ways to load a certificate -- from a file, from a string or memory, etc.,
    // and from many different formats.  This example loads the cert from a PEM file.
    // (LoadFromFile will auto-recognize the format.)
    Get ComLoadFromFile Of hoCert "qa_data/certs/brasil_cert.pem" To iSuccess
    If (iSuccess = False) Begin
        Get ComLastErrorText Of hoCert To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    // Get the X509PKIPathv1 in base64 format (single line)
    Get ComX509PKIPathv1 Of hoCert To s
    Get ComLastMethodSuccess Of hoCert To bTemp1
    If (bTemp1 = False) Begin
        Get ComLastErrorText Of hoCert To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Showln "X509PKIPathv1: " s


End_Procedure