在Ubuntu下,使用OpenSSL解密數據需要遵循以下步驟:
打開終端(Terminal)。
確保已經安裝了OpenSSL。如果沒有,請運行以下命令來安裝:
sudo apt-get update
sudo apt-get install openssl
對于PEM格式的文件,使用以下命令:
openssl enc -d -base64 -in encrypted_file.pem -out decrypted_file.txt -pass pass:your_password
其中,encrypted_file.pem
是加密文件的路徑,decrypted_file.txt
是解密后文件的輸出路徑,your_password
是用于解密的密碼。
對于DER格式的文件,使用以下命令:
openssl enc -d -base64 -in encrypted_file.der -out decrypted_file.txt -pass pass:your_password -outform DER
其中,encrypted_file.der
是加密文件的路徑,decrypted_file.txt
是解密后文件的輸出路徑,your_password
是用于解密的密碼。
注意:請確保你有正確的加密文件和密碼。如果密碼錯誤,解密過程將失敗。