[xmlsec] URI Question

Andy Paumann andy at internic.at
Fri Mar 25 11:33:56 PST 2005


Hi there,

Well I am not a specialist on Digital Signatures…and I am having a problem ☺

Everything is running fine except for one thing:

I want to sign the following:
-----------------------------------------------------------------------------
<enum-token:token xmlns:enum-token="http://www.enum.at/rxsd/enum-token-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-inst
ance" xsi:schemaLocation="http://www.enum.at/rxsd/enum-token-1.0 enum-token-1.0.xsd" Id="Signed">
<enum-token:validation serial="23454">
<enum-token:e164number>+4312345</enum-token:e164number>
<enum-token:validator>9999</enum-token:validator>
<enum-token:registrarid>9999</enum-token:registrarid>
<enum-token:method>1</enum-token:method>
<enum-token:createdate>2005-01-01</enum-token:createdate>
<enum-token:expiredate>2007-01-01</enum-token:expiredate>
</enum-token:validation>
<enum-tokendata:tokendata xmlns:enum-tokendata="http://www.enum.at/rxsd/enum-tokendata-1.0" xsi:SchemaLocation="http://www.e
num.at/rxsd/enum-tokendata-1.0 enum-tokendata-1.0.xsd">
<enum-tokendata:contact>
<enum-tokendata:firstname>Andy</enum-tokendata:firstname>
<enum-tokendata:lastname>Tester</enum-tokendata:lastname>
</enum-tokendata:contact>
</enum-tokendata:tokendata>
</enum-token:token>
----------------------------------------------------------------------------

The signing works fine and results in something like that:
----------------------------------------------------------------------------
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
<SignedInfo>
<CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
<SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
<Reference URI="">
<Transforms>
<Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
<Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
<InclusiveNamespaces xmlns="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList="enum-token enum-tokendata"/>
</Transform>
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<DigestValue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Bt3CLd14N4oYGWpIGTMIGQMQswCQYDVQQGEwJBVDEP
MA0GA1UECBMGVmllbm5hMQ8wDQYDVQQHEwZWaWVubmExKzApBgNVBAoTImludGVy
bmljIERhdGVua29tbXVuaWthdGlvbnMgR21iSC4xETAPBgNVBAsTCEVOVU1URVNU
MR8wHQYJKoZIhvcNAQkBFhBlbnVtQGludGVybmljLmF0ggkAgkVHaymkxo4wDAYD
VR0TBAUwAwEB/zANBgkqhkiG9w0BAQQFAAOBgQBTkt4kSmgjFH6QpakOh5rTYzld
xErXNeEbH5NsmPz3mJee5T7rOP6X4RcYyOdTbRUKX1DwtsTWyiboollj0CdSDQTU
mh3zO53RpGWfcPdCFKBW1Qez0rjFc7X0RRAVkfBEOLgB1gVkIdH1y6/HYc0A/D67
OEBtgDpdUN9s2VQEeQ==</X509Certificate>
</X509Data>
</KeyInfo>
</Signature>
--------------------------------------------------------------------------

Looks fine and is everything what I want (Your example verifier verify3 is also happy), 
only one thing does not work (And the receiver of this XML needs it):

In the above example I get the line

<Reference URI=””>

But I would need: 

<Reference URI=”#Signed”> (The Id of the above element, set in the Id=”Signed” attribute).

When I use the Function 

xmlSetProp(refNode,”URI”,”#Signed”)

or when I give it as argument to 

xmlSecTmplSignatureAddReference() 

the signing function xmlSecDSigCtxSign() complains:

func=xmlSecXPathDataExecute:file=xpath.c:line=273:obj=unknown:subj=xmlXPtrEval:error=5:libxml2 library function failed:expr=xpointer(id('Signed'))
func=xmlSecXPathDataListExecute:file=xpath.c:line=356:obj=unknown:subj=xmlSecXPathDataExecute:error=1:xmlsec library function failed:
func=xmlSecTransformXPathExecute:file=xpath.c:line=466:obj=xpointer:subj=xmlSecXPathDataExecute:error=1:xmlsec library function failed:
func=xmlSecTransformDefaultPushXml:file=transforms.c:line=2371:obj=xpointer:subj=xmlSecTransformExecute:error=1:xmlsec library function failed:
func=xmlSecTransformCtxXmlExecute:file=transforms.c:line=1207:obj=unknown:subj=xmlSecTransformPushXml:error=1:xmlsec library
 function failed:transform=xpointer
func=xmlSecTransformCtxExecute:file=transforms.c:line=1267:obj=unknown:subj=xmlSecTransformCtxXmlExecute:error=1:xmlsec library function failed:
func=xmlSecDSigReferenceCtxProcessNode:file=xmldsig.c:line=1568:obj=unknown:subj=xmlSecTransformCtxExecute:error=1:xmlsec library function failed:
func=xmlSecDSigCtxProcessSignedInfoNode:file=xmldsig.c:line=804:obj=unknown:subj=xmlSecDSigReferenceCtxProcessNode:error=1:xmlsec library function failed:node=Reference
func=xmlSecDSigCtxProcessSignatureNode:file=xmldsig.c:line=547:obj=unknown:subj=xmlSecDSigCtxProcessSignedInfoNode:error=1:xmlsec library function failed:
func=xmlSecDSigCtxSign:file=xmldsig.c:line=303:obj=unknown:subj=xmlSecDSigCtxSigantureProcessNode:error=1:xmlsec library function failed:
Error: signature failed

What am I doing wrong and what is the correct way to specify the correct URI value?

Many thanks in advance and happy easter!

Andy Paumann
 
CEO internic Datenkommunikations GmbH.
CEO globedom Datenkommunikations GmbH.
Donaucitystr. 1, A-1220 Vienna, Austria
Web: http://www.internic.at/ and http://www.globedom.com/
 
Why driving a 4WD? 'Cause the earth ain't flat!





More information about the xmlsec mailing list