Take the 2-minute tour ×
Information Security Stack Exchange is a question and answer site for Information security professionals. It's 100% free, no registration required.

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.

share|improve this question

migrated from stackoverflow.com Oct 1 '12 at 14:43

This question came from our site for professional and enthusiast programmers.

    
Does that lockout things like OpenID, Shibboleth and other federated authentication protocols? When you say password-less, what does that mean in practice? –  Jared Farrish Oct 1 '12 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 Oct 1 '12 at 2:37
    
Have you looked around the Openwall site (home of PHPass)? There's a lot of resources located there or linked through. –  Jared Farrish Oct 1 '12 at 2:45
    
Thank you Jared, I'm going to read it, hopefully I'll find an answer to my question... –  Gdhami Oct 1 '12 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. –  Jared Farrish Oct 1 '12 at 2:57

2 Answers 2

up vote 1 down vote accepted

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.

share|improve this answer

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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