From fff6c65302469302612a246bbc02f453827f4b99 Mon Sep 17 00:00:00 2001 Message-Id: From: Mark Wooding Date: Wed, 15 Feb 2012 00:48:18 +0000 Subject: [PATCH] New ktype operation `k_import'. Organization: Straylight/Edgeware From: Mark Wooding Given a directory containing `pub', populate it with anything else necessary. This is trivial for `seccure'; `gnupg' requires a refactoring of key generation, to split out the directory setup stuff. --- keyfunc.sh.in | 1 + ktype.gnupg | 21 ++++++++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/keyfunc.sh.in b/keyfunc.sh.in index 952a095..dda8a2e 100644 --- a/keyfunc.sh.in +++ b/keyfunc.sh.in @@ -461,6 +461,7 @@ c_verify () { k_verify "$@"; } ## Stub implementations. notsupp () { op=$1; echo >&2 "$quis: operation \`$op' not supported"; } k_info () { :; } +k_import () { :; } k_encrypt () { notsupp encrypt; } k_decrypt () { notsupp decrypt; } k_sign () { notsupp sign; } diff --git a/ktype.gnupg b/ktype.gnupg index 8a8e764..18a17a9 100644 --- a/ktype.gnupg +++ b/ktype.gnupg @@ -56,10 +56,9 @@ EOF : ${kprop_realname=%{realname\}} ${kprop_email=%{email\}} : ${kprop_comment=%{comment-nil\}} -k_generate () { - base=$1 nub=$2 +initdir () { + base=$1 - makenub >"$nub" prefs="$kprop_cipher_prefs $kprop_digest_prefs $kprop_compress_prefs" case ${kprop_s2k_cipher+t} in @@ -87,6 +86,13 @@ personal-digest-preferences $kprop_digest_prefs personal-compress-preferences $kprop_compress_prefs default-preference-list $prefs EOF +} + +k_generate () { + base=$1 nub=$2 + + makenub >"$nub" + initdir "$base" { cat <"$base/fpr" +} + k_encrypt () { base=$1 run_gnupg "$base" --encrypt --armor --recipient=$(cat "$base/fpr") -- [mdw]