Basic Encryption/Decryption strategy:
The aim of encrypting/decrypting data is to make sure the data sent by sender can be understood by the intended recipient only.
if person A is sending a message to person B, another person C eavesdropping to the message should not be able to read it.
So, sender (A) encrypts the data using an encryption key and the encrypted data (cypher) is then decrypted by the receiver (Bob) using a decryption key.
This is achieved using 2 approaches:
1) Symmetric Encryption
2) Asymmetric Encryption
In Symmetric Encryption, the sender and the receiver use the same key to encrypt and decrypt data.
The key is called secret key.
The advantage of this approach is that its relatively faster.
The disadvantage is the problems in key distribution among the sender/distribution.
Asymmetric Encryption uses key pair: a private key and a public key.
The key generator should keep the private key and share the public key to the recipients.
If messages are encrypted by public key, they can be decrypted by private key and vice versa.
This solves the key distribution problem.
The disadvantage with this approach is it’s considerably slower than the symmetric encryption/decryption.
© 2015 – 2016, www.topjavatutorial.com. All rights reserved. On republishing this post, you must provide link to original post