You can use the Bouncy Castle libraries instead.

On 29 mar, 16:20, jaafar zbeiba <[email protected]> wrote:
> hello I tried encryption of any errors I ecplise but the problem when
> I run the emulator I get error message on exception
> here is the code
> [Code] package example.com.cryptage;
>
> import java.security .*;
> import javax.crypto .*;
>
> / /
> / / Encrypt and decrypt using private key algorithm THE DES
>
> public class IN {
>
> public static void main (String [] args) throws Exception {
> / /
> / / Check args and get plaintext
> if (args.length! = 1) {
> System.out.println ("Usage: java PrivateExample text");
> System.exit (1);
>
> }
>
> / / Byte [] plainText = args [0]. GetBytes ("UTF8");
> String ss = "Hello world, haris is here!"
> byte [] plainText ss.getBytes = ();
> / /
> / / Get private key OF
> System.out.println ("\ nStart OF Generating key");
> KeyGenerator keygen = KeyGenerator.getInstance ("DES");
> keyGen.init (56);
> Key key = keyGen.generateKey ();
> System.out.println ("Generating the Key Finish");
> / /
> / / Get cipher object and print OF The Provider
> Cipher cipher = Cipher.getInstance ("DES/ECB/PKCS5Padding");
> System.out.println ("\ n" + cipher.getProvider (). GetInfo ());
> / /
> / / Encrypt using The Key And The plaintext
> System.out.println ("\ nStart encryption");
> cipher.init (Cipher.ENCRYPT_MODE, key);
> byte [] ciphertext = cipher.doFinal (plaintext);
> System.out.println ("Finish encryption:");
> System.out.println (new String (ciphertext, "UTF8"));
>
> / /
> / / Decrypt ciphertext using the Same The key
> System.out.println ("\ nStart decryption");
> cipher.init (Cipher.DECRYPT_MODE, key);
> byte [] newPlainText cipher.doFinal = (ciphertext);
> System.out.println ("Finish decryption:");
>
> System.out.println (new String (newPlainText, "UTF8"));}
> }
>
> [/ Code]
> here is the error in java
> [Code] #
> # A fatal error has Been Detected By The Java Runtime Environment:
> #
> # Internal Error (classFileParser.cpp: 3375), pid = 376, tid = 3568
> # Error: ShouldNotReachHere ()
> #
> # JRE version: 6.0_24-b07
> # Java VM: Java HotSpot (TM) 64-Bit Server VM (19.1-b02 mixed mode
> windows-amd64 oops compressed)
> # An error report File with more information is saved as:
> # C: \ Users \ hp \ Encryption \ hs_err_pid376.log
> #
> # If You Would Like to submit a bug report, please visit:
> # Http://java.sun.com/webapps/bugreport/crash.jsp
> #
> [/ Code]

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to