Main Board > Programming

Sign XML Documents with Digital Signatures

<< < (2/2)

Loren Doornek:
Here's a simple example of creating a signature hash for an XML document, based on a Wikipedia example.  But, this only creates the signature and does not encrypt the signature data using RSA, which is what the XML signing requires.  To complete the process, you would need to finish building the required XML (most of which was included in your example in the <Signature> segment), and then create an RSA-encrypted signature value for that segment.  I don't know of any method of using RSA encryption directly within PXPlus, but maybe Mike can comment on that.  Mikes suggestion of using the XMLSEC utility might be the only method of handling the RSA part.


-;list
0010 BEGIN
0020 LET inv$=XML(ADD "Marge Simpson" TO inv$,KEY="Client")
0030 LET inv$=XML(ADD "847.63" TO inv$,KEY="Amount")
0040 LET inv$=XML(ADD inv$ TO $$,KEY="Invoice")
0050 LET sig$=CVS(HSH(inv$,256),"ASCII:BASE64")
0060 LET xml$=XML(ADD sig$ TO inv$,KEY="Signature",OPT="xmlns=""http://www.w3.org/2000/09/xmldsig#""")
0070 PRINT xml$
-;
-;run

<Invoice>
 <Client>Marge Simpson</Client>
 <Amount>847.63</Amount>
</Invoice>
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">G9Q1/Lu96dgOVNd3ZChqZLCBUDgIPuAivTwVIngey2U=</Signature>
-;

HendersonS:
Loren, thanks for your demonstration,

so far I have not been able to install xmlsec on Windows, and I have not been able to find a solution with pxplus either, so I will have to make some program in C# or another language to invoke it from pxplus, since I do not see a solution with pxplus.

Navigation

[0] Message Index

[*] Previous page

Go to full version