I wrote a game which stores high score information on an ftp server. In the the source code I need to write out the ftp link with the account name and password in it.
url = new URL("ftp://name:email@example.com/");
This is java, btw. In the class file strings are preserved as they are written in the source code. So if someone were able to read the class file the could find this string, ftp://name:firstname.lastname@example.org/, with the user name and password in plain sight, as plain as slight gets in a class file anyway.
What would be an appropriate way to secure the user name and password?
I made an encryption class in java and replaced the name and password with calls to the encrypter with an encrypted user name and password for example:
url = new URL("ftp://Crypter.crypt("q345uih34",3)+:+Crypter.crypt("nfk3iugr29o8",-2)+@www.mywebsite.com/");
Would this be sufficient? And I wasn't sure if obfuscation was the best solutions though.