|
Xoxa-c
0.3.1
Normalizer/Parser for XML
|
The Xoxa library implements a normalization procedure for XML files, which generates a well-defined normalized form which is simple to generate and is largely reversible, and which can be signed by GPG or other cryptographic mechanisms in a natural way.
This documentation is for version 0.3.1, "2015-05-17".
Note: This is still beta code. Some functionality is implemented only in the C version of the code and not the Java version, or vice versa. The interface may yet change.
The procedure turns the XML:
<doc> <p class='foo'>Hello</p> <p> there chum </p> </doc>
into the normalised form:
(doc Aclass foo (p -Hello )p (p - there chum )p )doc
This normalised form can then be signed, and the signature reinserted into the original XML, or else included as the parsed XML is passed downstream.
The following document has the same normalised form as the earlier one, but includes a PGP signature block which can be used to verify it:
<doc><p class="foo">Hello</p><p> there
chum </p>
<?signature algorithm='pgp' armor='-----BEGIN PGP SIGNATURE-----
....
-----END PGP SIGNATURE-----'?></doc>
The XML may include a processing instruction (PI) of the form <?signature ... ?>, which indicates a signature for the normalised form of the output, not including the signature PI. This PI has a ‘data’ payload consisting of a sequence of key-value pairs, where each value is enclosed in double quotes. The only keys defined so far are:
algorithm : This indicates the type of signature. The values currently defined are pgp for PGP/OpenPGP/GPG signatures (cf RFC 4880, plus keys such as sha1 (see eg RFC 3174), sha256 or md5, indicating cryptographic hashing algorithms. The actual values available are at present rather ill-defined, since the list is to some extent dependent on the algorithms available in the library support available at the time the library is defined; this may change in future versions.content : This indicates the PGP-armoured output of a PGP/GPG signature (that is, starting with -----BEGIN PGP SIGNATURE-----), or else the cryptographic hash indicated by the algorithm attribute.target : This indicates the element which is to be signed. It may have one of the values /> or following::*[1], indicating respectively the whole document or the XML element immediately following the signature PI. In the absence of this attribute, the signature is taken to refer to the whole document. The permitted attribute values are these literal strings. They are indeed syntactically XPath specifiers, but there is no implication that an arbitrary XPath may be provided here.The procedure is defined in detail in [paper reference to come]. For more information, see the project web page.
1.8.2