[xmlsec] Need duplicate same template as org.apache.xml.security

Aleksey Sanin aleksey at aleksey.com
Thu Sep 17 17:35:26 PDT 2015


I would start from reading a book about XML and then looking
at LibXML2 API to understand how to manipulate XML tree.

Said that...

1) "ds prefix" is the namespace defined by
xmlns:ds="http://www.w3.org/2000/09/xmldsig#"

2) Since <ds:Object/> element is outside of the <Signature/>
node, you will have to use Libxml2 APIs to create it in a way
you want.

Aleksey

On 9/17/15 4:47 PM, Dmitrii Golub wrote:
> Input:
> 
> <QuickPay><Message>[REQ_STATUS:0]  </Message></QuickPay>
> 
> Output:
>     <Document stan="1427246181733">
>     <ds:Object xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
> Id="Res0"><QuickPay><Message>[REQ_STATUS:0] 
> </Message></QuickPay></ds:Object>
>     <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
>       <ds:SignedInfo>
>         <ds:CanonicalizationMethod
> Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></ds:CanonicalizationMethod>
>         <ds:SignatureMethod
> Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></ds:SignatureMethod>
>         <ds:Reference Type="http://www.w3.org/2000/09/xmldsig#Object"
> URI="#Res0">
>           <ds:Transforms>
>             <ds:Transform
> Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments"></ds:Transform>
>           </ds:Transforms>
>           <ds:DigestMethod
> Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></ds:DigestMethod>
>           <ds:DigestValue>OXSrAdOtqbFknUT8G/2TeNgUTkM=</ds:DigestValue>
>         </ds:Reference>
>         <ds:Reference Type="http://www.w3.org/2000/09/xmldsig#Object"
> URI="#Res1">
>           <ds:Transforms>
>             <ds:Transform
> Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments"></ds:Transform>
>           </ds:Transforms>
>           <ds:DigestMethod
> Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></ds:DigestMethod>
>           <ds:DigestValue>qRDizs6vyYLCA4eMFPTh1AS/uZo=</ds:DigestValue>
>         </ds:Reference>
>       </ds:SignedInfo>
>          
> <ds:SignatureValue>aeCm/mj0EbIuz8EuPukijYWC59qLfEwgGNFB6tbb4EFM+OgUSzDdDlJvi0olOUYjMdMyEKKEjvPF
>             Yrb4GZOHpAgeY0x2A7s=
>           </ds:SignatureValue>
>           <ds:KeyInfo>
>             <ds:X509Data>
>               <ds:X509Certificate>
>                 EIdMKGIdnkwsRsM=
>               </ds:X509Certificate>
>             </ds:X509Data>
>           </ds:KeyInfo>
>         <ds:Object Id="Res1"><SignatureProperties><SignatureProperty
> Target="TimeStamp"><randomstamp>incB9/fhgZh+WTTMiqwGjA==</randomstamp><date>2015-03-25</date><time>07:04:04:083</time></SignatureProperty></SignatureProperties></ds:Object>
>       </ds:Signature>
>     </Document>
> 
> 
> 
> Questions:
> What is this ds prefix for? How to generate document with that prefix?
> I have problems with second <ds:Object Id="Res1">
> 
> 
> For start I use this code:
> https://gist.github.com/Houdini/8bd661d1d0c846293f3a
> 
> But it doesnt looks right for me.
> 
> Thanks in advance.
> 
> 
> _______________________________________________
> xmlsec mailing list
> xmlsec at aleksey.com
> http://www.aleksey.com/mailman/listinfo/xmlsec
> 


More information about the xmlsec mailing list