Unicode C++
Unicode C++
RSA Import Private Key
See more RSA Examples
Shows how to select/import a private key for RSA signing or decryption.Chilkat Unicode C++ Downloads
#include <CkPrivateKeyW.h>
#include <CkRsaW.h>
void ChilkatSample(void)
{
bool success = false;
CkPrivateKeyW privKey;
const wchar_t *password = L"secret";
// In all Chilkat methods expecting a path, you pass either absolute or relative paths.
success = privKey.LoadAnyFormatFile(L"rsaKeys/myTestRsaPrivate.pem",password);
if (success == false) {
wprintf(L"%s\n",privKey.lastErrorText());
return;
}
CkRsaW rsa;
// Tell the RSA object to use the private key (i.e. import the private key)
rsa.UsePrivateKey(privKey);
}