X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=src%2Fshare%2Fmh%2Fimport_key;h=1b6f267b1e15c5c7c8e5a46775533661efc29cb3;hb=9307f58b4fdf8e139c4fd5de5c3a878b8b12d0b1;hp=c545388f9aaedd0300d899acc5ded47d029e7533;hpb=ad2ac2649dd86299a6904ae8ad0849d2c3410bdb;p=monkeysphere.git diff --git a/src/share/mh/import_key b/src/share/mh/import_key index c545388..1b6f267 100644 --- a/src/share/mh/import_key +++ b/src/share/mh/import_key @@ -8,86 +8,54 @@ # Jamie McClelland # Daniel Kahn Gillmor # -# They are Copyright 2008-2009 and are all released under the GPL, +# They are Copyright 2008-2010 and are all released under the GPL, # version 3 or later. import_key() { -local sshKeyFile -local hostName -local domain -local userID - -sshKeyFile="$1" -hostName="$2" +local keyFile="$1" +local serviceName="$2" # check that key file specified -if [ -z "$sshKeyFile" ] ; then - failure "Must specify ssh key file to import, or specify '-' for stdin." +if [ -z "$keyFile" ] ; then + failure "Must specify PEM-encoded key file to import, or specify '-' for stdin." fi -# use the default hostname if not specified -if [ -z "$hostName" ] ; then - hostName=$(hostname -f) || failure "Could not determine hostname." - # test that the domain is not obviously illegitimate - domain=${foo##*.} - case $domain in - 'local'|'localdomain') - failure "Host domain '$domain' is not legitimate. Aborting key import." - ;; - esac - # test that there are at least two parts - if (( $(echo "$hostName" | tr . ' ' | wc -w) < 2 )) ; then - failure "Host name '$hostName' is not legitimate. Aborting key import." - fi +# fail if hostname not specified +if [ -z "$serviceName" ] ; then + failure "You must specify a service name for use in the OpenPGP certificate user ID." fi -userID="ssh://${hostName}" - -if [ "$PROMPT" = "true" ] ; then - cat <