~mdw
/
distorted-keys
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
shamir.in: Declare subcommands with decorator.
[distorted-keys]
/
cryptop.public
diff --git
a/cryptop.public
b/cryptop.public
old mode 100644
(file)
new mode 100755
(executable)
index
a0054e9
..
4d57ee5
--- a/
cryptop.public
+++ b/
cryptop.public
@@
-28,20
+28,37
@@
case "${KEYSLIB+t}" in t) ;; *) echo >&2 "$0: KEYSLIB unset"; exit 1 ;; esac
. "$KEYSLIB"/keyfunc.sh
defhelp <<HELP
. "$KEYSLIB"/keyfunc.sh
defhelp <<HELP
-KEY
+
[-x]
KEY
If the user KEY is asymmetric, write the public key to stdout.
If the user KEY is asymmetric, write the public key to stdout.
+
+Options:
+ -x Export the key in a form usable by \`pubkeyop'.
HELP
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
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
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 --------------------------------------------------
###----- That's all, folks --------------------------------------------------