Public-key cryptography uses two keys: a public key that can encrypt messages and verify signatures, and a private key known only to the recipient that decrypts messages and signs them. RSA is an example of an asymmetric encryption algorithm that is widely used, using a public and private key pair generated from large prime numbers. It allows easy encryption with the public key but mathematically secure decryption only with the corresponding private key.