Groups | Blog | Home
all groups > dotnet security > may 2007 >

dotnet security : SignedXml.Signature.SignatureValue hash


Iguana
5/15/2007 3:54:24 AM
Hi!
I have implemented entire RFC3161 (Time Stamp Protocol) with
csharp, .net 2.0, VC 2005, for timestamping signatures with TSA.
My problem is extract and get from SignedXml.Signature.SignatureValue
hash, which must be send in request to TSA.
I have spent lot of time on this, but cant see how extract hash from
xml signature.
Is it posible with cryptography library from .net?
Please for help,
Iguana
Han
5/17/2007 12:00:00 AM
Hello

Getting hash from byte array is,

sha1managed sha=new sha1managed();
byte[] hash=sha.computeHash(to-be-hashed);

That's all. to-be-hashed is a byte array or stream. You may want
SignatureValue there. There are also another hash algorithms like sha and
MD5. This example is just sha1.

[quoted text, click to view]

Valery Pryamikov
5/17/2007 10:18:31 PM
[quoted text, click to view]

Hi,
to get hash of signed xml you have to:
- extract signedinfo element;
- serialize it with explicit cannonical form;
- calculate hash;
- verify that signature of given hash is valid;

you don't extract hash from signature, you validate your hash.

-Valery
Iguana
5/21/2007 5:10:00 AM
On 18 Maj, 07:18, Valery Pryamikov <valery.pryami...@q-free.com>
[quoted text, click to view]

Hi Valery!
Thanks for post - very helpful!
I calculate hash - but cant see method to check signature with
calculated hash?
Can Youe explain how validate calculated hash?
Iguana
Iguana
5/21/2007 6:23:41 AM
[quoted text, click to view]

I try RSAPKCS1SignatureDeformatter, but always method
CheckSignature(hash, signatureValue) return false - signaturer is not
valid.
Any sugestion will be helpful,
Iguana
Iguana
5/22/2007 12:26:17 AM
[quoted text, click to view]

My faul - everything works perfect!
Thanks for everyone for help!
Iguana
AddThis Social Bookmark Button