. "$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 --------------------------------------------------