Crypto Service Providers

Discussion in 'ASP.NET WebServices' started by mark, Oct 20, 2003.

  1. Anyone here tried using the crypto sevice providers from the System.Security.Cryptography namespace? I'm trying to encrypt some data and send it to my Web Service using the RSACryptoServiceProvider class.
    Creating an instance of this class generates the following exception:

    System.Security.Cryptography.CryptographicException: CryptoAPI cryptographic service provider (CSP) for this implementation could not be acquired.
    at System.Security.Cryptography.RSACryptoServiceProvider..ctor(Int32 dwKeySize, CspParameters parameters, Boolean useDefaultKeySize)
    at System.Security.Cryptography.RSACryptoServiceProvider..ctor()


    The problem seems to be with the asymetric providers (RSA, DSA). Symetric providers (DES, etc.) appear to work.
    I can instantiate and use any of these classes on my local IIS server just fine.

    Thanks
     
  2. Bruce

    Bruce DiscountASP.NET Staff

    To resolve the problem, you will need to specify the keystore in the code (KeyContainerName)

    See
    http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=%23Keg1Q4TCHA.436%40tkmsftngp10&rnum=6&prev=/groups%3Fq%3DCryptoAPI%2Bcryptographic%2Bservice%2Bprovider%2B(CSP)%2Bfor%2Bthis%2Bimplementation%2Bcould%2Bnot%2Bbe%2Bacquired%26hl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26selm%3D%2523Keg1Q4TCHA.436%2540tkmsftngp10%26rnum%3D6


    quote:Originally posted by mark

    Anyone here tried using the crypto sevice providers from the System.Security.Cryptography namespace? I'm trying to encrypt some data and send it to my Web Service using the RSACryptoServiceProvider class.
    Creating an instance of this class generates the following exception:

    System.Security.Cryptography.CryptographicException: CryptoAPI cryptographic service provider (CSP) for this implementation could not be acquired.
    at System.Security.Cryptography.RSACryptoServiceProvider..ctor(Int32 dwKeySize, CspParameters parameters, Boolean useDefaultKeySize)
    at System.Security.Cryptography.RSACryptoServiceProvider..ctor()


    The problem seems to be with the asymetric providers (RSA, DSA). Symetric providers (DES, etc.) appear to work.
    I can instantiate and use any of these classes on my local IIS server just fine.

    Thanks
    </blockquote id="quote"></font id="quote">
     

Share This Page