Hello everyone,

I've got some ACOS5-Smartcards (from ACS) with RSA-functionality. I
want to sign data with one smartcard, send the data+signature to
another pc and verify the signature to check the integrity of the
data. But the verifyData()-function returns always "false", also on
the same card.

Here's the code:

CspParameters csp = new CspParameters(1, "Advanced Card Systems CSP
v2.3");
csp.Flags = CspProviderFlags.UseDefaultKeyContainer;
csp.KeyNumber = (int)KeyNumber.Signature;
RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(csp);

Console.WriteLine("Container name: {0}\nKey type: {1}\nKey number:
{2}",
                rsa.CspKeyContainerInfo.KeyContainerName,
                rsa.CspKeyContainerInfo.KeyNumber,
                csp.KeyNumber);
Console.WriteLine("Accessible? {0}\nExportable? {1}",
                rsa.CspKeyContainerInfo.Accessible,
                rsa.CspKeyContainerInfo.Exportable);


// Data to sign
byte[] data = new byte[] { 1, 2, 3, 4 };
Console.WriteLine("Data         : " + BitConverter.ToString(data));

// Sign, Hash: SHA1
byte[] sig = rsa.SignData(data, "SHA1");

Console.WriteLine("Signature    : " + BitConverter.ToString(sig));

// Verify the data with signature
bool verified = rsa.VerifyData(data, "SHA1", sig);
Console.WriteLine("Verified     : " + verified);



Informations from the console:
Container name:
Key type: Signature
Key number: 2
Accessible? True
Exportable? False
Data         : 01-02-03-04
Signature    : 80-11-...
Verified     : False



Can somebody help me?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web 
Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://cm.megasolutions.net/forums/default.aspx
-~----------~----~----~----~------~----~------~--~---

Reply via email to