added notes about what version needs what keyType
[monkeysphere.git] / src / share / m / gen_subkey
index a0fa3ce77228b5f6b7efc876ccf3a22098a2d38c..9cc6028325a3621ec019b3d242bd53269e6b0573 100644 (file)
@@ -19,6 +19,7 @@ gen_subkey(){
     local keyID
     local editCommands
     local fifoDir
+    local keyType
 
     # get options
     while true ; do
@@ -44,8 +45,13 @@ Type '$PGRM help' for usage."
     check_gpg_authentication_subkey "$keyID"
 
     # generate the list of commands that will be passed to edit-key
+    # 7 for < 1.4.10
+    # 8 for >= 1.4.10
+    # 7 for < 2.0.13
+    # 8 for >= 2.0.13
+    keyType=8
     editCommands="addkey
-7
+$keyType
 S
 E
 A
@@ -57,14 +63,16 @@ save"
     # setup the temp fifo dir for retrieving the key password
     log debug "creating password fifo..."
     fifoDir=$(msmktempdir)
-    trap "rm -rf $fifoDir" EXIT
     (umask 077 && mkfifo "$fifoDir/pass")
 
-    log verbose "generating subkey..."
+    # FIXME: are we adequately cleaning up any trailing gpg process here?
+    trap "rm -rf $fifoDir; kill %% || true" EXIT
     echo "$editCommands" | gpg_user --passphrase-fd 3 3< "$fifoDir/pass" --expert --command-fd 0 --edit-key "$keyID" &
 
+    log debug "Prompting for passphrase"
     # FIXME: this needs to fail more gracefully if the passphrase is incorrect
     passphrase_prompt  "Please enter your passphrase for $keyID: " "$fifoDir/pass"
+    log info "Generating subkey.  This may take a long time..."
 
     trap - EXIT
     rm -rf "$fifoDir"