Lua
Lua
Load PFX/P12 from a Base64 Encoded PFX File
See more PFX/P12 Examples
Demonstrates how to call LoadPfxEncoded.Chilkat Lua Downloads
local chilkat = require("chilkat")
local bd = chilkat.BinData.new()
local success = bd:load_file("qa_data/pfx/cert_test123.pfx")
if not success then
print("Failed to load PFX file.")
return
end
-- Get the bytes contained in the PFX in base64 format:
local strBase64 = bd:get_encoded("base64")
-- The base64 looks like this: "MIIbEAIBAzCCGswGCSqGSIb3DQEHAaCCGr0Eghq5MIIatTCCBg..."
print(strBase64)
local pfx = chilkat.Pfx.new()
-- Load the PFX from the base64 string
local password = "test123"
success = pfx:load_pfx_encoded(strBase64, "base64", password)
if not success then
print(pfx.last_error_text)
return
end
print("success")