Lua Requires Chilkat v11.0.0+
Lua
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 Lua Downloads
local chilkat = require("chilkat")
local success = false
-- This example requires the Chilkat API to have been previously unlocked.
-- See Global Unlock Sample for sample code.
local pkey = chilkat.PrivateKey.new()
local rsa = chilkat.Rsa.new()
rsa:gen_key(1024, pkey)
rsa:use_private_key(pkey)
local strData = "This is the string to be signed."
-- Get the signature in base64url
rsa.encoding_mode = "base64url"
local strSig = rsa:sign_string_enc(strData, "sha256")
print(strSig)