473,327 Members | 2,071 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Signature Verification

stathread
I am having an issue with the verification of a signature in C#.
Everything below is in HEX.

I have tried several different ways but all return false.

The 2048 bit SHA1 RSA public key.
0602000000A400005253413100080000010001002581E21298 0CCE8B1C7FD20240CA378570F19B03B2E6BEFB099EB0B7BD9E 0B53DE4541FBC1D21FE6DEE34EE906CC6BDCFECBF0F5563977 99CC0153AD894D40EEA89CFFD01EA0630A650E77559CA8B3BB 199384704256EF010C8B0F0E9FD4DBC2AD340883FBF7B0EA46 B68A01822A208FE036BB718F800B745583E26FFEC2F0771454 E649F569BA47136978A6B761298DB0FDA7EA7C37AA69AF9E72 4067C60441A3F30AFCA703CAFA384179C6995DEEBD1F82E60B A735B3C5A2C9E300BD1534A60E769D04EF32ACAF8553E28AF4 266060B036FC9CDF7AA477C6736E28A34F93BD8E1F0A4EA5B1 0C8C449D5F1CFD5E76E263FFB4B4431990DD7428C7464BE45C
BE

The Data that was Signed.
303132333435363738393a3b3c3d3e3f303132333435363738 393a3b3c3d3e3f

The Signature
7C0FC267087EE3CC1B3F4C1C9411012DA9AA292318BE769E9E A1CF9CF48BC2C5074C92C33859C092431C84491A74839A451E DF7108FDD8EACB1569F92ED2AFB71AE1506CA7CD4926003C3C 1825DAB1377506EFF8AA2CAF3186A166F5140C04D1C5DFBB34 AEFAEAD651616E8AF0D505946289CAE199CF2C3F1BBCD2AAE7 48E6A4A843F2972BE2B22DF00FE8E2A3D2CCA8A80EA298C2E8 96B2008583758492454CA77565C5B99F3429F73D3CCCD9BE5B 32DBA1900A19E325C315277F86E929C15467E7383684F598F8 285F2E93EB93B57461E5886228D1B03F768AF0AEAE3C7500CA 47594C538390169C2750160814B2E99368CC249247372E2899 6DED96CC6B66

Thanks!
Nov 6 '08 #1
9 4699
Plater
7,872 Expert 4TB
Were you not able to use the System.Security.Cryptography.RSA class?
Nov 6 '08 #2
RedSon
5,000 Expert 4TB
What have you done, where is your code failing, what does your code look like.

*USE CODE TAGS*
Nov 6 '08 #3
More Information.

I retrieve the signature from a smart card after sending it some random data to sign.

I have posted these values previously in HEX.

The card has the private key.

I retrieve the public key from an x509 certificate.

Expand|Select|Wrap|Line Numbers
  1. System.Security.Cryptography.X509Certificates.X509Certificate2 x509 = new X509Certificate2(@"C:\X509.cer");
  2. AsymmetricAlgorithm PublicKeyAlgorithm = x509.PublicKey.Key;
  3. RSACryptoServiceProvider RSA = new RSACryptoServiceProvider();
  4. RSA.FromXmlString(x509.PublicKey.Key.ToXmlString(false));
I then attempted to verify the signature using a number of ways, here are a few.

RSACryptoServiceProvider.VerifyHash
RSACryptoServiceProvider.VerifyData
RSAPKCS1SignatureDeformatter.VerifySignature (It should be pkcs #11 though not 1)

All return a boolean = false;

Thanks again.
Nov 6 '08 #4
Do you still need more information?
Nov 7 '08 #5
Plater
7,872 Expert 4TB
Does the x509 not match the smart card?
Nov 7 '08 #6
Does the x509 not match the smart card?
I pulled the X509 from the card, this certificate contains the public key.

I sent some random data to the card and the card signs and returns it.

I should be able to verify the returned signature using the public key I have retrieved from the card.
Nov 7 '08 #7
Plater
7,872 Expert 4TB
Aren't certificates fairly strict? Like they go by like the fully qualified computer/domain name and such? So using them out of context of one another could cause the card to sign wrong?

I'm grabbing at straws.

Have you tried having it sign only like a single byte? Something very un-complex?
Nov 7 '08 #8
There is no way to sign only a single byte. The card should not being signing wrong.

I did try to hash the data before trying to verify it against the returned signature but this didn't work either. (SHA1CryptoServiceProvider.ComputeHash)

RSA.VerifyData(Buffer, "SHA1", Signature);
Nov 7 '08 #9
I still don't understand whats wrong here. I have the data I sent to be signed, I have the signature, and I have the correct public key. I am using an algorithm id = 07 (RSA 2048) and a Key Reference = 9E (Certificate I am using for the Public Key).

I also found some instructions here below which are directly from the Department of Homeland Security.

Generate a random or pseudo-random challenge of at least 127 bytes of unique data and transmits this to the smart card using the GENERAL AUTHENTICATE APDU command.

The response (i.e. the card’s signature) from the GENERAL AUTHENTICATE APDU command is verified using the Public Key from the Certificate. If verification fails, the card is rejected.
Nov 24 '08 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Richard Loupatty | last post by:
Hi all, Does someone know what this mean: The check of the signature failed for assembly 'Infragistics.WebUI.UltraWebGrid.v2' I also did a post to Infragistics but maybe this is a general...
3
by: Xavier | last post by:
hello, i have a kind of workflow like: enter data in a form aprove data by person 1 aprove data by person 2 data are saved in a sqldatabase
0
by: Kenny Ho | last post by:
hi, I use the following function to compute the xml signature, (the X509Certificate is imported from p12 format file, and saved in the system store) public void SignDocument(XmlDocument doc,...
0
by: Chris Mullins [MVP - C#] | last post by:
I've got a WCF Service hosted in IIS running on a Win2k3 machine. The service is built with Beta 2 of Orcas. The service is configured for Message Security, using the UserNameToken provider....
2
by: Ralph.Malek | last post by:
Would anyone happen to know how to determine if a digital signature used MD5 or SHA1 as the digest algorithm? I have a requirement to verify the authenticity of VeriSigned exe file, and while...
2
by: sudankanakavel | last post by:
i need a software which implement digital signature using algorithm:rsa,elgamal language:java os:windows software should compress,encrypt and sign data. decryption,certificate...
0
by: steven acer | last post by:
Hi i'm trying to sign a file and verify its signature with a DSA key. But i don't know if i'm doing it the right way !. I tried 2 different ways but i either got an error or simply the...
3
by: hdsingh71 | last post by:
We have two files, one is plain text another is signature file. We have to verify the integrity of the message. The details of SIG file is as under: Digital signature in PKCS7 format ...
3
by: itcoll | last post by:
i have wriiten java code for client server communication - the client sends a digital signature and the server verifies it using the public key .I have sent the signature as a string from the client...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.