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

RSA Import Public Key

See more RSA Examples

Shows how to select/import a public key for RSA encryption or signature verification.

Chilkat Tcl Downloads

Tcl

load ./chilkat.dll

set success 0

set pubKey [new_CkPublicKey]

#  In all Chilkat methods expecting a path, you pass either absolute or relative paths.
set success [CkPublicKey_LoadFromFile $pubKey "rsaKeys/myTestRsaPublic.pem"]
if {$success == 0} then {
    puts [CkPublicKey_lastErrorText $pubKey]
    delete_CkPublicKey $pubKey
    exit
}

set rsa [new_CkRsa]

#  Tell RSA to use the public key.
CkRsa_UsePublicKey $rsa $pubKey

delete_CkPublicKey $pubKey
delete_CkRsa $rsa