Data is essential to everyone connecting across the Internet. Every information put on or through the Internet is at risk of being exposed. Conglomerates and individuals use certain measures to protect their data and secure it during transmission over the Internet. Techniques like TCP/IP, Data Encryption, Hashing, and Cryptography are used daily to protect quintillions of data transmitted over the Internet.
Cryptography protects the data being transmitted over the Internet by changing the data format so that an unauthorised user cannot access it. Symmetric and Asymmetric Cryptography are the two types of cryptography techniques. Symmetric Cryptography is one where only a single secret key is used to encrypt and decrypt the transferred data. Asymmetric Cryptography is one where there is a pair of keys, one is used to encrypt the data whilst the other one is used to decrypt it. The pair contains a public and private key.
Learn Software Development Courses online from the World’s top Universities. Earn Executive PG Programs, Advanced Certificate Programs or Masters Programs to fast-track your career.
Explore our Popular Software Engineering Courses
This article consists of the fundamentals of a public key in cryptography.
Definition of Cryptography in Data Security
Cryptography is the study of techniques used to transfer data over the internet by encryption and decryption to keep it safe from unauthorised users. Cryptography mainly uses algorithms in order to perform encryption and decryption such as Triple Data Encryption Standard(a.k.a 3DES – Symmetric cryptography) or Digital Signature Algorithm(a.ka.DSA – Asymmetric Cryptography).
The roots of cryptography go back to the times of the Roman General, Julius Caesar. The Caesar Cipher is one of the simplest techniques in Cryptography. Once performed on a plaintext(representing the unprotected data), the encryption process phase shifts the character by ‘n’, making it a ciphertext(representing the encrypted data) which can again be converted into a plaintext via phase shifting the ciphertext by ‘n’ during the decryption process.
Here is an example of Caesar Cipher:
Let ‘P’ represent the plaintext and ‘C’ represent the ciphertext.
P = HI EVERYONE
C = KL HYHUBRQH
Plaintext : A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Ciphertext: D E F G H I J K L M N O P Q R S T U V W X Y Z A B C
C = (P + 3) mod 26
P = (C – 3) mod 26
What does a ‘key’ stand for in Cryptography?
Similar to a physical key that is used in the real world to lock a door, a key in cryptography represents a set of characters that is used to lock(encrypt) data being transferred over the Internet. This same key can be used to unlock(decrypt) the data. Note that the same key is only used for decryption in the case of Symmetric Cryptography algorithms. In an Asymmetric Cryptography algorithm, a pair of keys is used for the encryption/decryption process – public key and private key. Both of these keys are related to each other mathematically.
How does Public Key Cryptography work?
To safeguard data from unwanted access or use, public-key cryptography utilises a pair of keys to encrypt and decode it. Certification authorities provide public and private key pairs to the users over a network. Other users can encrypt data by obtaining the intended receiver’s public key from a directory available to the public. This public key encryption technique is used before transmitting the message to the intended receiver. When the communication is delivered, the receiver decrypts it with a private key that no one else possesses.
Advantages of Public Key Cryptography over Symmetric Cryptography
Public Key Cryptography is still one of the safest ways to transfer data over the internet. Below are the advantages of Public Key Cryptography over Symmetric Cryptography:
- The fundamental benefit of public-key encryption is enhanced security: private keys are never sent or exposed to anybody.
- It can generate digital signatures that cannot be revoked so that no party can deny the information received by them. This is known as non-repudiation that prevents the party from altering the data being transferred to them.
Most used Algorithm in Public Key Cryptography
The most widely used public-key cryptography algorithm is RSA, standing for the names of its inventors, Ron Rivest – Adi Shamir – Leonard Adleman. Though with the increased security provided with the extra bits in the RSA – 4096, it is relatively slower than RSA – 2048, so companies choose to opt for the latter.
Let us generate our own key pairs with the help of our command-line shell having OpenSSL.
Command-line codes:
$openssl genrsa -out private.pem 2048
// This will generate a pair of keys and will be a 2048-bit RSA key pair
$ openssl rsa -in private.pem -pubout -out public.pem
// For a given private key the code above will derive the public key into ‘public.pem’
// This private and public key pair can now be used to encrypt a file with the RSA-2048 algorithm
Read our Popular Articles related to Software Development
Why Learn to Code? How Learn to Code? | How to Install Specific Version of NPM Package? | Types of Inheritance in C++ What Should You Know? |
Conclusion
The classic encryption approach is based on a single secret key cryptography(Symmetric Cryptography). However, because a single secret key encrypts and decrypts the data, it leaves transmitted communications open to third-party eavesdropping. To solve the limitations of the classic method, the public key cryptography system was created. In public-key cryptography, the sender encrypts the communication with public-key encryption, and the recipient decrypts it using a private key that is only known to the recipient. The public key in cryptography enables the sharing of information without any third party having access to it.
Become a Cyber Security Professional by enrolling in upGrad’s Cyber Security Program
Are you searching for the optimal programme to accelerate your learning in the domain of Cyber Security? upGrad brings you its Advanced Certificate Programme in Cyber Security in collaboration with the Indian Institute of Information Technology Bangalore.
This course includes:
- 250+ learning hours covering Cyber Security in network security, application security, cryptography and data secrecy.
- Certificate of an Advanced Program from IIIT Bangalore and upGrad
- A profile builder powered by AI
- One-on-one mentorship for your career
- One-on-one coaching
- Alumni status from IIIT Bangalore
- A portal for exclusive job openings
- Help with interview preparation