Table of Contents
shell command
gpg --batch --decrypt hello.asc 2> /dev/null
Silent GnuPG password request with bash commands https://unix.stackexchange.com/questions/212950/silent-gnupg-password-request-with-bash-commands/212953#212953 Git signed commits - How to suppress “You need a passphrase to unlock the secret key…” https://stackoverflow.com/questions/37763170/git-signed-commits-how-to-suppress-you-need-a-passphrase-to-unlock-the-secret
python3 gnupg
import gnupg def password(): gpg = gnupg.GPG() stream = open("/path/to/hello.asc", "rb") data = gpg.decrypt_file(stream) stream.close() return data
https://bitbucket.org/vinay.sajip/python-gnupg/src/master/
#pyenv shell 3.8.0 python3 -m venv gpg source gpg/bin/activate
pip install python-gnupg python import gnupg
hello.asc
建立一個檔案
touch your_password_file
在那一個檔案內 寫下你的密碼(在密碼後面必須保留一行空行 否則 gpg 會報錯)
gpg -e -a -r <user-id> your_password_file shred -xu ./your_password_file
留下 yourpasswordfile.asc
touch a.txt gpg -e -a -r ming a.txt shred -xu a.txt
gpg
gpg --full-gen-key gpg: invalid option "--full-gen-key" gpg --full-gen-key
gpg --gen-key <n>y = key expires in n years Key is valid for? (0) 2y GnuPG needs to construct a user ID to identify your key. Real name: ming Email address: ming@mail.com Passphrase qvLcZK5zYb2jJ9JFMNb75MEL
gpg-agent
eval $(gpg-agent --daemon) jupyter notebook --no-browser --ip='*'