santuario-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Milan Tomic" <mi...@setcce.org>
Subject RE: [java] XMLSignature ctor
Date Tue, 18 Oct 2005 09:20:31 GMT

I have tried to debug, but without any luck. :( I'm using Eclipse IDE.

This is my call stack:

ElementNode2.getAttributeNS(String, String) line: 409
SignatureAlgorithm.getURI() line: 303
SignatureAlgorithm.<init>(Element, String) line: 124
SignedInfo.<init>(Document, Element, Element) line: 136
XMLSignature.<init>(Document, String, Element, Element) line: 229
TestXSEC.main(String[]) line: 97

This is the only line of code in getURI():

return this._constructionElement.getAttributeNS(null,
              Constants._ATT_ALGORITHM);

but when I step into getAttributeNS():

public String getAttributeNS(String namespaceURI, String localName) {
	...
}

I can see that namespaceURI have a value of
"http://www.w3.org/2000/09/xmldsig#" (and it should be null)

Because of this, the code failes to find attribute. I have never seen such a
case... :(

Best regards,
Milan


-----Original Message-----
From: Sean Mullan [mailto:Sean.Mullan@Sun.COM] 
Sent: Friday, October 14, 2005 5:43 PM
To: security-dev@xml.apache.org
Subject: Re: [java] XMLSignature ctor

I don't know for sure, but you should be able to figure out the problem 
by inserting some print statements or running your test case thru a 
debugger such as jdb or JSwat (you will have to recompile the Apache 
XMLSec source with the -g flag though). Also, make sure when you parse 
your Document with a DocumentBuilder you set it to be namespace aware 
(DocumentBuilderFactory.setNamespaceAware(true)).

--Sean

Milan Tomic wrote:
> As much as I could debug XSEC, "Algorith" attribute was never found for my
> <SignatureMethod> element, although it is there. Perhaps this is an issue
> with namespaces?
> 
> I'm attaching XML file I was using for testing purposes.
> 
> Best regards,
> Milan
> 
> 
> -----Original Message-----
> From: Milan Tomic [mailto:milan@setcce.org] 
> Sent: Friday, October 14, 2005 11:49 AM
> To: security-dev@xml.apache.org
> Subject: RE: [java] XMLSignature ctor
> 
> 
> 
>>Yes, the docSig parameter should be the
>>SignatureMethod element and not 
>>the Signature element.
> 
> 
> Thank you, Sean. The error message a little confused me.
> 
> I did as you suggested and now I got this exception in XMLSignature ctor:
> 
> org.apache.xml.security.signature.XMLSignatureException: The requested
> algorithm  does not exist. Original Message was: null
> Original Exception was java.lang.NullPointerException
> 	at
> org.apache.xml.security.algorithms.SignatureAlgorithm.<init>(Unknown
Source)
> 	at org.apache.xml.security.signature.SignedInfo.<init>(Unknown
> Source)
> 	at org.apache.xml.security.signature.XMLSignature.<init>(Unknown
> Source)
> 	at TestXSEC.main(TestXSEC.java:97)
> java.lang.NullPointerException
> 	at java.lang.Class.forName0(Native Method)
> 	at java.lang.Class.forName(Class.java:141)
> 	at
> org.apache.xml.security.algorithms.SignatureAlgorithm.<init>(Unknown
Source)
> 	at org.apache.xml.security.signature.SignedInfo.<init>(Unknown
> Source)
> 	at org.apache.xml.security.signature.XMLSignature.<init>(Unknown
> Source)
> 	at TestXSEC.main(TestXSEC.java:97)
> Exception in thread "main"
> 
> I'm using this XMLSignature ctor:
> 
> XMLSignature(org.w3c.dom.Document doc,
>             java.lang.String BaseURI,
>             java.lang.String SignatureMethodURI,
>             java.lang.String CanonicalizationMethodURI)
> 
> I couldn't find any examples using this ctor. I'm trying to sign already
> created XML template with <Signature> element in it. Similar to
> templateSign.cpp in C++ examples. I'm using XSEC 1.2.1 and JDK 1.4.2.
> 
> Am I doing something wrong? Could someone verify that this ctor works OK?
> 
> Best regards,
> Milan
> 
> 
> ------------------------------------------------------------------------
> 
> <IzdaniRacunEnostavni xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
xmlns:xds="http://uri.etsi.org/01903/v1.1.1#"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://www.gzs.si/e-poslovanje/sheme/eSlog_1-
4_PreprostiRacun.xsd"><Racun Id="data"></Racun><ds:Signature
Id="SignatureId"><ds:SignedInfo><ds:CanonicalizationMethod
Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></ds:Canonicaliz
ationMethod><ds:SignatureMethod
Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></ds:SignatureMethod>
<ds:Reference URI="#data"><ds:DigestMethod
Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></ds:DigestMethod><ds:Dig
estValue>empty</ds:DigestValue></ds:Reference><ds:Reference
URI="#SignedPropertiesId"><ds:DigestMethod
Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></ds:DigestMethod><ds:Dig
estValue>empty</ds:DigestValue></ds:Reference></ds:SignedInfo><ds:SignatureV
alue>empty</ds:SignatureValue><ds:Object><xds:QualifyingPropert
ies Target="#SignatureId"><xds:SignedProperties
Id="SignedPropertiesId"><xds:SignedSignatureProperties><xds:SigningTime>2005
-10-14T13:30:52.783Z</xds:SigningTime><xds:SigningCertificate><xds:Cert><xds
:CertDigest><xds:DigestMethod
Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></xds:DigestMethod><xds:D
igestValue>s4Vq41bmhfrwpmaHpEt0tilaFmc=</xds:DigestValue></xds:CertDigest><x
ds:IssuerSerial><ds:X509IssuerName>OU=sitest-ca, O=state-institutions,
C=si</ds:X509IssuerName><ds:X509SerialNumber>1007374424</ds:X509SerialNumber
></xds:IssuerSerial></xds:Cert></xds:SigningCertificate><xds:SignaturePolicy
Identifier><xds:SignaturePolicyImplied></xds:SignaturePolicyImplied></xds:Si
gnaturePolicyIdentifier></xds:SignedSignatureProperties></xds:SignedProperti
es></xds:QualifyingProperties></ds:Object></ds:Signature></IzdaniRacunEnosta
vni>


Mime
View raw message