I'm writing a Java EE application, which allows new users to register themselves and then log in over the Internet. I'm storing the credentials an a db.
Now, there are several ways to do that, e.g.:
- send username and password, preferably over a TLS/SSL connection
- send username and a hashcode of the password, preferably over a TLS/SSL connection
- use the Secure Remote Password protocol (preferably over a TLS/SSL connection ?)
Reading some articles, it seems the Secure Remote Password Protocol (SRP) is the way to go.
But then reading some other articles it seems as this is only used on some low-level layers, e.g. such as TLS/SSL itself.
I still think, it's recommended to use the Secure Remote Password Protocol on application level.
Is this correct? Or are there some good reasons why this is not needed on application level?
There are a few tradeoffs to consider. First, sending raw passwords over an SSL link is reasonably secure if, and only if, the client is properly validating the server's SSL certificate. However, even when proper SSL certificate validation is preformed, sending the raw password to the server is not completely ideal. A hacked server could expose the user's password. As passwords are frequently re-used in other places, this kind of exposure has potentially serious implications.
An advantage to SRP is that it avoids both of these issues. The users's password never leaves their machine and proper SSL certificate validation is not necessary. The mutual-authentication properties of SRP renders SSL certificates redundant. In fact, some applications take advantage of this to completely avoid the headaches associated with proper SSL certificate management. They just use anonymous, self-signed certificates on the servers for data encryption purposes only and leave the authentication up to application-level SRP.
Specifically to your question, I think applicability of SRP to low-level vs application-level use really depends on your application. It can function well in both arenas but where it's best employed really boils down to the particular set of design constraints you're working with.