I am planning on designing a system that needs a password to be operated, using a rolling key.
Now I am facing two options, as far as I am concerned:
- Having an index saved, which will be incremented on each iteration, send to e.g. my phone, encrypted via a private key, send back to the secured system, decrypted via the public key, compared to the actual index
- Having a set of pre-generated keys on both systems, each time sending a new key of that set.
Although the first solution would be more memory-efficient in my eyes (talking about a uC), i have a fear that using the same keypair with a numerically increasing predictable index would give quite some attack surface to crack the key.
- Is there an asymmetrical encryption algorithm I could use like that?
- Or is there an approach I didn't consider at all?