Username and password is an authentication system where you would transmit the pair trough (encrypted) channel and use it to prove to the server that client is who it claims to be (knowledge of the password is the proof). In contrast, Zero Knowledge authentication protocols never transmit a password over the channel. They work on challenge-response scheme.
Since you are designing a zero knowledge solution based on Guillou Quisquater authentication protocol, having username and password will defeat the purpose. This would in turn answer your first question: no, you will not have username and password on the registration. The purpose of registration is to introduce the client to the server as a registered client. During registration, a user will provide some means for the server to verify the client in the future (authentication). In username and password authentication scheme, this would be the password. It would be later used to prove to the server that the client is the one who registered and the knowledge of the password is the proof of this. Registration in a zero knowledge authentication protocol would be a bit different.
On purely theoretical level, without going into details on any specific point, here are the steps needed to design such a scheme:
Registration
- Client will generate public and private key pair
- Client will present it's public key to the server (who also assumes trusted authority role)
- Server will make the public key into a certificate and send it to client
- Client is responsible for storing the certificate and private key corresponding to this certificate securely. Certificate is in turn the username and the private key would be the password even though it would never be transmitted over the wire.
Authentication
- Client will present it's certificate to the server
- Server will check the certificate and reject it if it is not valid (not issued by the server).
Taken directly from article you linked:
- Prover chooses random k ∈ Zn∗
- Prover sends verifier Cert(prover), γ = kb mod n
- Verifier checks certificate, rejecting if verTA(ID(prover) || v, s)≠true.
- If check is successful, server will continue with the authentication scheme as you described in your question.
Answers to your questions
When the user register, the scheme said that the server select 2
primes p and q. Should I generate the 2 primes on each user
registration? or should I generate the 2 prime numbers once and use
those primes for every user?
These two numbers are not generated on user registration but on initial set up. You would generate them once and use them on every user registration.
Is there any PHP library that can compute z = vr yb mod n fast?
because it takes up to 3 minutes when computing this equation (I
tested with p=337 and q=357)
You will need to ask this specific question on another SE, probably on stackoverflow.SE. You will also need to do mathematical (RSA) calculations on the client side and will need similar toolkit there. Even though all this is purely theoretical, please bear in mind doing cryptography in the browser is tricky at best. Also, you will need to solve the storage of the client credentials (certificate and private key) on the client side too. This is not trivial!
In the registration scheme (the bold sentence), should I save the p
and q value in the server database?
Since all of this is for your thesis, you need to decide the scope. If safe storage of these two numbers is out of scope, you can declare a database as a safe enough storage and save them there. The other extreme is to use HSM.