• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Canonicalize and sign xml

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Should those two xml docs. have same signature?

and

I noticed that if I sign them, digest and signature values are different in both cases. Any idea how to transform it to have same signature?
Here's code I use:
 
Ranch Hand
Posts: 733
7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I noticed that if I sign them, digest and signature values are different in both cases. Any idea how to transform it to have same signature?


Maybe one should ask the question in the other direction. Why would you think that would give the same signature? They are "different" in the sense of being an octet stream even after the canonicalization should be the first intuition and that is the correct conclusion, though.

Any idea how to transform it to have same signature?


You sure can transform them to some common output. But that is heavily dependent of detail setting of the formatter and the error prong white-space treatment... For that reason, maybe you should both apply a transformation so that they share the common defaut behaviour in the formatting and white-space treatment.

For instance, the first xml you reverse the positions under items with an template like this.

whereas, you apply a similar template on the second.

That is the basic idea.

Signature is a technology rigorous to the detail. You need to ask why such kind of mixed up turns up at all from the source.
 
Igor Delac
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for explanation. It make sense. Also your suggestion to arrange items in xml is also very useful.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic