santuario-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From k..@nethere.com
Subject Re: padding error
Date Wed, 07 Sep 2005 21:59:57 GMT
Ok, I placed the BC provider at number 2 and now I get this error:

Data: DES
Key encryption key stored in file:/C:/SampleCode/XMLencrypt/testXMLenc/kek
javax.crypto.spec.SecretKeySpec@cff939b3
Key: [B@a9c09e
 algorithmURI http://www.w3.org/2001/04/xmlenc#tripledes-cbc
org.apache.xml.security.encryption.XMLEncryptionException: Unknown
canonicalizer. No handler installed for URI BC
Original Exception was
org.apache.xml.security.c14n.InvalidCanonicalizerException: Unknown
canonicalizer. No handler installed for URI BC
	at org.apache.xml.security.encryption.XMLCipher.getInstance(Unknown Source)
	at Encrypter.main(Encrypter.java:170)
org.apache.xml.security.c14n.InvalidCanonicalizerException: Unknown
canonicalizer. No handler installed for URI BC
	at org.apache.xml.security.c14n.Canonicalizer.<init>(Unknown Source)
	at org.apache.xml.security.c14n.Canonicalizer.getInstance(Unknown Source)
	at org.apache.xml.security.encryption.XMLCipher.getInstance(Unknown Source)
	at Encrypter.main(Encrypter.java:170)
Exception in thread "main"


Note that it says I don't have a handler installed for URI BC.
I have the provider in both <javaHome>\lib\ext and <javaHome>\lib\endorsed.
Both locations are in my classpath.

But that did cause a change. I'm downloading j2se 5.0 and maybe that will
solve everything. I'd still like assistance with this issue just in case
5.0 is not the fix.

Thanks.

kevin


Quoting Sean Mullan <Sean.Mullan@Sun.COM>:

> kgp@nethere.com wrote:
> > I did.
> > It is number 6.
>
>  From the stack trace, it seems like you are picking up Sun's JCE
> implementation, and not BouncyCastles. Are you using JDK 1.4? Sun's JCE
> implementation in 1.4 does not support the ISO10126Padding scheme. You
> need to upgrade to at least JDK 1.5 if you want to use Sun's JCE
> provider.
>
> Otherwise, it should fallback and still find BC's provider, but it
> doesn't seem to be doing that. Try putting BC's provider preference
> higher in the java.security file (before Sun's provider).
>
> --Sean
>
> > Quoting Vishal Mahajan <vmahajan@amberpoint.com>:
> >
> >
> >>Did you add an entry like the following to the
> >>"jre/lib/security/java.security" file before running the sample?
> >>
> >>
> >>security.provider.<n>=org.bouncycastle.jce.provider.BouncyCastleProvider
> >>
> >>Vishal
> >>
> >>kgp@nethere.com wrote:
> >>
> >>
> >>>Hi,
> >>>
> >>>I'm hoping someone can help me with this error.
> >>>I get the following output and error when trying to run the sample
> >>>Encrypter.java:
> >>>
> >>>Data: AES
> >>>Key encryption key stored in file:
> >>
> >>c:/SampleCode/XMLencrypt/testXMLenc/kek
> >>
> >>>javax.crypto.spec.SecretKeySpec@141349b0
> >>>Key: [B@1b8f864
> >>>algorithmURI http://www.w3.org/2001/04/xmlenc#tripledes-cbc
> >>>org.apache.xml.security.encryption.XMLEncryptionException: Padding:
> >>>ISO10126Padding not implemented
> >>>Original Exception was javax.crypto.NoSuchPaddingException: Padding:
> >>>ISO10126Padding not implemented
> >>>	at org.apache.xml.security.encryption.XMLCipher.getInstance(Unknown
> >>
> >>Source)
> >>
> >>>	at org.apache.xml.security.encryption.XMLCipher.getInstance(Unknown
> >>
> >>Source)
> >>
> >>>	at Encrypter.main(Encrypter.java:171)
> >>>javax.crypto.NoSuchPaddingException: Padding: ISO10126Padding not
> >>>implemented
> >>>	at com.sun.crypto.provider.SunJCE_h.b(DashoA6275)
> >>>	at com.sun.crypto.provider.DESedeCipher.engineSetPadding(DashoA6275)
> >>>	at javax.crypto.Cipher.getInstance(Cipher.java:149)
> >>>	at org.apache.xml.security.encryption.XMLCipher.getInstance(Unknown
> >>
> >>Source)
> >>
> >>>	at org.apache.xml.security.encryption.XMLCipher.getInstance(Unknown
> >>
> >>Source)
> >>
> >>>	at Encrypter.main(Encrypter.java:171)
> >>>Exception in thread "main"
> >>>
> >>>
> >>>
> >>>I found this thread:
> >>
>
>>http://mail-archives.apache.org/mod_mbox/xml-security-dev/200406.mbox/%3c24761.1086951999@www38.gmx.net%3e
> >>
> >>>But none of that helped. It didn't seem to help the other guy either
> as
> >>>there is another thread 10 days later where he still talks about the
> >>>problem. His email is now defunct so I can't ask him how he eventually
> >>>solved it or if he did.
> >>>
> >>>Any ideas?
> >>>
> >>>I've got the bouncy castle provider jar in <java_home>\lib\endorsed.
> >>>That location is also in my classpath.
> >>>
> >>>Also, I get the following output from the following code:
> >>>
> >>>------output----------
> >>>Cipher provider: SunJCE version 1.42
> >>>Cipher algorithm: DES
> >>>
> >>>--------code---------
> >>>
> >>>import javax.crypto.Cipher;
> >>>
> >>>import javax.crypto.NoSuchPaddingException;
> >>>
> >>>import java.security.Security;
> >>>
> >>>import java.security.NoSuchAlgorithmException;
> >>>
> >>>public class DESCipherGenerator {
> >>>
> >>>   public static void main(String[] args) {
> >>>
> >>>       //Security.addProvider (new com.sun.crypto.provider.SunJCE());
> >>>   	Security.addProvider(new
> >>>org.bouncycastle.jce.provider.BouncyCastleProvider());
> >>>
> >>>       try {
> >>>
> >>>           Cipher cipher = Cipher.getInstance("DES");
> >>>
> >>>           System.out.println("Cipher provider: "
> >>>+ cipher.getProvider());
> >>>
> >>>           System.out.println("Cipher algorithm: "
> >>>+ cipher.getAlgorithm());
> >>>
> >>>       }
> >>>
> >>>       catch (NoSuchAlgorithmException e) {
> >>>
> >>>           e.printStackTrace();
> >>>
> >>>       }
> >>>
> >>>       catch (NoSuchPaddingException e) {
> >>>
> >>>           e.printStackTrace();
> >>>
> >>>       }
> >>>
> >>>   }
> >>>
> >>>Kevin
> >>>
> >>>
> >>>
> >>>
> >>
> >>
> >>
> >>
> >
> >
> >
>
>
>




Mime
View raw message