Sample code for 30+ languages & platforms
Tcl

Get Certificate Public Key from PEM

See more Certificates Examples

Demonstrates how to load a PEM file containing a certificate and access the public key.

Chilkat Tcl Downloads

Tcl

load ./chilkat.dll

set success 0

set cert [new_CkCert]

set success [CkCert_LoadFromFile $cert "qa_data/pem/my_cert.pem"]
if {$success == 0} then {
    puts [CkCert_lastErrorText $cert]
    delete_CkCert $cert
    exit
}

set pubkey [new_CkPublicKey]

CkCert_GetPublicKey $cert $pubkey

# Examine the public key as XML..
puts [CkPublicKey_getXml $pubkey]

delete_CkCert $cert
delete_CkPublicKey $pubkey