33 lines
713 B
Bash
33 lines
713 B
Bash
#!/usr/bin/env bash
|
|
set -x
|
|
#apt install -y rng-tools gnupg2
|
|
|
|
sudo rngd -b -r /dev/urandom
|
|
|
|
export GNUPGHOME="$(mktemp -d)"
|
|
cat >keydetails <<EOF
|
|
%echo Generating a basic OpenPGP key
|
|
Key-Type: DSA
|
|
Key-Length: 1024
|
|
Subkey-Type: ELG-E
|
|
Subkey-Length: 1024
|
|
Name-Real: Joe Tester
|
|
Name-Comment: with stupid passphrase
|
|
Name-Email: joe@foo.bar
|
|
Expire-Date: 0
|
|
Passphrase: abc
|
|
# Do a commit here, so that we can later print "done" :-)
|
|
%commit
|
|
%echo done
|
|
EOF
|
|
|
|
gpg --batch --full-gen-key keydetails
|
|
|
|
gpg --list-secret-keys
|
|
|
|
echo -e "5\ny\n" | gpg --command-fd 0 --expert --edit-key joe@foo.bar trust;
|
|
|
|
gpg --list-keys
|
|
|
|
gpg -e -a -r joe@foo.bar keydetails
|