santuario-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ian Hummel <hum...@parityinc.net>
Subject Re: Mechanism type DOM not available
Date Tue, 26 Feb 2008 22:19:59 GMT
Sean, can you confirm that this is only necessary with JDK prior to  
Java 6?  I got the same errors using 1.5, but when I tried this on  
another machine with java 6 I got no such errors...

At least, it was my impression that xmlsec 1.4.1 will give you the  
javax apis with any version of java, but the DOM provider is not there  
by default except with java 6.

- ian.


On Feb 26, 2008, at 4:50 PM, Sean Mullan wrote:

> Yes, you have not registered an XMLSignatureFactory provider
> implementation.
>
> The easiest workaround is to just instantiate and specify the service
> provider implementation (bundled with Apache XMLSec) as a parameter as
> follows:
>
> XMLSignatureFactory factory = XMLSignatureFactory.getInstance("DOM",  
> new
> org.jcp.xml.dsig.internal.dom.XMLDSigRI());
>
> Alternatively, you can register the provider in the java.security  
> file,
> or use the java.security.Provider API. See
> http://java.sun.com/javase/6/docs/technotes/guides/security/crypto/CryptoSpec.html#ProviderInstalling
> "Registering a Provider" for more details.
>
> --Sean
>
> Nayan Hajratwala wrote:
>> I'm trying to validate a signature using xmlsec 1.4.1 and am  
>> getting the
>> following error:
>>
>> javax.xml.crypto.NoSuchMechanismException: Mechanism type DOM not  
>> available
>>    at  
>> javax.xml.crypto.dsig.XMLDSigSecurity.getEngineClassName(Unknown
>> Source)
>>    at javax.xml.crypto.dsig.XMLDSigSecurity.getImpl(Unknown Source)
>>    at javax.xml.crypto.dsig.XMLDSigSecurity.getImpl(Unknown Source)
>>    at javax.xml.crypto.dsig.XMLSignatureFactory.findInstance
>>
>> ...
>>
>> The code is:
>>
>>            NodeList nl =  
>> doc.getElementsByTagNameNS(XMLSignature.XMLNS,
>> "Signature");
>>            if (nl.getLength() == 0) {
>>              throw new Exception("Cannot find Signature element");
>>            }
>>
>>            DOMValidateContext valContext = new DOMValidateContext(pk,
>> nl.item(0));
>>            XMLSignatureFactory factory =
>> XMLSignatureFactory.getInstance("DOM");
>>
>> ...
>>
>> Any ideas?
>>
>>
>> ---
>> Nayan Hajratwala
>> http://agileshrugged.com
>> http://chikli.com
>> 734.658.6032
>>
>>
>>
>>
>


Mime
View raw message