diff options
Diffstat (limited to 'lib/_ak_gpg')
| -rwxr-xr-x | lib/_ak_gpg | 43 |
1 files changed, 38 insertions, 5 deletions
diff --git a/lib/_ak_gpg b/lib/_ak_gpg index edfc1d7..8f014f8 100755 --- a/lib/_ak_gpg +++ b/lib/_ak_gpg @@ -17,10 +17,11 @@ ### You should have received a copy of the GNU General Public License ### along with this program. If not, see <http://www.gnu.org/licenses/>. ### -source $AK_LIBDIR/_ak_log -source $AK_LIBDIR/_ak_ipfs -source $AK_LIBDIR/_ak_config -source $AK_LIBDIR/_ak_settings +source $AK_LIBDIR/_ak_lib_load +_ak_lib_load _ak_log +_ak_lib_load _ak_ipfs +_ak_lib_load _ak_config +_ak_lib_load _ak_settings export AK_FINGERPRINT="$(_ak_settings_get gpg.fingerprint)" @@ -133,6 +134,15 @@ function _ak_gpg_sign_clear(){ fi } +function _ak_gpg_sign_clear_with_key(){ + if [ ! -z $1 ] && [ -n "$1" ] && [ ! -z $2 ] && [ -n "$2" ] && [ ! -z $3 ] && [ -n "$3" ] + then + _ak_gpg --clear-sign --sign-with $3 --armor --output $1 $2 + else + exit 1 + fi +} + function _ak_gpg_encrypt_sign(){ if [ ! -z $1 ] && [ -n "$1" ] && [ ! -z $2 ] && [ -n "$2" ] && [ ! -z $3 ] && [ -n "$3" ] then @@ -196,10 +206,19 @@ function _ak_gpg_verify_signature(){ fi } +function _ak_gpg_key_export(){ + if [ ! -z $1 ] && [ -n "$1" ] && [ ! -z $2 ] && [ -n "$2" ] + then + _ak_gpg --armour --output $2 --export $1 + else + exit 1 + fi +} + function _ak_gpg_key_self_export(){ if [ ! -z $1 ] && [ -n "$1" ] then - _ak_gpg --armour --output $1 --export $AK_FINGERPRINT + _ak_gpg_key_export $AK_FINGERPRINT $1 else exit 1 fi @@ -243,6 +262,20 @@ function _ak_gpg_list_secret_keys_long(){ uniq } +function _ak_gpg_select_key_to_export(){ + select x in $(_ak_gpg_list_secret_keys | tr '\n' ' ') + do + if [ -n "$x" ] + then + _ak_log_info "$x was selected" + _ak_gpg_key_export "$x" "$x.asc" + break + else + _ak_log_warning "You didn't select a key" + fi + done +} + function _ak_gpg_select_key(){ select x in $(_ak_gpg_list_secret_keys | tr '\n' ' ') do |
