CryptAcquireContextA fails in C++ CLR for “Aloaha Cryptographic Provider”


I have C++ CLR project with both managed and unmanaged code. In this project I loop through list of cryptoproviders and search for suitable.

So I use functions <br /> CryptEnumProvidersA <br /> CryptAcquireContextA

I have C# project which uses C++ project. When I call the method to loop through list of cryptoproviders twice, my application crashes. And it crashes on CryptAcquireContextA. And only on "Aloaha Cryptographic Provider".

When i use debug mode, it also crashes. But when i use debug mode, set breakpoint and pass through code with F10, it works fine.

When i carry out C++ code to separate project, it works fine in all cases.

So, I have two questions here:<br /> 1) How such a crash possible? And why it happens?<br /> 2) How can I call CryptAcquireContextA to handle such a crash?<br />

My considerations.<br /> 1) Some troubles with memory. I was searching for memory leaks, but I didn't find any.<br /> 2) I tried to use try-catch, but with no result, CryptAcquireContextA crashes anyway. I would like to use function like "CryptIsValidProvider" or "CryptPingProvider", but I didn't find it.


If it works when single-stepping, it's probably a race condition (you're paused in the debugger long enough for some other process or driver to make progress).

Does it matter how much code you single-step through? Does putting a Sleep instead of a breakpoint right before the CryptAcquireContextA call also work?


  • Janrain OpenId vs lightopenid PHP libraries
  • An internal error occurred. the private key that you are importing might require a cryptographic ser
  • Securely Encrypt 64bits w/o per element overhead?
  • Is it acceptable to call openssl within an app submitted to the Mac App Store?
  • Three.js: ways to reduce file size of models?
  • Copy data from Jupyter notebook
  • print_r() adds properties to DateTime objects [duplicate]
  • How to avoid waiting for a thread to finish execution - Python
  • Coalescing items in channel
  • What is the difference between a CPU and a GPU oriented code?
  • In C#, how can I reference a specific product record based on a button that's clicked in a grid
  • filter/remove invalid xml characters from stream
  • How do you access podcasts in WP7?
  • HTTPS + gzip: Is it a security vulnerability if I only gzip non-sensitive files?
  • Numpy: How to get rid of the minima along axis=1, given the indices - in an efficient way?
  • Touch events over two dom elements?
  • ConfigurationBuilder not working in azure function
  • Dynamically set LESS variables from user settings
  • Relative paths. baseUrl and paths not working on ionic2 - angular2
  • runtime error when linking ffmpeg libraries in qt creator
  • Getting media player state in windows phone 7
  • URLConnection doesn't work since API 10 and higher?
  • C# program and C++ DLL compiled for 32-bit system crash on 64-bit system
  • PHP CURL timing out but CLI CURL works
  • How do I get HTML corresponding to current DOM tree?
  • With Hadoop, can I create a tasktracker on a machine that isn't running a datanode?
  • debug library loaded with ctypes using gdb
  • Can I check if a recipient has an automatic reply before I send an email?
  • Getting last autonumber in access
  • C# - Serializing and deserializing static member
  • Sending data from AppleScript to FileMaker records
  • How to show dropdown in excel using jrxml (jasper api)?
  • How can I estimate amount of memory left with calling System.gc()?
  • How to include full .NET prerequisite for Wix Burn installer
  • Hits per day in Google Big Query
  • -fvisibility=hidden not passed by compiler for Debug builds
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • Qt: Run a script BEFORE make
  • Is it possible to post an object from jquery to bottle.py?
  • reshape alternating columns in less time and using less memory