Initial commit
This commit is contained in:
commit
61dec59f3e
12
.editorconfig
Normal file
12
.editorconfig
Normal file
@ -0,0 +1,12 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
*~
|
||||
.DS_Store
|
||||
*.swp
|
||||
target
|
10
README
Normal file
10
README
Normal file
@ -0,0 +1,10 @@
|
||||
Two scripts to create qr codes from a private key and to restore them.
|
||||
|
||||
Use "create_codes" to create a pdf "qr.private.pdf" with arranged qrcodes (it
|
||||
takes the key id as an input).
|
||||
|
||||
When restoring, scan the qr codes in the order of their numbers, put the parts
|
||||
into numbered txt files and run the "restore_key" script with the first arg being
|
||||
the path to the public key and the second one the path to the directory with the
|
||||
txt files.
|
||||
|
23
bin/create_codes
Executable file
23
bin/create_codes
Executable file
@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
KEY=$1
|
||||
OUTPUT=${2:-qr.private.pdf}
|
||||
SINGLE_SIZE=${3:-1024}
|
||||
|
||||
gpg2 --export-secret-key "$KEY" | paperkey --output-type raw | base64 | split -b "$SINGLE_SIZE"
|
||||
|
||||
index=1
|
||||
for i in x*; do
|
||||
qrencode --8bit --level=M -o "qr.$index.png" < "$i"
|
||||
let index=index+1
|
||||
done
|
||||
|
||||
montage -title "private key for $KEY" -label "%t" -mode concatenate $(find . -name "qr.*.png" | sort -V) "$OUTPUT"
|
||||
|
||||
function finish {
|
||||
rm -f x*
|
||||
rm -f qr.*.png
|
||||
}
|
||||
|
||||
trap finish EXIT
|
7
bin/restore_key
Executable file
7
bin/restore_key
Executable file
@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env sh
|
||||
set -e
|
||||
|
||||
PUB_KEY=$1
|
||||
INPUT_DIR=${2:-.}
|
||||
|
||||
cat "$INPUT_DIR"/*.txt | base64 -D | paperkey --pubring "$PUB_KEY" --input-type raw --output private.key
|
Loading…
Reference in New Issue
Block a user