Solved

Problem with CRYPTOAPI

Posted on 2006-11-16
10
1,137 Views
Last Modified: 2016-08-23
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;
0
Comment
Question by:davinder101
10 Comments
 
LVL 22

Expert Comment

by:mahesh1402
ID: 17963075
The fuction failing on decryption is CryptImportKey();

what GetLastError returns ?

-MAHESH
0
 

Author Comment

by:davinder101
ID: 17963113
The value return by GetLastError() is 2148073477.
Thanks
0
 
LVL 22

Expert Comment

by:mahesh1402
ID: 17963128
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
0
 

Author Comment

by:davinder101
ID: 17963186
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.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:davinder101
ID: 17977846
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,
0
 
LVL 22

Expert Comment

by:mahesh1402
ID: 17977895
Is this you are looking for ?
http://support.microsoft.com/kb/228786
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 18473170
PAQed with points refunded (250)

Computer101
EE Admin
0
 

Expert Comment

by:Mayur Saswade
ID: 41768259
Thanks
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
MFC Dialog 9 47
fizzArray2 challenge 1 56
fix34  challenge 9 96
firstChar challenge 13 83
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now