For both encryption and digital signatures, each user of the system generates a pair of keys: a public key and a private key. The public and private keys are mathematically related, but (as far as we know) it is computationally infeasible to derive the private key from the public key. Briefly, public/private key encryption and digital signatures work as follows:
- If Alice wants to encrypt a short message to Bob, Alice uses Bob's public key to encrypt the message, and then Bob uses his private key to decrypt the message.
- If Alice wants to digitally sign a short message, Alice uses her private key to produce a signature, and then anyone who knows Alice's public key can verify that the signature could only be produced by someone who knows Alice's private key.