Merge pull request #47 from PierreGode/PierreGode-patch-1

Update security
This commit is contained in:
PierreGode 2024-08-29 12:39:25 +02:00 committed by GitHub
commit 496908f80f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2482,26 +2482,27 @@ exit
} }
################################## encrypt pwd ############################### ################################## encrypt pwd ###############################
encrypt(){ encrypt(){
echo "This will create 3 files public key, private key and encrypted file" echo "This will create 3 files: public key, private key, and encrypted file."
echo "make sure to store private file" echo "Make sure to store the private key file securely."
sudo openssl genrsa -out private_key.pem 2048 sudo openssl genrsa -out private_key.pem 2048
sudo openssl rsa -in private_key.pem -out public_key.pem -outform PEM -pubout sudo openssl rsa -in private_key.pem -out public_key.pem -outform PEM -pubout
echo "Please type password to encrypt"
stty -echo echo "Please type the password to encrypt:"
read pass stty -echo
echo "$pass" > encryptpwd.txt read pass
stty echo stty echo
if [ -z "$pass" ] if [ -z "$pass" ]; then
then echo "Password is empty"
echo "passwd is empty" exit 1
exit else
else echo -n "$pass" | sudo openssl pkeyutl -encrypt -inkey public_key.pem -pubin -out encrypted.dat
sudo openssl pkeyutl -encrypt -inkey public_key.pem -pubin -in encryptpwd.txt -out encrypted.dat pass=""
sudo rm -rf encryptpwd.txt echo "Encryption complete. Files created:"
ls ls
fi fi
exit exit
} }
################################## info ################################## ################################## info ##################################
readmes(){ readmes(){
clear clear