Click to See Complete Forum and Search --> : RSACryptoServiceProvider - fail to get KeyContainerName from the certificate PrivateK


asatal
November 3rd, 2009, 09:59 AM
I have constructed a WPF application that digitally signs documents by using a smartcard.
The application reports progress to the user through the displayed window.
The all signing process takes place in a different thread in order to be able to update the displayed window.

The problem is, whenever I access the KeyContainerName through the certificate PrivateKey, the application hangs and that's how it remains, until the undesired process termination.

This is a code snippet of the troublemaker code:

CspParameters csp = new CspParameters();
csp.KeyContainerName = ((System.Security.Cryptography.RSACryptoServiceProvider)certificate.PrivateKey).CspKeyContainerInfo.KeyContainerName.ToString();

* The certificate is being extracted from the user store after inserting the smart card.