1

My question: Anyone knows how to implement SRP / Diffie-Hellman authentication in PHP (or if this has already been done)?


(Some details)

  1. I'm using CodeIgniter with TankAuth (both latest version)
  2. I'm forcing SSL access via .htaccess

One of the requirements of this project is to use challenge-based authentication, I read a lot about it, it seems that making SRP / Diffie-Hellman work with TankAuth (along with SSL) is a secure authentication solution (provided it's properly done!)

The only real problem is: I just couldn't translate the SRP specification into PHP/mysql (I thought I was good at math but obviously I'm not!)

It doesn't matter if it's plain php, I can adapt the code to make it work with CodeIgniter/TankAuth.

I googled a lot, the closest I could find is this, but the implementation just doesn't feel right.

I also understand I'll eventually have to adapt this to make the two-steps authentication process look like a normal one-step standard login form (using ajax), but that's for later, right now I'm stuck with the logic.

9
  • Does that lockout things like OpenID, Shibboleth and other federated authentication protocols? When you say password-less, what does that mean in practice? Commented Oct 1, 2012 at 2:32
  • @JaredFarrish: I'm not familiar with Shibboleth, but I can't use OpenID. Project specs specify that I have to use challenge-based authentication (I'm going to edit my post right away)
    – Gdhami
    Commented Oct 1, 2012 at 2:37
  • Have you looked around the Openwall site (home of PHPass)? There's a lot of resources located there or linked through. Commented Oct 1, 2012 at 2:45
  • Thank you Jared, I'm going to read it, hopefully I'll find an answer to my question...
    – Gdhami
    Commented Oct 1, 2012 at 2:52
  • Are you or would you call this Two-Factor Authentication? Or is it somehow just different enough to not be two-factor? Because there's goes to be lots of two-factor setups, including one for CodeIgniter. What seems to be described doesn't factor in a physical second factor like an RSA key fob. Commented Oct 1, 2012 at 2:57

2 Answers 2

1

I've looked at the SRP specs some time ago, and they nicely describe how to use some well known cryptographic building blocks and shape them into a zero-knowledge protocol. However, the cryptographic building block themselves are not explained (they are considered to be common knowledge for cryptographers).

If I understood correctly, SRP uses a mathematical scheme that can be proven to reduce to the Diffie-Hellman problem (my terminology is probably incorrect, I mean to say that the SRP problem can be proven to be at least as computationally expensive as the Diffie-Hellman problem) but it does not equal Diffie-Hellman.

Keep in mind that a zero knowledge password scheme is considered to be one of the hardest things to implement correctly. I've written an answer on SRP some time ago. As you can see, it is significantly more complex than the 'Password salting and the modified Challenge-Response system'-implementation in the article you linked. (And you are correct in not trusting it, I think I can spot weaknesses in it, and I'm only a security enthusiast, not a cryptographer or security professional).

In addition to the above, SRP is, as far as I know, a copyrighted scheme.

So my advice would be: stick with the current best practice of using a strong hashing algorithm (BCrypt) on the server side secure your communication channel with TLS (SSL), instead of implementing a very complex scheme such as SRP.

2

The algorithm was ported to JavaScript for clients (browsers) and to PHP for servers: See Ruslan Zavacky's spr-6a-demo on GitHub.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .