easy Encrypt
Berikut Saya share beberapa contoh enkripsi yang bisa digunakan dengan mudah dengan menggunakan openssl linux
1. enkripsi -base64,
encrypt
# echo "yudikeren" | openssl enc -base64
eXVkaWtlcmVuCg==
decrypt
# ecbo eXVkaWtlcmVuCg== | openssl enc -base64 -d
yudikeren
2. enkripsi aes-256-cbc enkripsi
# echo "yudikeren" |openssl enc -aes-256-cbc -a
enter aes-256-cbc encryption password: Verifying - enter aes-256-cbc encryption password:
U2FsdGVkX18ZUWHs/tRKBMr3LwBicznDn5IPqLha31E=
decrypt
# echo "U2FsdGVkX18ZUWHs/tRKBMr3LwBicznDn5IPqLha31E=" ;
| openssl enc -aes-256-cbc -d -a
enter aes-256-cbc decryption password:
yudikeren
3. enkripsi with key
PRIVATE key
# openssl genrsa -out private_kunci_key.pem 2084 Generating RSA private key, 2084 bit long modulus ...................................+++ ...........................................+++ e is 65537 (0x10001)
PUBLIC key
# openssl rsa -in private_kunci_key.pem -out public_kunci_key.pem ;
-outform PEM -pubout
writing RSA key
[root@mx1 pass]# ls
private_kunci_key.pem public_kunci_key.pem
Buat File :
# echo "yudikeren" > fileaslinya.txt
# openssl rsautl -encrypt -inkey public_kunci_key.pem -pubin -in ; fileaslinya.txt -out filesudahencrypt.dat
hasilnya :
# ls
private_kunci_key.pem public_kunci_key.pem
fileaslinya.txt filesudahencrypt.dat
untuk decrypt
# openssl rsautl -decrypt -inkey private_key.pem -in filesudahencrypt.datyudikeren###klo mau di masukkan ke dalam file scriptnya menjadi# openssl rsautl -decrypt -inkey private_key.pem -in filesudahencrypt.dat;
-out yudikeren.txt
Comments
Post a Comment