You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@santuario.apache.org by Renato Forti <re...@acm.org> on 2013/02/27 13:12:59 UTC

How to check if signature is valid using 2 DOMNode's?

Hi All,

I have 2 DOMNode's from na signed documment:

An "Signature" node (DOMNode)
And an document(DOMNode)

 

How I can check sign with these 2 DOMNode.

Indefault way I need use an DOMSOcument and a DOMNode, But I have only the
both DOMNode:

Default Way:

DOMNode *doc = parser->getDocument();
DOMDocument *theDOM = parser->getDocument();
 
DOMNode *sigNode = findDSIGNode(doc, "Signature"); // I already have this
 
 
XSECProvider prov;
XSECKeyInfoResolverDefault theKeyInfoResolver;
           
DSIGSignature * sig;
sig = prov.newSignatureFromDOM(theDOM, sigNode); // I have only a DOMNode
with document
 
// and this? I have two separate DOMNodes!
sig->setKeyInfoResolver(&theKeyInfoResolver);
sig->registerIdAttributeName(MAKE_UNICODE_STRING("ID"));
           
bool result;
 
try 
{
   sig->load(); 
   result = sig->verify(); 
}
 
.
 
<XT xmlns="http://www.xyz.com/xyz">
<doc ver="2.00" Id="X132">
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
</XT>
 
And I have
 
One DOMNode with:  <doc ver="2.00" Id="X132">
Other DOMNode with:  <Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
 
How to check if signature is valid?
 
Thanks to all!