Can GnuPG be used with a login system? I was thinking about creating a proof of concept for the following type of website login system.

Instead of passwords being used, on account creation, a public GnuPG key is uploaded to the server, and that serves as the main form of authentication for a users account. To login, the user would give their username. The login app would get the usernames public key, encrypt a random string with their public key, and the user would have to decrypt that downloaded file, and used the decrypted string as the password.

Does there seem to be any flaws in that system? If the user is able to keep their key secret, I don't see why this type of system wouldn't be feasible. 

What do you think?
Can GnuPG be used with a login system?


Yes, there are ways you could do that.

But…

While possible, there are two things that immediately pop into my mind: 


Public key crypto can be somewhat slow, which might or might not cause resource problems on the clients as well as on your server… depending on the number of users that simultaneously try to login, and how exactly you implement things.
Expecting users to decrypt a file to get a temporary login password (as you describe) doesn't seem to be very handy from a usability and UX point of view. Yet, that doesn't mean your idea would not be possible as a "proof of concept"… I just don't think it would be very practical. After all, you're putting a lot of burden on the client here (additional work of decryption, introducing additional steps since client first needs to download the encrypted password file, etc.) which – if you think about your idea twice – is rather unneccesary if you use a secured (read: HTTPS) connection. And you need to, otherwise, your Public-Key-Login-Adventure might be an easy target for MITM attacks. Sure, you can try to work around those too… but why invent a square wheel (your idea) if there is a good, secure, and working round wheel (SSL/TLS) available already.


I'ld say this boils down to a case of "just because you could, doesn't mean you should".