Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 880
  • Last Modified:

CryptAcquireContext() API fails when called from ASP.

  I have built a VB DLL which calls CryptAcquireContext() API. if i instantiate this dll from a VB project it works fine but the same DLL if called from an ASP page, the CryptAcquireContext() API fails.
   If change the login in IIS from anonymas to Windows NT then it works fine. But i need to login as an anonymas user.

The code looks like
Private Const STORAGE_NAME = "Key Storage"
Private Const SERVICE_PROVIDER As String = "Microsoft Enhanced Cryptographic Provider v1.0"
Private Const SECURITY_PROVIDER_TYPE As Long = 1
Private Const CRYPT_MACHINE_KEYSET As Long = 32
Private Const AT_KEYEXCHANGE = 1

CryptAcquireContext(hStorage, STORAGE_NAME, SERVICE_PROVIDER, SECURITY_PROVIDER_TYPE, CRYPT_MACHINE_KEYSET)

Any help will be greatful
thankx
0
umeshmohite
Asked:
umeshmohite
  • 2
1 Solution
 
ap_sajithCommented:
Maybe, the ISR account doesnt have sufficient permissions on the DLL. You could create an MTS/COM+ package and assign it to run it under a specific user account which has sufficient  permissions..

Cheers!!
0
 
ap_sajithCommented:
ISR account  should read.. IUSR Account..

And here's how you should register the component under COM+ (Taken from old post by Silvers5)

Start the Component services..in the tree select computers.. mycomputer..com+ applications...right click on it--> new -> application.. now in the wizard click next and select an empty application -> name your package  leave it in server process and click next -> Select the user and enter an account with enough rights to fufill your com jobs (admin account for ex) -> Finish..

now in the tree expand the new package untill you see the component directory-> right click it -> select new component-> in the wizard click next.. you can either install a new component if it's not registred or install a registred one if you already registred your dll (you select the 2nd choice) -> Select your component from the list (internal name displayed) -> Finish..

Cheers!!

0
 
umeshmohiteAuthor Commented:
Thankx buddy it works
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now