Update security

Update security
This commit is contained in:
PierreGode 2024-08-29 12:38:49 +02:00 committed by GitHub
parent b7e9f086ba
commit 2c2e8bf69e
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"
echo "Please type the password to encrypt:"
stty -echo stty -echo
read pass read pass
echo "$pass" > encryptpwd.txt
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
sudo openssl pkeyutl -encrypt -inkey public_key.pem -pubin -in encryptpwd.txt -out encrypted.dat echo -n "$pass" | sudo openssl pkeyutl -encrypt -inkey public_key.pem -pubin -out encrypted.dat
sudo rm -rf encryptpwd.txt pass=""
echo "Encryption complete. Files created:"
ls ls
fi fi
exit exit
} }
################################## info ################################## ################################## info ##################################
readmes(){ readmes(){
clear clear