Storing a Password String in the Code
I know how to save a password in a Database using One-Way Hash-Algorithms. But in my case, i need the password in plain text to log into the Service (Dropbox API).
So if i want to create an application, w开发者_如何学Chich always uses the same username/password to log into Dropbox (e.g. for a client), how would i save the users password in my Java Code, so it can not easily be read using a HexViewer?
It should be something that encrypts and decrypts the String, but it can't be binded to one single machine.
Well, encrypt password with DES or AES, keep the key in the jar and descrypt only when you need. But if someone will need, he will easily reverse this and extract your login and password.
As long as you need it in clear text in your program, it can not be sure. Whatever you do, your program may be analyzed, decompiled, run in a "compromised" VM, whatever.
精彩评论