Re: Digitally signing XML files
- From: Jaakko Kangasharju <jkangash@xxxxxxx>
- Date: Tue, 07 Feb 2006 13:09:17 +0200
Roedy Green <my_email_is_posted_on_my_website@xxxxxxxxxxxxxx> writes:
I wonder if there is a standard way to digitally sign XML files.
There is, W3C has a specification for XML Signatures, see
<http://www.w3.org/TR/xmldsig-core/>. Apache has a Java
implementation as a part of the XML-Security project.
1. where do you put the signature, the public key? Can you tack them
on the end, embed them in special tags?
You put in a new element called Signature. This contains references
to the signed parts of the document and digests for each, as well as
the computed signature value. It can also contain information on the
key used, either by including the public key or a reference to it.
2. what do you sign, the encoded bytes or the chars?
Crypto algorithms typically require their input to be bytes, so that's
what you need to produce.
3. how do you deal with transient white space that might disappear if
someone tidied the file.
4. how do you deal with platform-specific new line chars? do you
treat them as if nl, do you transform the document first, do you
preserve them?
5. what about lead trail space on fields. It this removed first?
These are easiest to answer with a single word: canonicalization.
There are a couple of W3C-specified canonicalization algorithms (see,
e.g., <http://www.w3.org/TR/2001/REC-xml-c14n-20010315>). Such an
algorithm takes XML and attempts to remove any incidentals so that the
same output is produced even after some reasonable XML processing.
To go to specifics, canonicalization does not permit you to alter
whitespace content of an XML document, so your point 3 would create a
different document, I cannot find anything that says newlines are
converted to any other form, and in point 5, if by "field" you mean
element content or attribute value, all whitespace is retained.
--
Jaakko Kangasharju, Helsinki Institute for Information Technology
You don't have to be crazy to work here...and it doesn't help either
.
- Follow-Ups:
- Re: Digitally signing XML files
- From: Roedy Green
- Re: Digitally signing XML files
- References:
- Digitally signing XML files
- From: Roedy Green
- Digitally signing XML files
- Prev by Date: Difference between static final members and final static members(if any)?
- Next by Date: Re: Difference between static final members and final static members(if any)?
- Previous by thread: Re: Digitally signing XML files
- Next by thread: Re: Digitally signing XML files
- Index(es):
Relevant Pages
|