Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(CryptGetUserKey(
- hCryptProv,
- AT_KEYEXCHANGE,
- &hXchgKey))
- {
- _tprintf(
- TEXT("The user public key has been retrieved. \n"));
- }
- else
- {
- if(NTE_NO_KEY == GetLastError())
- {
- // No exchange key exists. Try to create one.
- if(!CryptGenKey(
- hCryptProv,
- AT_KEYEXCHANGE,
- CRYPT_EXPORTABLE,
- &hXchgKey))
- {
- MyHandleError(
- TEXT("Could not create "
- "a user public key.\n"),
- GetLastError());
- goto Exit_MyEncryptFile;
- }
- }
- else
- {
- MyHandleError(
- TEXT("User public key is not available and may ")
- TEXT("not exist.\n"),
- GetLastError());
- goto Exit_MyEncryptFile;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement