Sample code for 30+ languages & platforms
Tcl

Get Certificate's Public Key

Loads a certificate from PEM and gets the public key.

Chilkat Tcl Downloads

Tcl

load ./chilkat.dll

set success 0

set cert [new_CkCert]

set strPem "-----BEGIN CERTIFICATE----- ..."

set success [CkCert_LoadPem $cert $strPem]
if {$success == 0} then {
    puts [CkCert_lastErrorText $cert]
    delete_CkCert $cert
    exit
}

set pubKey [new_CkPublicKey]

CkCert_GetPublicKey $cert $pubKey

# You can now use the public key object however it is needed,
# and access its various properties and methods..

puts [CkPublicKey_getXml $pubKey]

delete_CkCert $cert
delete_CkPublicKey $pubKey