[Webfunds-commits] scripts ricardian_keys

Ian Grigg iang@cypherpunks.ai
Mon, 4 Sep 2000 08:10:11 -0400 (AST)


iang        00/09/04 08:10:11

  Modified:    .        ricardian_keys
  Log:
  more mods

Revision  Changes    Path
1.2       +55 -35    scripts/ricardian_keys

Index: ricardian_keys
===================================================================
RCS file: /home/webfunds/cvsroot/scripts/ricardian_keys,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ricardian_keys	2000/08/23 16:47:15	1.1
+++ ricardian_keys	2000/09/04 12:10:11	1.2
@@ -1,7 +1,13 @@
 
 usage ()
 {
-    echo "Usage: ${0##*/} { --server | --cert | --contract | --operator } \\"
+    if [ -n "$1" ]
+    then
+        echo $*
+        echo
+    fi
+
+    echo "Usage: ${0##*/} { --server | --certification | --contract | --operator } \\"
     echo "                [--pass phrase] [--sign] \\" 
     echo "                [--id Id] [--email email] [--comment comment]" 
     exit 1
@@ -14,7 +20,7 @@
 server=false
 operator=false
 contract=false
-cert=false
+certification=false
 gid=$(id -g)
 uid=$(id -u)
 pw=":$uid:$gid:"
@@ -22,6 +28,7 @@
 email="${USER}@$(hostname)"
 
 comment="# Name-Comment: (ignored)"
+sign=false
 
 
 while true
@@ -29,7 +36,7 @@
     case "$1" in
         "--server")          server=true ;;
         "--operator")        operator=true ;;
-        "--cert")            cert=true ;;
+        "--certification")   certification=true ;;
         "--contract")        contract=true ;;
 
         "--sign")            sign=true ;;
@@ -45,7 +52,7 @@
     shift
 done
 
-$contract || $server || $cert || $operator || usage
+$contract || $server || $certification || $operator || usage "need purpose"
 
 if [ -z "$pass" ]
 then
@@ -84,49 +91,62 @@
 
 }
 
+
+sign ()
+{
+    if $sign
+    then
+        :
+    else
+        echo "To sign, do this:"
+        echo "      gpg --import $signee.pub"
+        echo "      gpg --sign-key -u '[$signer]' '[$signee]'"
+        echo "      gpg -a  --export '[$signee]' > $signee.pub"
+
+        return
+    fi
+
+    signer=$1
+    signee=$2
+
+    echo "signing is not recommended on your real keyring, Continue?"
+    read answer
+    case "$answer" in
+        [yY]*)    ;;
+        *)        exit 1 ;;
+    esac
+
+    gpg --import $signee.pub
+    gpg --sign-key -u "[$signer]" "[$signee]"
+    gpg -a  --export "[$signee]" > $signee.pub
+    gpg -v < $signee.pub
+    # gpg --yes --delete-secret-key $signer
+    gpg --yes --delete-key "[$signee]"
+    # gpg --yes --delete-key $signer
+
+}
+
 if $server
 then
-    top="operator"
-    work="server"
-
     makeit "server"
+    sign "operator" "server"
+
 elif $operator
 then
-    top="operator"
-    work="server"
-
     makeit "operator"
-elif $cert
+
+elif $certification
 then
-    top="cert"
-    work="contract"
+    makeit "certification"
 
-    makeit "cert"
 elif $contract
-    top="cert"
-    work="contract"
-
+then
     makeit "contract"
+    sign "certification" "contract"
+
 else
+
     echo "No key type specified?"
     usage
 fi
 
-
-if $sign
-then
-    echo "signing is not recommended on your real keyring, Continue?"
-    read answer
-    case "$answer" in
-        [yY]*)    ;;
-        *)        exit 1 ;;
-    esac
-
-    gpg --import $work.pub
-    gpg --sign-key -u "[$top]" "[$work]"
-    gpg -a  --export "[$work]" > $work.pub
-    gpg -v < $work.pub
-    # gpg --yes --delete-secret-key $top
-    gpg --yes --delete-key "[$work]"
-    # gpg --yes --delete-key $top
-fi