3 ### Key type for B. Poettering's `Seccure' suite
5 ### (c) 2011 Mark Wooding
8 ###----- Licensing notice ---------------------------------------------------
10 ### This file is part of the distorted.org.uk key management suite.
12 ### distorted-keys is free software; you can redistribute it and/or modify
13 ### it under the terms of the GNU General Public License as published by
14 ### the Free Software Foundation; either version 2 of the License, or
15 ### (at your option) any later version.
17 ### distorted-keys is distributed in the hope that it will be useful,
18 ### but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ### GNU General Public License for more details.
22 ### You should have received a copy of the GNU General Public License
23 ### along with distorted-keys; if not, write to the Free Software Foundation,
24 ### Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 ###--------------------------------------------------------------------------
27 ### Utility functions.
31 ## run_seccure OP ARG ...
33 ## Run a Seccure program, ensuring that its stderr is reported if it had
34 ## anything very interesting to say, but suppressed if it was boring.
36 set +e; seccure-$op "$@" 2>$tmp/seccure.out; rc=$?; set -e
37 grep -v '^WARNING: Cannot obtain memory lock' $tmp/seccure.out >&2 || :
41 ###--------------------------------------------------------------------------
42 ### Key type definition.
44 defprops k_props <<EOF
54 run_seccure key -q -c$kprop_curve -F"$nub"
60 k_public "$base" "$nub" >"$base/pub"
65 this=$(k_public "$base" "$nub")
66 orig=$(cat "$base/pub")
67 case "$orig" in "$this") return 0 ;; *) return 1 ;; esac
72 run_seccure encrypt -q -c$kprop_curve -m$kprop_tagsz -- $(cat "$base/pub")
77 if ! run_seccure decrypt -q -c$kprop_curve -m$kprop_tagsz -F"$nub"; then
78 echo >&2 "$quis: decryption failed"
85 run_seccure sign -q -c$kprop_curve -F"$nub" -s/dev/stdout
90 if run_seccure verify -q -c$kprop_curve -- \
91 $(cat "$base/pub") "$sig"
94 echo >&2 "$quis: signature verification failed"
99 ###----- That's all, folks --------------------------------------------------