Sample code for 30+ languages & platforms
DataFlex

Base64url Encoding

See more Encryption Examples

Base64url encoding is identical to base64 encoding except it uses non-reserved URL characters (e.g. '–' is used instead of '+', and '_' is used instead of '/') and it omits the padding characters.

Chilkat DataFlex Downloads

DataFlex
Use ChilkatAx-win32.pkg

Procedure Test
    Boolean iSuccess
    Variant vPkey
    Handle hoPkey
    Handle hoRsa
    String sStrData
    String sStrSig

    Move False To iSuccess

    // This example requires the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    Get Create (RefClass(cComChilkatPrivateKey)) To hoPkey
    If (Not(IsComObjectCreated(hoPkey))) Begin
        Send CreateComObject of hoPkey
    End
    Get Create (RefClass(cComChilkatRsa)) To hoRsa
    If (Not(IsComObjectCreated(hoRsa))) Begin
        Send CreateComObject of hoRsa
    End
    Get pvComObject of hoPkey to vPkey
    Get ComGenKey Of hoRsa 1024 vPkey To iSuccess
    Get pvComObject of hoPkey to vPkey
    Get ComUsePrivateKey Of hoRsa vPkey To iSuccess

    Move "This is the string to be signed." To sStrData

    // Get the signature in base64url
    Set ComEncodingMode Of hoRsa To "base64url"
    Get ComSignStringENC Of hoRsa sStrData "sha256" To sStrSig

    Showln sStrSig


End_Procedure