Public key cryptography uses a pair of keys - a public key for encryption and a private key for decryption. The keys are generated as follows: 1) Choose two prime numbers and multiply them to get n 2) Calculate φ(n) as (p-1)(q-1) 3) Choose a public key k that is relatively prime to φ(n) 4) Calculate the private key j using k*j=1 (mod φ(n)) To encrypt a message P, compute E=P^k (mod n). To decrypt, compute P=E^j (mod n).