I am working on Private Key archival with a Windows Server 2008 R2 Certificate Authority. On the client side, I am interested in knowing which Crypto API function calls are made by the windows processes when the client requests for an archival enabled certificate. In particular, my focus is to track the function calls listed here, http://msdn.microsoft.com/en-us/library/aa922849.aspx , present in Advapi32.dll .
I have tried out the windbg/cdb script here ( http://blogs.msdn.com/b/alejacma/archive/2007/10/31/cryptoapi-tracer.aspx ). I attached it to mmc.exe while making a certificate request but I couldn't detect any CSP calls being made during the process. I also tried requesting certificate through certreq.exe but windbg couldn't trace any CSP calls. I have also tried other forms of tracing as mentioned in the stackoverflow thread titled "Monitoring application calls to DLL"
Which windows process/service I need to attach to, in order to find how these calls are being made? Is it possible to trace whenever a function call is made, irrespective of which process makes it?
Any suggestions on how to trace these CSP calls?
advapi32.dll used to contain cryptography implementation some time ago, but now this functionality has been moved to cryptsp.dll. Windows team sometimes moves implementation of public methods from one DLL into another. See more examples on this in The Old New Thing Blog. Advapi32.dll simply calls into corresponding functions in cryptsp.dll.
Apparently certificate APIs in mmc that you were trying to debug are calling directly into cryptsp.dll. Example from a call stack on Windows 8:
Notice, advapi32.dll is not even present in the call stack.
So the solution for you would be to put breakpoints directly on the functions in cryptsp.dll. E.g.: