Lua Requires Chilkat v11.0.0+
Lua
Get Base64 Public Key from Private Key
See more ECC Examples
Demonstrates how to get the public key in base64 format from a private key.Chilkat Lua Downloads
local chilkat = require("chilkat")
-- Load a private key from base64.
local bd = chilkat.BinData.new()
local success = bd:append_encoded("MHQCA....n0Q==", "base64")
local privKey = chilkat.PrivateKey.new()
success = privKey:load_any_format(bd, "")
if not success then
print(privKey.last_error_text)
return
end
local pubKey = chilkat.PublicKey.new()
privKey:to_public_key(pubKey)
local pubKeyBase64 = pubKey:get_encoded(true, "base64")
print(pubKeyBase64)