Mint 21.1 Guide
Generating the private key:
openssl genrsa -out privateKey.pem
Extracting the public key:
openssl rsa -in privateKey.pem -out publicKey.pem -outform PEM -pubout
Encrypting the txt file:
openssl pkeyutl -encrypt -pubin -inkey "publicKey.pem" -in "fileToEncrypt.txt" -out "encryptedFile.txt"
Decrypting the file:
openssl pkeyutl -decrypt -inkey "privateKey.pem" -in "encryptedFile.txt" -out "decryptedFile.txt"
EXTRA:
Signing the file:
openssl pkeyutl -sign -inkey "privateKey.pem" -in "fileToSign.txt" - out "signatureFile.sign"
Veryfing the signature:
openssl pkeyutl .verify -pubin -inkey "publicKey.pem" - in "fileToCheck.txt" -sigfile "signatureFile.sign"