Sample code for 30+ languages & platforms
Unicode C++

RSA Import Public Key

See more RSA Examples

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

Chilkat Unicode C++ Downloads

Unicode C++
#include <CkPublicKeyW.h>
#include <CkRsaW.h>

void ChilkatSample(void)
    {
    bool success = false;

    CkPublicKeyW pubKey;
    //  In all Chilkat methods expecting a path, you pass either absolute or relative paths.
    success = pubKey.LoadFromFile(L"rsaKeys/myTestRsaPublic.pem");
    if (success == false) {
        wprintf(L"%s\n",pubKey.lastErrorText());
        return;
    }

    CkRsaW rsa;

    //  Tell RSA to use the public key.
    rsa.UsePublicKey(pubKey);
    }