Visual C# Developer Center > Visual C# Forums > Visual C# General > RSACryptoServiceProvider - fail to get KeyContainerName from the certificate PrivateKey in mta mode
Ask a questionAsk a question
 

General DiscussionRSACryptoServiceProvider - fail to get KeyContainerName from the certificate PrivateKey in mta mode

  • Tuesday, November 03, 2009 3:36 PMSnufkeen Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    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.

All Replies

  • Tuesday, November 10, 2009 3:49 AMHarry ZhuMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi,

    Where do you call the statements above? from main thread?
    Could this caused the application need to retrieve info from the card?

    Harry 
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
  • Friday, November 13, 2009 3:44 AMHarry ZhuMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    We are changing the issue type to “General Discussion” because you have not followed up with the necessary information. If you have more time to look at the issue and provide more information, please feel free to change the issue type back to “Question” by opening the Options list at the top of the post  window, and changing the type. If the issue is resolved, we will appreciate it if you can share the solution so that the answer can be found and used by other community members having similar questions.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.