Sample code for 30+ languages & platforms
Tcl Requires Chilkat v11.0.0+

Transition from Cert.ExportPublicKey to Cert.GetPublicKey

Provides instructions for replacing deprecated ExportPublicKey method calls with GetPublicKey.

Chilkat Tcl Downloads

Tcl

load ./chilkat.dll

set success 0

set cert [new_CkCert]

#  ------------------------------------------------------------------------
#  The ExportPublicKey method is deprecated:

# publickeyObj is a CkPublicKey
set publickeyObj [CkCert_ExportPublicKey $cert]
if {[CkCert_get_LastMethodSuccess $cert] == 0} then {
    puts [CkCert_lastErrorText $cert]
    delete_CkCert $cert
    exit
}

#  ...
#  ...

delete_CkPublicKey $publickeyObj

#  ------------------------------------------------------------------------
#  Do the equivalent using GetPublicKey.
#  Your application creates a new, empty PublicKey object which is passed 
#  in the last argument and filled upon success.

set publickeyOut [new_CkPublicKey]

set success [CkCert_GetPublicKey $cert $publickeyOut]
if {$success == 0} then {
    puts [CkCert_lastErrorText $cert]
    delete_CkCert $cert
    delete_CkPublicKey $publickeyOut
    exit
}


delete_CkCert $cert
delete_CkPublicKey $publickeyOut