1

Hi I am working with android.I had created a library project in which data fetched from my server.Now I need to provide my library project to a third party developer, So How can I encrypt my server URL to others??

  • possible duplicate of [hiding strings in Obfuscated code](http://stackoverflow.com/questions/4427238/hiding-strings-in-obfuscated-code) – Manish Dubey Mar 10 '14 at 06:31
  • 1
    If you're relying on a hidden URL to protect your service, you're screwed. First, there is no way that you can protect it enough that they can't get around it- if nothing else they can catch the DNS queries leaving the device. Secondly, any other user who accidentally finds your URL, such as a portscanner or spider will screw you over. – Gabe Sechan Mar 10 '14 at 06:42
  • @GabeSechan agreed with u r point – Developer Mar 10 '14 at 07:00

3 Answers3

0

Try this way :

String stringThatNeedsToBeEncrpyted = "PutYourURL"; 
        MessageDigest mdEnc = null;
        try {
            mdEnc = MessageDigest.getInstance("MD5");
        } catch (NoSuchAlgorithmException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } // Encryption algorithm
        mdEnc.update(stringThatNeedsToBeEncrpyted.getBytes(), 0, stringThatNeedsToBeEncrpyted.length());
        String md5 = new BigInteger(1, mdEnc.digest()).toString(16); 
        System.out.println(md5); 
Developer
  • 6,292
  • 19
  • 55
  • 115
  • I created encrypted url in a separate project , Now can i used it instead of my original url in my original project ? is it wrks?? or need of encryption in the same project ?? –  Mar 10 '14 at 06:52
0

I think even you encrypt your URL with des and then decrypt it to connect to your server,as your source code is provided to others,then can see it clearly because then can debug your code.

tianwei
  • 1,859
  • 1
  • 15
  • 24
0

I think , SHA-512 OR BCRYPT is the best mechanism for hashing to prevent hacking from hackers. please follow one of them.