Try    'Create a new RSACryptoServiceProvider object. 
    Dim RSA As New RSACryptoServiceProvider()    'Export the key information to an RSAParameters object.
    'Pass false to export the public key information or pass
    'true to export public and private key information.
    Dim RSAParams As RSAParameters = RSA.ExportParameters(False)
Catch e As CryptographicException
    'Catch this exception in case the encryption did
    'not succeed.
    Console.WriteLine(e.Message)
End Try

解决方案 »

  1.   

    sorry, up is not right!add this ??using System;
    using System.Security.Cryptography;
    using System.Text;
      

  2.   

    seePRB: "CSP for This Implementation Could Not Be Acquired" CryptographicException Error During Instantiation
    http://support.microsoft.com/default.aspx?kbid=322371"....
    CAUSE
    Underlying base, enhanced, or strong cryptographic service provider (CSP) implementations create a key container for storing an RSA public/private asymmetric key pair. Key containers are stored in user profiles. For performance reasons, the user profile is not loaded by the system under a scenario where the .NET code runs in a Web service, ASP page, or COM+. If the user profile is not loaded, a key container cannot be opened or created. Because a key container is required for RSACryptoServiceProvider or DSACryptoServiceProvider, the .NET code (when run from a Web Service, ASP Page, or COM+) fails by throwing the exception described in the "Symptoms" section of this article. If the same .NET code is run from the context of the interactive logged-on user, where the user profile is loaded by Winlogon, a key container can be created and opened, and the code works under this scenario. 
    ...."