CryptoAPI cryptographic service provider (CSP) for this implementation could not be acquired during

Discussion in 'ASP .Net Security' started by Don Nelson, Oct 25, 2004.

  1. Don Nelson

    Don Nelson Guest

    Hi,
    We are trying to encrypt and decrypt some fields using RSA
    algorithm.The class being used is RSACryptoServiceProvider.We have put
    a key in its XML representation in Registry and evrytime whenever we
    invoke our custom encryption class, it instantiates
    RSACryptoServiceProvider class with its default constructor.Please
    look at following snippet:
    RSACryptoServiceProvider rsaProvider = new RSACryptoServiceProvider();

    /* Creating the RSACryptoServiceProvider object from the XML string
    of the Key(which is read from the registry.)
    The key is inserted in the registry while environment was et up
    initially. */

    rsaProvider.FromXmlString(Key);

    Our environment has 5 machines and all the 5 machines have this key in
    their registry.This ensures that passwords encrypted on one machine
    can be decrypted on other machine.That is the reason we cannot use
    cspParameters class and cspFlags and hence UseMachineKeyStore
    property.
    The problem occurs when we run around 1000 successive requests for
    encryption.After successful execution of 300-400 requests, we get an
    error saying "CryptoAPI cryptographic service provider (CSP) for this
    implementation could not be acquired".As much as we have read on Net,
    this occurs because ASP.net is not an interactive user and hence needs
    to use UseMachineKeyStore property.However we cannot use this for the
    above mentioned reasons.Also first 300 requests execute
    successfully.otherwise this error should have come at the first
    request itself.
    Can anyone please help us?
    Thanks in advance.
    Don
    Don Nelson, Oct 25, 2004
    #1
    1. Advertising

  2. Don Nelson

    Chris Tanger Guest

    RE: CryptoAPI cryptographic service provider (CSP) for this implementa

    I have a similar problem while trying to instantiate an
    RSACryptoServiceProvider for the 30th time or so in a C# dll class.
    Basically I have multiple threads using the RSACryptoServiceProvider and
    periodically about 1 every 30 tries I get the same error you are getting. I
    am wondering if the underlying cryptoAPI in windows is threadsafe or not.

    Look for my post to Microsoft in dotnet.framework

    "Don Nelson" wrote:

    > Hi,
    > We are trying to encrypt and decrypt some fields using RSA
    > algorithm.The class being used is RSACryptoServiceProvider.We have put
    > a key in its XML representation in Registry and evrytime whenever we
    > invoke our custom encryption class, it instantiates
    > RSACryptoServiceProvider class with its default constructor.Please
    > look at following snippet:
    > RSACryptoServiceProvider rsaProvider = new RSACryptoServiceProvider();
    >
    > /* Creating the RSACryptoServiceProvider object from the XML string
    > of the Key(which is read from the registry.)
    > The key is inserted in the registry while environment was et up
    > initially. */
    >
    > rsaProvider.FromXmlString(Key);
    >
    > Our environment has 5 machines and all the 5 machines have this key in
    > their registry.This ensures that passwords encrypted on one machine
    > can be decrypted on other machine.That is the reason we cannot use
    > cspParameters class and cspFlags and hence UseMachineKeyStore
    > property.
    > The problem occurs when we run around 1000 successive requests for
    > encryption.After successful execution of 300-400 requests, we get an
    > error saying "CryptoAPI cryptographic service provider (CSP) for this
    > implementation could not be acquired".As much as we have read on Net,
    > this occurs because ASP.net is not an interactive user and hence needs
    > to use UseMachineKeyStore property.However we cannot use this for the
    > above mentioned reasons.Also first 300 requests execute
    > successfully.otherwise this error should have come at the first
    > request itself.
    > Can anyone please help us?
    > Thanks in advance.
    > Don
    >
    Chris Tanger, Feb 3, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sven-Torben Janus
    Replies:
    3
    Views:
    2,657
    Sven-Torben Janus
    Sep 10, 2004
  2. Gabor
    Replies:
    0
    Views:
    511
    Gabor
    Dec 22, 2004
  3. Mike P
    Replies:
    0
    Views:
    2,290
    Mike P
    Mar 12, 2005
  4. Sven-Torben Janus
    Replies:
    1
    Views:
    238
    Svein Terje Gaup
    Sep 15, 2004
  5. Kim H
    Replies:
    0
    Views:
    180
    Kim H
    Aug 14, 2006
Loading...

Share This Page