Asymmetric key cryptography
Asymmetric key cryptography is a widely used encryption technique in modern cryptography. It has a lot of applications other than encryption. It is also commonly used in several elements of blockchain, so we will cover this cryptography technique in depth, along with its primitives.
Symmetric key cryptography uses a shared key for both encryption and decryption. The biggest problem with this is that the shared key needs to be exchanged between participants over a secure channel, which can be quite hard to achieve. It also defeats the objective of encryption if we have a secure channel for communication in the first place. This is where asymmetric cryptography comes in. It uses a pair of keys called a public/private pair. The public key is constructed from the private key and can be freely broadcasted to other users.
Public-key algorithms enable the creation of a public key from a randomly generated private key. The created public key could not be used to infer the private key. In other words, the creation of the public key from the private key is a one-way process. This is the concept on which the security of public-key cryptography relies. The public-key algorithm not only performs encryption, but also provides authentication functionality.
The holder of the private key can use this key to authenticate to a system that is aware of the user's public key, as demonstrated in the following diagram:
As we can see in the diagram, there is no need for a secure channel to share the keys, unlike in symmetric cryptography. The encryption and decryption algorithms are identical, and the constructed key pairs play a vital role in the encryption/decryption process. As discussed earlier, asymmetric key algorithms can also be used to provide authentication. One application of this mechanism is digital signatures: only users with the private key could sign a message, and anyone possessing the public key could verify the authenticity of the message. Digital signatures could be used for non-repudiation as well. Blockchain applications, especially crypto currencies, make use of digital signatures to sign transactions using a private key to prove ownership. Thus, blockchain technology relies mainly on asymmetric cryptographic algorithms. Diffie-Hellman key exchange, DSA, ElGamal, RSA, and Elliptic-curve cryptography (ECC) are some of the approaches to asymmetric key cryptography.
The strength of a public-key cryptography system depends on how feasible it is to infer the private key from the publicly available information about the key. Although it is infeasible, it is not impossible, and security relies solely on the key size and key generation mechanism. Asymmetric keys are not widely used due to their complexity and the time it takes to encrypt/decrypt large files. They are commonly used in digital signatures or key exchange mechanisms rather than in encryption protocols.
All asymmetric key algorithms are based on a number theory problem that ensures the characteristics required for key generation and the encryption and decryption processes. Based on different ways of solving the mathematical problem in number theory, asymmetrical key generation is broadly characterized in three ways: prime factorization, discrete logarithm, and elliptic-curve. All public-private key algorithms are based on these mathematical problems. All these problems are similar in functionality to trapdoor functions.