-
-
Save projectivemotion/16236138fd62db1eaa10b06019b359ea to your computer and use it in GitHub Desktop.
Producing printable QR codes for persistent storage of GPG private keys
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#1. export gpg private key as ascii | |
#2. split ascii into 4 qr code images | |
#3. generate bash script for importing bash images | |
#4. generate bash script for decrypting files. | |
gpg --export-secret-key --armor | split -C 1000 - IMG | |
for f in IMG*; do cat $f | qrencode -o $f.png; rm -vf $f; done | |
# Importing the QR codes: | |
# Note that, when making scans or photographs, you do not produce large images. | |
# If zbar does not recognise your QR code, try downscaling the image. | |
cat <<EOF >importmykey.sh | |
#!/bin/bash | |
touch mykey.asc | |
for f in IMG*.png; do zbarimg --raw \$f | head -c -1 ; done | gpg --pinentry-mode loopback --import | |
EOF | |
cat <<EOF >decryptmyfiles.sh | |
#!/bin/bash | |
gpg --pinentry-mode loopback --decrypt-files *.gpg | |
EOF | |
cat <<EOF >encryptmyfiles.sh | |
#!/bin/bash | |
gpg --pinentry-mode loopback --encrypt-files \$@ | |
EOF | |
chmod +x importmykey.sh decryptmyfiles.sh encryptmyfiles.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment