Lua Requires Chilkat v11.0.0+
Lua
Get Certificate's Public Key
Loads a certificate from PEM and gets the public key.Chilkat Lua Downloads
-- In the following call to loadlib, change the path (./chilkat.dll) to the relative or absolute directory where the chilkat.dll, chilkat.so, or chilkat.dylib is located.
chilkat = assert(package.loadlib("./chilkat.dll", "luaopen_chilkat"))()
print(chilkat._VERSION)
local success = false
local cert = chilkat.newCert{}
local strPem = "-----BEGIN CERTIFICATE----- ..."
success = cert:LoadPem(strPem)
if success == false then
print(cert:LastErrorText())
end
local pubKey = chilkat.newPublicKey{}
cert:GetPublicKey(pubKey)
-- You can now use the public key object however it is needed,
-- and access its various properties and methods..
print(pubKey:GetXml())