Sorry.. the error message is:
An unhandled exception of type
'System.Security.Cryptography.CryptographicException' occurred in
mscorlib.dll
Additional information: The parameter is incorrect.
[quoted text, click to view] "msnews.microsoft.com" <annonymous@microsoft.com> wrote in message
news:%23Bd8zF7GHHA.3464@TK2MSFTNGP05.phx.gbl...
>I encountered a very weird scenario with the following code:
>
> CspParameters csp = new CspParameters(1, "Tev CSP v3.0");
> csp.KeyNumber = 2;
>
> RSACryptoServiceProvider rsa = new
> RSACryptoServiceProvider(csp);
> byte[] data = new byte[2];
> data[0] = 0;
> data[1] = 1;
>
> byte[] sig = rsa.SignData(data, "SHA1");
>
> I m trying to sign a data using a certificate that resides in a smart
> card. The above code works perfectly well with .NET framework 1.1.
> However, when i compile and run it on .NET framework 2.0, exception was
> caught when calling
> byte[] sig = rsa.SignData(data, "SHA1");
>
> The error is as follow :
>
> An unhandled exception of type
> 'System.Security.Cryptography.CryptographicException' occurred in
> mscorlib.dll
> Additional information: The keyset is not defined.
>
> Any idea why this happened ? Thanks.
>
>