Asymmetric cryptography, commonly referred to also as public-key cryptography, uses two keys: private and public one. These keys are "simply" large, non-identical primes that have been paired together. As implied by the name, the private key is known only to its owner, the public key is available to everyone. A message encrypted with a private key can only be decrypted using the public key, and vice versa.
The main properties of asymmetric cryptography are:
- Confidentiality: Information is only accessible by allowed parties.
- Integrity: Information cannot be modified without at least one of the legitimate parties knowing.
- Authentication: Proving that a person is who they claim to be.
- Non-repudiation: Inability to deny that an action has been carried out by a person.
Disadvantages of asymmetric compared to symmetric cryptography are non-fixed overhead when encrypting and significantly lower speed (orders of magnitude). The main advantage is circumventing the need to exchange the key(s).
The most widely used asymmetric cipher is RSA, embedded in SSL/TLS. It relies on the difficulty of factoring (determining the original factors of) large integers that are themselves products of two (very) large prime numbers. These days, the minimum recommended key length is 2048 bits as it is believed that 1024 bit keys might be feasibly breakable in the near future.
Digital signatures are formed by creating a hash of a message (any data) and then using a private key to encrypt this hash. The result is then appended to the message and together with other information (such as used hashing algorithm), forms the digital signature.
Since changing even a single bit of the message changes the hash, this enables the other side to verify the integrity of the message. If, after decrypting the hash using the public key, it matches the hash of the message computed independently using an equivalent hashing algorithm, this proves authenticity and guarantees non-repudiation.