2 # This should be sourced by bash (though we welcome changes to make it POSIX sh compliant)
4 # Monkeysphere host gen-key subcommand
6 # The monkeysphere scripts are written by:
7 # Jameson Rollins <jrollins@finestructure.net>
8 # Jamie McClelland <jm@mayfirst.org>
9 # Daniel Kahn Gillmor <dkg@fifthhorseman.net>
11 # They are Copyright 2008-2009, and are all released under the GPL,
16 local hostName=$(hostname -f)
18 local keyLength="2048"
31 if [ "$(echo "$1" | cut -c 1)" = '-' ] ; then
32 failure "Unknown option '$1'.
33 Type '$PGRM help' for usage."
41 userID="ssh://${hostName}"
44 mkdir -p "$GNUPGHOME_HOST"
45 chmod 700 "$GNUPGHOME_HOST"
47 log debug "generating host key..."
48 gpg_host --batch --gen-key <<EOF
50 Key-Length: $keyLength
53 Expire-Date: $keyExpire
60 # load the new host fpr into the fpr variable
61 load_fingerprint_secret
63 # export to ssh secret key file
66 # export to ssh public key file
69 # export to gpg public key to file
72 # show info about new key