padding error - update

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

padding error - update

kgp-2


The following code has the expected output:

-----output--------

Cipher provider: BC version 1.24
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","BC");

            System.out.println("Cipher provider: "
+ cipher.getProvider());

            System.out.println("Cipher algorithm: "
+ cipher.getAlgorithm());

        }

        catch (Exception e) {

            e.printStackTrace();

        }

    }

}