DES, Java version dependency?

Hi,
this is my first posting so please be patient :)
i've written a module that writes DES-Encrypted email-addresses into my MySQL-database. Everything works fine, decription is working too.
The problem is, after I've changed the Java - Version (from 1.4.2_05 to _06) and
recompiled all classes, the addresses can't be decripted.
Where exactly is the problem?
Is it the recompilation itself, or java version dependency ?
Please help me
Thx

The only thing that is suspect is that you don't explicitly define the block mode and the padding. Though I don't like your exception handling and I don't like the way you keep generating new byte arrays and then never using them I don't think these features cause the problem.
Also, you should look at the SUN coding standards for method names.
I have taken the liberty of simplifying your code. Please feel free to ignore my changes if you want.
import javax.crypto.*;
import javax.crypto.spec.*;
import java.security.*;
import java.io.*;
public class DEScoder
    static public class EncryptionException extends Exception
        private EncryptionException(String text, Exception chain)
            super(text, chain);
    private static final String algoName = "DESede";          // triple-DES
    private SecretKey secretKey;
    private final byte[] tripleDesKeyData;
    private Cipher cipher;
    private Cipher getCipher()
        return this.cipher;
    private SecretKey getSecretKey()
        return this.secretKey;
    private Cipher CreateCipher(String password) throws EncryptionException
        try
            secretKey = new SecretKeySpec(tripleDesKeyData, algoName);
            // /ECB/PKCS5Padding should be the default block mode and padding but just in case
            return Cipher.getInstance(algoName + "/ECB/PKCS5Padding");
        catch (Exception e)
            throw new EncryptionException("Cannot create Cipher", e);
    public synchronized String EncodeString( String originalText ) throws EncryptionException
        try
            getCipher().init( Cipher.ENCRYPT_MODE, secretKey );
            byte[] utf8 = originalText.getBytes("UTF8");
            byte[] enc = getCipher().doFinal(utf8);
            return new sun.misc.BASE64Encoder().encode(enc);
        catch (Exception e)
            throw new EncryptionException("Problem encrypting", e);
    public synchronized String DecodeString(String encryptedText) throws EncryptionException
        try
            getCipher().init(Cipher.DECRYPT_MODE, secretKey);
            byte[] dec = new sun.misc.BASE64Decoder().decodeBuffer(encryptedText);
            byte[] utf8 = getCipher().doFinal(dec);
            return new String(utf8, "UTF8");
        catch (Exception e)
            throw new EncryptionException("Problem decrypting", e);
    public DEScoder() throws EncryptionException
        try
            tripleDesKeyData = "A_key_24_characters_long".getBytes("ASCII");
            this.cipher=this.CreateCipher("allemalache");
        catch (EncryptionException e)
            throw e;
        catch (Exception e)
            throw new EncryptionException("Problem creating DESencoder", e);
    }//coder
    public static void main(String[] args)
        try
            // Make sure SUN are a valid provider
            Security.addProvider(new com.sun.crypto.provider.SunJCE());
            DEScoder dataStringEncryptAgent = new DEScoder();
            // Get the data string to encrypt from the command line
            String dataString = (args.length == 0)? "The quick brown fox jumps over the lazy dog." : args[0];
            System.out.println("Data string ....................[" + dataString + "]");
            String encodedEncryptedDataString = dataStringEncryptAgent.EncodeString(dataString);
            System.out.println("Encoded encrypted data string ..[" + encodedEncryptedDataString + "]");
            String recoveredDataString = dataStringEncryptAgent.DecodeString(encodedEncryptedDataString);
            System.out.println("Recovered data string ..........[" + recoveredDataString + "]");
        catch (Exception e)
            e.printStackTrace(System.out);
}//classMore simplifications are possible.

