I'm in the need of an inverse public-key encryption method where you encrypt with the private key and decrypt with the public key. In other words an asymetric encryption where you can't generate the encryption key from the decryption key. Does such encryption exist? If yes which, and which would be the fastest?

If nothing like that exists I would be glad if you helped me out with my situation:

I need to authenticate users logging in from my Java application in the way that the response from the server cannot be falsified and thus giving the user full access to the application. Using public key encryption was an obvious method, I would decrypt data received from the client to confirm the credentials. This won't work because if someone manages to decompile and get the private key from the code, they would be able to generate the public key, which would make them able to crack my application again. So any ideas how I can get this secure?

  • 7
    $\begingroup$ The term "encryption" generally refers to schemes which try to provide confidentiality. What you are trying to achieve is authentication. In an asymmetric setting, this leads to digital signing. However, keep in mind that even if you implement everything correctly, users can still patch your application to simply not perform that check. $\endgroup$
    – yyyyyyy
    Aug 26, 2015 at 18:33
  • 2
    $\begingroup$ The definition of what you are looking for doesn't really make sense. I can define RSA' to be RSA where the public-key and private-key are interchanged. Now RSA' has the property that you asked for, but not the property that you want... $\endgroup$ Aug 26, 2015 at 21:01
  • 2
    $\begingroup$ What are you actually worried about? Is it that someone can figure out how to fake a response from your server (and if so, a good signature algorithm would fix that)? Or, is it that someone would modify your Java application so that it no longer cares whether it can talk to the server? The latter is a much tougher problem. $\endgroup$
    – poncho
    Aug 26, 2015 at 22:13
  • $\begingroup$ The "inverse" of encryption that you are wondering about is a digital signature - like poncho mentioned. The server alone knows the signing key and all clients get the verification key - even with the verification key, one cannot sign a server response, only the server with the signing key can do that. It's the same system that's used on playstation games, for example - every PS has a copy of the verification and will only run games that have been signed by Sony. $\endgroup$
    – user2552
    Aug 27, 2015 at 14:27
  • $\begingroup$ If you are trying to keep people from using your program without your permission using this, they will modify he code on their client side to make it think it validated even though it didn't, or other such client side changes. $\endgroup$
    – Alan Wolfe
    Aug 28, 2015 at 4:19

1 Answer 1


What you are looking for is so called white-box cryptography. That said, you should definitely check if you can't get away with digital signatures. The reason is that white box cryptography is a special case of program obfuscation that is quite hard to achieve. Existing, practical schemes do not rely on hard problems but rather on not being broken so far. So you do not get rigorous security guarantees but only the statement that nobody that tried did succeed (which says nothing about how many tried and who tried...).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.