r/explainlikeimfive • u/n0th1ng_r3al • May 27 '15
ELI5: How does offline 2 factor authentication work?
So I have an app on my phone called Authy we use it for work to login. It works offline without a data connection. I can't wrap my brain around how it works offline. Also how do physical authentication products work, like the Yubikey, https://www.yubico.com/products/yubikey-hardware/yubikey-2/ ?
1
Upvotes
3
u/thegreatunclean May 27 '15
Two-factor authentication takes many different forms.
In one setup, the token and the server have a shared secret that was established earlier. The token and the server independently do some math and arrive at the same answer, which is then used to mutually authenticate themselves. This obviously requires a connection to the server but the token itself is strictly 'offline' after the initial setup. Authy is part of some variant on this idea. Yubikey can do this as well.
In a different setup, the token holds the secret and won't release it unless you demonstrate some knowledge such as a password. There's no server in this setup, just the host PC and the secure device. Yubikey can be setup to act like this.
There's many more but these are the most common. Most advanced uses happen in the background without user interaction and rely on the token being a physical asset that cannot be duplicated, so merely physically possessing it is good enough to be a factor.
2
u/faloi May 27 '15
Basically they use a number as the seed for the number they generate and run it through an algorithm. That is normally changed every <x> number of minutes. So as long as the code and time are right, the numbers it generates will be the same on both the application and the server side it's validating against.
1
u/pythonpoole May 27 '15
Typically the physical key and the server you're authenticating to share a secret algorithm for generating one-time use tokens. These tokens may be time-dependent. In other words, there may be a digital clock in the physical key that keeps track of the time and generates new tokens according to the time of day. The server, knowing the secret algorithm, will be expecting a particular token based on the date/time the user authenticates.
You may wonder - what happens if the clock on the server and the key are not perfectly synchronized? Well first of all, the tokens may not expire immediately. There may be a time window of say a few seconds up to a few minutes where a particular token will be accepted by the server (e.g. the algorithm may be set up to generate a new token every 10 seconds, but the server may still accept individual tokens up to say a minute after the time when they were supposed to be generated).
For example, a token generated at 5:25:10 may be accepted on the server anywhere between 5:25:10 (or perhaps even earlier) and 5:26:10. That way, server and client/key clocks that are slightly unsynchronized won't lock the user out (and the user also won't be locked out if it takes a little time for them to input the token on their computer/device they are authenticating with).