You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@santuario.apache.org by kg...@nethere.com on 2005/09/06 08:39:27 UTC

padding error

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



Re: padding error

Posted by kg...@nethere.com.
By the way, it's the same error when I put it as number one.
If I use another app to list the providers it finds the BC provider fine.

I removed the explicit "BC" from the getInstance calls.
Now I get this error:

Data: DES
Key encryption key stored in file:/C:/SampleCode/XMLencrypt/testXMLenc/kek
javax.crypto.spec.SecretKeySpec@f5f60529
Key: [B@1c92535
 algorithmURI http://www.w3.org/2001/04/xmlenc#tripledes-cbc
Sep 7, 2005 3:15:20 PM org.apache.xml.security.encryption.XMLCipher doFinal
SEVERE: Source element unexpectedly null...
Sep 7, 2005 3:15:20 PM org.apache.xml.security.encryption.XMLCipher
encryptElementContent
SEVERE: Element unexpectedly null...
Sep 7, 2005 3:15:20 PM org.apache.xml.security.encryption.XMLCipher
encryptData
SEVERE: Element unexpectedly null...
java.lang.NullPointerException
	at org.apache.xml.security.encryption.XMLCipher.encryptData(Unknown Source)
	at
org.apache.xml.security.encryption.XMLCipher.encryptElementContent(Unknown
Source)
	at org.apache.xml.security.encryption.XMLCipher.doFinal(Unknown Source)
	at Encrypter.main(Encrypter.java:212)
Exception in thread "main"

The file I'm using to test this is attached as a txt file.

Thanks again,

kevin

Re: padding error

Posted by Sean Mullan <Se...@Sun.COM>.
kgp@nethere.com wrote:
> Last question...
> 
> I fixed the problem. The last issue was also my fault. I had changed the
> algorithm to DES when I was troubleshooting and for some reason it doesn't
> like algorithms under 128 bit. But I don't know why it didn't work
> previously.
> 
> Why couldn't it find the provider at number 6?
> 
> I'm new to java encryption so I'll figure out how why it didn't like DES
> vice triple DES.
> 
> I just don't know why the providers didn't cascade.

It's a bug in JDK 1.4.2. If a Cipher implementation doesn't support a 
particular padding scheme, it doesn't fallback and check the remaining 
providers. If you upgrade to 1.5 (5.0), the problem will go away.

--Sean


Re: padding error

Posted by kg...@nethere.com.
Last question...

I fixed the problem. The last issue was also my fault. I had changed the
algorithm to DES when I was troubleshooting and for some reason it doesn't
like algorithms under 128 bit. But I don't know why it didn't work
previously.

Why couldn't it find the provider at number 6?

I'm new to java encryption so I'll figure out how why it didn't like DES
vice triple DES.

I just don't know why the providers didn't cascade.

Thanks for the assistance.

kevin




Re: padding error

Posted by kg...@nethere.com.
Ok, one more update. The last error was entirely my fault.
I was searching for an element that didn't exist.

But I'm still getting errors.
Current configuration:
BC provider at number 2.
searching for text1 element.
Still using j2se 1.4.2

This is the latest output and error:

Data: DES
Key encryption key stored in file:/C:/SampleCode/XMLencrypt/testXMLenc/kek
javax.crypto.spec.SecretKeySpec@6a844b7f
Key: [B@1c92535
 algorithmURI http://www.w3.org/2001/04/xmlenc#tripledes-cbc
java.lang.IllegalArgumentException: Key length not 128/192/256 bits.
	at
org.bouncycastle.crypto.engines.AESFastEngine.generateWorkingKey(AESFastEngine.java:606)
	at
org.bouncycastle.crypto.engines.AESFastEngine.init(AESFastEngine.java:679)
	at
org.bouncycastle.crypto.modes.CBCBlockCipher.init(CBCBlockCipher.java:79)
	at
org.bouncycastle.crypto.paddings.PaddedBufferedBlockCipher.init(PaddedBufferedBlockCipher.java:74)
	at
org.bouncycastle.jce.provider.JCEBlockCipher.engineInit(JCEBlockCipher.java:420)
	at
org.bouncycastle.jce.provider.JCEBlockCipher.engineInit(JCEBlockCipher.java:473)
	at javax.crypto.Cipher.init(Cipher.java:370)
	at org.apache.xml.security.encryption.XMLCipher.encryptData(Unknown Source)
	at
org.apache.xml.security.encryption.XMLCipher.encryptElementContent(Unknown
Source)
	at org.apache.xml.security.encryption.XMLCipher.doFinal(Unknown Source)
	at Encrypter.main(Encrypter.java:212)
Exception in thread "main"

Re: padding error

Posted by kg...@nethere.com.
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 <Se...@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 <vm...@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
> >>>
> >>>
> >>>
> >>>
> >>
> >>
> >>
> >>
> >
> >
> >
>
>
>




Re: padding error

Posted by Sean Mullan <Se...@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 <vm...@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
>>>
>>>
>>>
>>>
>>
>>
>>
>>
> 
> 
> 


Re: padding error

Posted by kg...@nethere.com.
I did.
It is number 6.

Quoting Vishal Mahajan <vm...@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
> >
> >
> >
> >
>
>
>
>




Re: padding error

Posted by Vishal Mahajan <vm...@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
>
>
>  
>