Sample code for 30+ languages & platforms
DataFlex

Get Certificate's Public Key

Loads a certificate from PEM and gets the public key.

Chilkat DataFlex Downloads

DataFlex
Use ChilkatAx-win32.pkg

Procedure Test
    Boolean iSuccess
    Handle hoCert
    String sStrPem
    Variant vPubKey
    Handle hoPubKey
    String sTemp1

    Move False To iSuccess

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

    Move "-----BEGIN CERTIFICATE----- ..." To sStrPem

    Get ComLoadPem Of hoCert sStrPem To iSuccess
    If (iSuccess = False) Begin
        Get ComLastErrorText Of hoCert To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get Create (RefClass(cComChilkatPublicKey)) To hoPubKey
    If (Not(IsComObjectCreated(hoPubKey))) Begin
        Send CreateComObject of hoPubKey
    End
    Get pvComObject of hoPubKey to vPubKey
    Get ComGetPublicKey Of hoCert vPubKey To iSuccess

    // You can now use the public key object however it is needed,
    // and access its various properties and methods..

    Get ComGetXml Of hoPubKey To sTemp1
    Showln sTemp1


End_Procedure