# Why is there only one keypair in FrodoKEM?

use pqcrypto_frodo::frodokem1344aes::*;
let (pk, sk) = keypair();
let (ss1, ct) = encapsulate(&pk);
let ss2 = decapsulate(&ct, &sk);
assert!(ss1 == ss2);


In the above code, only one keypair is generated. The public key is then used to 'encapsulate', which returns a ciphertext and a shared secret. I'm going to assume that the shared secret is used to do symmetric encryption with AES or something.

Since there is only one keypair, doesn't that mean anyone can compute the shared secret with the public key?

No, because the secret ss1 is randomly chosen each time from a space large enough that there will never be a collision.