davinder101
asked on
Problem with CRYPTOAPI
Hi, i am using cryptoapi to encrypt my files. The files are decrypted if i decrypt them on the same system with same user, but if i try to decrypt them with different user or on different system, decryption fails. The function i am using to encrypt files are:-
CryptAcquireContext();
CryptGetUserKey( );
CryptGetUserKey( );
GeneratePrivateKey();
CryptGenKey();
etc.
The fuction failing on decryption is
CryptImportKey();
Can anybody tell how to decrypt files on a different system;
Thanks;
CryptAcquireContext();
CryptGetUserKey( );
CryptGetUserKey( );
GeneratePrivateKey();
CryptGenKey();
etc.
The fuction failing on decryption is
CryptImportKey();
Can anybody tell how to decrypt files on a different system;
Thanks;
ASKER
The value return by GetLastError() is 2148073477.
Thanks
Thanks
and what CryptImportKey() returns out of following ?
ERROR_INVALID_HANDLE
ERROR_INVALID_PARAMETER
NTE_BAD_ALGID
NTE_BAD_DATA
NTE_BAD_FLAGS
NTE_BAD_TYPE
NTE_BAD_UID
NTE_BAD_VER
look into return error code and try to change accordingly.
-MAHESH
ERROR_INVALID_HANDLE
ERROR_INVALID_PARAMETER
NTE_BAD_ALGID
NTE_BAD_DATA
NTE_BAD_FLAGS
NTE_BAD_TYPE
NTE_BAD_UID
NTE_BAD_VER
look into return error code and try to change accordingly.
-MAHESH
ASKER
The value is NTE_BAD_DATA. But why it is decrypting on the same machine.
I think it has something to do with the public key used to form the public-private key pair.
Thanks.
I think it has something to do with the public key used to form the public-private key pair.
Thanks.
ASKER
Hi, from microsoft news group, i came to know that during encryption one has to encypt the file by using the private key of the source system and the public key of the destination system. Then only we can decrypt the file on the destination system. Can any one tell me how to get the key from the destiantion system.
Thanks,
Thanks,
Is this you are looking for ?
http://support.microsoft.com/kb/228786
http://support.microsoft.com/kb/228786
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Thanks
what GetLastError returns ?
-MAHESH