chiark / gitweb /
profile.d/00base: Fix stupid typo.
[distorted-keys] / cryptop.public
old mode 100644 (file)
new mode 100755 (executable)
index a0054e9..4d57ee5
@@ -28,20 +28,37 @@ case "${KEYSLIB+t}" in t) ;; *) echo >&2 "$0: KEYSLIB unset"; exit 1 ;; esac
 . "$KEYSLIB"/keyfunc.sh
 
 defhelp <<HELP
-KEY
+[-x] KEY
 If the user KEY is asymmetric, write the public key to stdout.
+
+Options:
+  -x           Export the key in a form usable by \`pubkeyop'.
 HELP
 
+exportp=nil
+while getopts "x" opt; do
+  case $opt in
+    x) exportp=t ;;
+    *) usage_err ;;
+  esac
+done
+shift $(( $OPTIND - 1 ))
 case $# in 1) ;; *) usage_err ;; esac
 key=$1
 
 mktmp
-prepare "$key" info
-if [ -f $kdir/pub ]; then
-  cat $kdir/pub
-else
+prepare "$key" -
+if [ ! -f $kdir/pub ]; then
   echo >&2 "$quis: \`$key' has no public part"
   exit 1
 fi
+case $exportp in
+  t)
+    prepare "$key" info
+    dumpprops kprop_
+    echo ENDPROP
+    ;;
+esac
+cat $kdir/pub
 
 ###----- That's all, folks --------------------------------------------------