Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Security / December 2006

Tip: Looking for answers? Try searching our database.

Digitally Sign a file

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
msnews.microsoft.com - 09 Dec 2006 16:45 GMT
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.
msnews.microsoft.com - 09 Dec 2006 17:28 GMT
Sorry.. the error message is:

An unhandled exception of type
'System.Security.Cryptography.CryptographicException' occurred in
mscorlib.dll
Additional information: The parameter is incorrect.

>I encountered a very weird scenario with the following code:
>
[quoted text clipped - 23 lines]
>
> Any idea why this happened ? Thanks.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.