Sample code for 30+ languages & platforms
Perl

RSA Import Public Key

See more RSA Examples

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

Chilkat Perl Downloads

Perl
use chilkat();

$success = 0;

$pubKey = chilkat::CkPublicKey->new();
# In all Chilkat methods expecting a path, you pass either absolute or relative paths.
$success = $pubKey->LoadFromFile("rsaKeys/myTestRsaPublic.pem");
if ($success == 0) {
    print $pubKey->lastErrorText() . "\r\n";
    exit;
}

$rsa = chilkat::CkRsa->new();

# Tell RSA to use the public key.
$rsa->UsePublicKey($pubKey);