- Symetric encryption uses same key for encryption and decryption.
- Asymetric used key pair to encrypt and decrypt, i.e one key used to encrypt and another key used to decrypt; usually it is by public and private key.
Asymmetric encryption:
Step 1: Generate private key
Option 1:
openssl genrsa -out private.pem -des3 1024 # this would ask for a pass phrase=Option 2:
openssl genrsa -out private.pem 4096 ##this will not ask for pass phraseStep 2: Generate public key
openssl rsa -in private.pem -pubout -out public.pemStep 3: Encrypt text file
openssl rsautl -encrypt -inkey public.pem -pubin -in file.txt -out file.sslStep 4: Decrypt text file
openssl rsautl -decrypt -inkey private.pem -in file.sslSymmetric encryption:
To encrypt:
openssl aes-256-cbc -a -salt -k <key> -in <input_file> -out <output_file_name>To decrypt:
openssl aes-256-cbc -a -d -salt -k <key> -in <encrypted_file>Now some theory, i got it from google search,
Asymmetric is as follows:
Symmetric is as follows:
No comments:
Post a Comment