padding error

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

padding error

kgp-2
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:/Documents and
Settings/Owner/Desktop/MCIS685/FinalProject/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@...%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