Similar Messages

  • Java version and amount of SAPDATA

    Hi!
    I would like to install SAP Solution Manager on Solaris Sparc 10 Zone (64 Bit) with Oracle.
    Questions:
    1) Which Java version applies for the installation? I have installed 1.4.2.12.
    2) Is that problem that the <sid>adm user exist already on the server?
    Or should I delete these, because thes will be created with SAPINST?
    I run Installation as root-user
    3) How much SAPDATA do I need for the installation. I would abolish to have more than 3 SAPDATA. So I have 3 SAPDATA, each 70 GB. Is that ok? 
    Thank you very much!
    regards
    Thom

    Hi Thom,
    1) Which Java version applies for the installation? I have installed 1.4.2.12.
    Answer: Please go through the note 716604, and also 1.4.2_12 version for JDK is fine. You can go with this.
    2) Is that problem that the <sid>adm user exist already on the server?
    Answer : It wont be the problem if it exists,but check the owner and modes as per the guide and change it.
    3. should I delete these, because thes will be created with SAPINST?
    Answer:  Yes,users will be created by SAPINST,but if its already exists, you dont need to delete this. If you dont know the changing of owners or modes for the sidadm user. you can delete, it will create by SAPINST.
    4.I run Installation as root-user
    Answer: Yes. you have to start installation with root user.
    5.3) How much SAPDATA do I need for the installation. I would abolish to have more than 3 SAPDATA. So I have 3 SAPDATA, each 70 GB. Is that ok?
    Answer: SAP recommends 4 sapdata's. The size is depends on how much data you maintain in the system. Try to create SAPDATA4 and distrube the size to all 4 sapdata's.
    Hope you understand this.
    Thanks
    Kishore

  • Java is dependent????

    hi friends actualy my friend went to interview there they asked this question...
    java is dependent...justifyy..
    anyone can pls justify this...
    thanku
    byee,
    keerthi.

    Well it depends if there is a virtual machine to run
    Java, so Java is dependent on a JVM.It's not just if there's a VM. The VM itself is platform-dependent.
    Your wording is kind of vague, but I assume the question was something like, "Java claims to be platform-independent, but it is at least partially platform-dependent. Explain."
    Java is platform-independent in that for many requirements, you can write and compile code where the same class files will work on any platform with a VM of the appropriate version--Windows, Linux, Mac... No need to write different code for different platforms, or even to recompile. This is because your Java code always runs on the same platform.
    Java is platform-dependent in that the VM must be different for each platform. The VM provides the abstraction that lets your Java code think it's always running on the same platform, but of course a VM that runs on Windows will be different from one that runs on Linux. SOMETHING has to deal with the differences among the various platforms, and that's the VM's job.

  • Upgrade default java version in Solaris 8?

    I have Solaris 5.8 running on sun blade system. Default Java version is 1.2.2 and user need it to upgraded to latest version of Java so, I installed jre1.6.0 (combination of 32-bit install and 64 bit install). Now I can't point solaris to look at the newly installed java version. I have tried to change the path variable in .cshrc but it is readonly to root and group is deamon. I also tried changing the symbolic link from /usr/java to /usr/jre1.6.0 but it is still looking at default version of java1.2.2.
    I need help as I don't know much about Solaris to upgrade this java. Any help or guidance is greatly appreciated.
    Thanks,
    solaris_newbee

    After installing, you need to update the '/usr/java' sym link to point to your new root installation. For example, I installed jdk1_5_16 at /usr/jdk/jdk1.5.0_16/ and then added this symlink:
    ln -s /usr/jdk/jdk1.5.0_16/ /usr/java
    You may need to remove the symlink that is already there before it will allow you to successfully create the new one.
    There are several other dependent symlinks in /usr/bin that use /usr/java, but you only have to update /usr/java.
    From one noob to another.

  • "java -version" fails in Solaris 5.9 with relocation error

    Hi all,
    Appologies for the Java 'newbie-ness' of this query from the outset... But here goes. My current configuration is ...
    SunOS 5.9 Generic_112233-11 sun4u sparc SUNW,UltraAX-i2
    and I'm trying to run with Java 2 SDK, Standard Edition Version 1.4.1
    As far as I know, local support has fed me with the required patches to get me up and running so as I can use 'jar' to upgrade a jarfile. But if I try to do this (or even just try "java -version"), I just get...
    Error: failed /usr/j2se/jre/lib/sparc/client/libjvm.so, because ld.so.1: java: fatal: relocation error: file /usr/j2se/jre/lib/sparc/client/libjvm.so: symbol __1cG__CrunSregister_exit_code6FpG_v_v_: referenced symbol not found
    I can only find this bug (?) referencing Solaris 5.7 at most recent. Am I missing something obvious?
    I've got...
    setenv JAVA_HOME /usr/j2se
    setenv LD_LIBRARY_PATH $JAVA_HOME/jre/lib/sparc/server:$JAVA_HOME/jre/lib/sparc
    Are the solaris 7 patches not necessarilly in the patch bundle I've had stuffed on here...?

    It looks like that the likely cause of this error is some failed library dependancy. You can manually check if all libraries libjvm.so depends on are actually present on the system by running the following commands:
    $ cd /usr/j2se/jre/lib/sparc/client/
    $ ldd libjvm.so
    The output of the ldd command should look something like the following with possible slight deviations:
    libCrun.so.1 => /usr/lib/libCrun.so.1
    libdl.so.1 => /usr/lib/libdl.so.1
    libthread.so.1 => /usr/lib/libthread.so.1
    libsocket.so.1 => /usr/lib/libsocket.so.1
    libnsl.so.1 => /usr/lib/libnsl.so.1
    libm.so.1 => /usr/lib/libm.so.1
    libw.so.1 => /usr/lib/libw.so.1
    libc.so.1 => /usr/lib/libc.so.1
    librt.so.1 => /usr/lib/librt.so.1
    libmp.so.2 => /usr/lib/libmp.so.2
    libaio.so.1 => /usr/lib/libaio.so.1
    libmd5.so.1 => /usr/lib/libmd5.so.1
    /usr/platform/SUNW,Ultra-60/lib/libc_psr.so.1
    /usr/platform/SUNW,Ultra-60/lib/libmd5_psr.so.1
    Check if all library path's are actually present on the system, otherwise you will need to satisfy the missing dependencies.

  • Which JAVA version is most stable in 1.6 series?

    Which JAVA version is most stable in 1.6 series?

    Ideally that would be the latest and greatest available.
    In practice, it depends on a whole lot of unknowns. Different JVMs can perform differently on different OSes and with different configs

  • JConnector - which Java Version is supportet?

    Hi we have to develop a solution which connects a PDA (Windows Mobile) to the SAP System. We tried to use JAVA 1.5 but the virtual machine of our PDA does not support JAVA 1.5. It only supports JAVA up to version 1.3.
    So my question: Does JConnector 2.1.2 support JAVA version 1.3?
    Best regards
    Volker

    Ideally that would be the latest and greatest available.
    In practice, it depends on a whole lot of unknowns. Different JVMs can perform differently on different OSes and with different configs

  • Reg Compatible Java Version with SAP EP7 SP20

    hi
    can anyone please let me the compatible java version with SAP EP7 SP20
    thanks in advance

    I am able to solve this problem
    Browser Version
    INTERNET EXPLORER 8.0  WIN VISTA 32-BIT                                   
    INTERNET EXPLORER 8.0  WIN VISTA 64-BIT                                       
    INTERNET EXPLORER 8.0  WIN XP 2002 HOME 32-BIT                   
    INTERNET EXPLORER 8.0  WIN XP 2002 PROF. 32-BIT                  
    FIREFOX 3.0  WIN VISTA 32-BIT  Released                                          
    FIREFOX 3.0  WIN VISTA 64-BIT  Released   
    FIREFOX 3.0  WIN XP 2002 HOME 32-BIT  Released 
    FIREFOX 3.0  WIN XP 2002 PROF. 32-BIT  Released 
    Adobe Flash Version
    Flash Player Version       10.+  (depends on the type and version of the browser we are using)
    Java Version
    JDK 1.4.2_11

  • EM Question (Java version)

    Hi Guys,
    I have a question about EM (Java version, not the web based one).
    Lately, we are having issues displaying tablespaces and datafiles informations.
    It takes up to 10 minutes just to display the datafiles from a tablespace (when double-clicking on a tablespace name). Then it takes another 10 minutes if we click on a datafile to display the information of that datafile. Samething if we apply a change.
    Is there anything we can look at to solve this situation?
    Thank you,
    Nayas
    aka Felix

    To absolutely assure that a program will run on 1.3, it need to either
    1. Be compiled by 1.3, or
    2. Be compiled by (say) 1.4 using the -target 1.3 and -bootclasspath options. Using the -target option alone may or may not work, depending on code usage and changes that were made in 1.4..
    This information is detailed in the javac documentation here http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javac.html
    You should read and understand this if you need to cross-compile versions.

  • Java version troubles

    I have just installed
    jdk-1_5_0_11-linux-i586.rpm.bin
    on my linux machine. Nevertheless, when I type on a command line
    java --version
    I get ' java version "1.4.2" '.
    What do I need to do to upgrade to java 1.5? (I have troubles executing programs with parametrized types -- they compile with -source 1.5 option, but don't execute).
    Thanks a million in advance!

    Thanks for replying! How do I alter my path? (Sorry,
    I'm a complete newbie.)It's dependent on the OS that you are using, and I think it also is dependent on the shell that you are using. Google on your OS and shell and change path.
    Do also check if you have a symbolic link from java to the correct version. That's often used on unix/linux based systems, but all of this is pure OS specific and doesn't involve java at all.
    Kaj

  • Tuxedo ATMI-Java version?

    Hi,
    Please let me know whether Java version of Tuxedo ATMI is available.
    Also how to invoke a ELink service from a tuxedo application?
    Please help.
    Thank U
    Lakshmi

    There is no server-side Java version of ATMI. You can write Java
    clients using the Jolt API to invoke Tuxedo services. An eLink service
    is just another Tuxedo service, the name of the service and the types of
    arguments will vary depending on the products being used...
    Lakshmi Muralidharan wrote:
    Hi,
    Please let me know whether Java version of Tuxedo ATMI is available.
    Also how to invoke a ELink service from a tuxedo application?
    Please help.
    Thank U
    Lakshmi

  • I get pop ups about updating my Java version but my system says I do have the right version. Which version is the right one?

    I get pop ups about updating my Java version but my system says I do have the right version. Which version of Java is the right one?

    Most likely, you have a web plugin that depends on the Java runtime distributed by Apple, such as the Facebook video calling plugin or the "NexDef" plugin for watching baseball streams. If you no longer need the plugin, remove it. Otherwise, install Java.

  • HT1338 download Java version 10.6.8 and above

    Hello
    I have a MAC Pro (OZ X 10.6.8). My netbank "log in" service requires the newest version of Java.
    Have tryed to download Java 6 again - Have also tryed to download the "7 version", but my Mac dosent accept that (think it was Lion version?).
    My netbank is; SR bank, Norway. There is a link on their homepage - but, that dosent help me anything.
    I have also checked under
    JAVA SE 6 IS THERE, both 64 bit and 32 bit. It is also hooked of (activiate...). THe version I got is: 1.6.0_37-bo6-434 (both).If I am not wrong that is the version my bank requires.
    What am bit unsure/conserneded about is if i have the Java version installed (even if I found "Java choice" under programs.
    Can you please help me. This has never been a problem before...(it started when Java had a lot of problem)
    Kind regards Annie
    ([email protected])

    To see if Java is installed (that is, if you haven't disabled it in Java Preferences.app) enter into Terminal in Utilities and hit return.
    java -version
    If you use Safari, Apple has disabled Java 6 from there. Probably also Firefox and Chrome.

  • ReportViewer.jar running under Java Version 6 Update 17

    Hello,
    Does anyone know how to resolve the missing icons issue when running the ReportViewer.jar tool under the above Java version. Under update 16 the viewer had all the correct buttons and icons and worked great. Since the upgrade to Java update 17 the icons have disappeared from the viewer. The buttons are still there but no icons.
    I am using Crystal Reports XI developer edition with the latest service packs on Windows 7.
    Regards
    Adrian

    This solution worked for me. All settings and bookmarks are intact. Thank you.

  • I am trying to revert my Java to 1.6 from 1.7. The System Preferences Java icon is disabled. But when I enter java -version in terminal it shows 1.6.0_65.  Please help me in giving explicit commands to get back my Java 1.6

    I earlier had a java 1.7 installed in my system.  I wanted to revert the version back to 1.6.  I downloaded the file JavaForOSX2014-001.dmg and installed it in my hard disk.  I am not sure where it has installed it but it has successfully done it.  When I open up the terminal and enter java -version it shows 1.6.0_65 version as the java version. 
    But in the System Preferences, Java is disabled and does not show the java as being installed.  Please guide me in getting my java 1.6 back.

    The preferences pain shows this message when I click on the Java icon -- “Java can’t be opened because it isn’t available".

Maybe you are looking for

  • My 2008 Airport Extreme no longer carries throughout my house. Will the newwest version fix that problem?

    I have a 2008 Airport Extreme and it's signal is too weak to reach the back of the house. Will the laterst version AE fix that problem? Thanks, windancertoo2354

  • Active computer list?

    How do I tell which of my computers is activated in Creative Cloud?  My iMac has Photoshop activated on it but it will not do anything in Photoshop.  Any idea why?

  • Permissions Issue

    Hi there, A while back I wanted to change the shortname of my user account, so I followed the instructions here: http://discussions.apple.com/thread.jspa?messageID=9126222 Now I am finding a quirk on only a few documents. They claim to belong to a us

  • 750GB Seagate External Drive - Disk Insertion error

    I have two 750 GB Seagate External hard drives, which are daisy chained to my PowerMac G5. I was transfering files between external hard drives, when all of a sudden the computer crashed. Once I restarted, the computer gave a disk insertion error: Di

  • Copy ans paste a picture into a yahoo email

    '''bold text''' How can i copy & paste < not attach> a picture into a yahoo email. I was able to do this from photobuckets with internet explorer but can't with firefox???? I don't want to attach as it loose the effect