Using CryptAPI with ASP
-
Hello! I am trying to make the following possible: 1. User accesses Page1.asp and enters some credentials. 2. Page1 posts to Page2.asp which after some things uses a COM component (inproc dll) to do encryption (I have written code for RSA encryption usinf Windows Crypto API) 3. The reponse is the encrypted data. Problem: Everything works fine when client and server are all on the same machine. However when the client accesses Page1 from another machine, the error returned is from the CryptAcquireContext method: Keyset does not exist. What I have tried to do to solve this problem: 1. Created another component (this time a local server, COM exe) which does the encryption work. The dll merely routes the call to the component. This was done to test Inproc vs Outproc issues. 2. Tried to change access permissions in the RSA directory under localsettings\all users etc 3. Used the following to acquire crypt context: if(!::CryptAcquireContext(&hProvider, NULL, MS_ENHANCED_PROV, PROV_RSA_FULL, 0)) { if(!::CryptAcquireContext(&hProvider, NULL, MS_ENHANCED_PROV, PROV_RSA_FULL, CRYPT_NEWKEYSET)){ ::CryptAcquireContext(&hProvider, NULL, MS_ENHANCED_PROV, PROV_RSA_FULL, CRYPT_MACHINE_KEYSET); } } None of the approaches have worked, and the problem is always failure to get the Crypto Context handle. Any suggestions would be greatly appreciated! Thanks!