How to get the CSP name from a certificate containing the private key?

  I was testing with some code to get the CSP name from a certificate containing the private key. A sample code is shown below: // GetCSPFromCert.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <stdio.h> #include <windows.h> #include <wincrypt.h> #pragma comment(lib, "crypt32.lib") #define MY_ENCODING_TYPE  (PKCS_7_ASN_ENCODING | X509_ASN_ENCODING) // Replace…

2

How to take a quartz log?

  Many a times I do get this questions from my varied customers and colleagues and I cannot answer them instantly or even after looking here and there for a day. So I just wanted to blog it. Please see the MSDN link http://msdn.microsoft.com/en-us/library/dd388394(v=VS.85).aspx for the steps in getting the logs. Here are some steps…

0

Getting a “System.ArgumentException: Value was invalid” when trying to sign data using SHA256CryptoServiceProvider Here is the symptom:

1. You are using RSACryptoServiceProvider for computing SHA-2 signatures. 2. Doing this you get unhandled exceptions of type "System.ArgumentException" in mscorlib.dll saying "Value was invalid". 3. A typical call that failed was: byte[] signature = rsa.SignData(data, new SHA256CryptoServiceProvider()); 4. The SHA1CryptoServiceProvider did not reproduce the exception. 5. Additionally you have FIPS policy enabled. The environment…

0