Tcl
Tcl
Load a PFX from an Encoded String
See more PFX/P12 Examples
Demonstrates Pfx.LoadPfxEncoded, which decodes text using a named binary encoding (such as base64) and loads the resulting bytes as a PFX / PKCS#12 container.
Background. This is useful when the PKCS#12 data has been transported or stored as printable text, such as base64.
Chilkat Tcl Downloads
load ./chilkat.dll
set success 0
set pfx [new_CkPfx]
# The PFX password should come from a secure source rather than being hard-coded.
set password "myPfxPassword"
# Decode the base64 text into PFX / PKCS#12 bytes and load them. Common encodings include base64
# and hex.
set encodedPfx "MIIKrAIBAzCCCm...base64-encoded-pfx..."
set success [CkPfx_LoadPfxEncoded $pfx $encodedPfx "base64" $password]
if {$success == 0} then {
puts [CkPfx_lastErrorText $pfx]
delete_CkPfx $pfx
exit
}
puts "Loaded [CkPfx_get_NumCerts $pfx] certificate(s)."
delete_CkPfx $pfx