Unicode C
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
#include <C_CkPublicKeyW.h>
#include <C_CkRsaW.h>
void ChilkatSample(void)
{
BOOL success;
HCkPublicKeyW pubKey;
HCkRsaW rsa;
success = FALSE;
pubKey = CkPublicKeyW_Create();
// In all Chilkat methods expecting a path, you pass either absolute or relative paths.
success = CkPublicKeyW_LoadFromFile(pubKey,L"rsaKeys/myTestRsaPublic.pem");
if (success == FALSE) {
wprintf(L"%s\n",CkPublicKeyW_lastErrorText(pubKey));
CkPublicKeyW_Dispose(pubKey);
return;
}
rsa = CkRsaW_Create();
// Tell RSA to use the public key.
CkRsaW_UsePublicKey(rsa,pubKey);
CkPublicKeyW_Dispose(pubKey);
CkRsaW_Dispose(rsa);
}