diff options
Diffstat (limited to 'lib/_ak_gpg')
| -rwxr-xr-x | lib/_ak_gpg | 53 |
1 files changed, 44 insertions, 9 deletions
diff --git a/lib/_ak_gpg b/lib/_ak_gpg index bdb8829..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,10 +134,19 @@ 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 - _ak_gpg --sign-with $AK_FINGERPRINT --encypt -r $3 --armor --output $1 $2 + _ak_gpg --sign-with $AK_FINGERPRINT --encrypt -r $3 --armor --output $1 $2 else exit 1 fi @@ -145,7 +155,7 @@ function _ak_gpg_encrypt_sign(){ function _ak_gpg_encrypt_sign_for_self(){ if [ ! -z $1 ] && [ -n "$1" ] && [ ! -z $2 ] && [ -n "$2" ] then - _ak_gpg --sign-with $AK_FINGERPRINT --encypt -r $AK_FINGERPRINT --armor --output $1 $2 + _ak_gpg --sign-with $AK_FINGERPRINT --encrypt -r $AK_FINGERPRINT --armor --output $1 $2 else exit 1 fi @@ -154,7 +164,7 @@ function _ak_gpg_encrypt_sign_for_self(){ function _ak_gpg_encrypt(){ if [ ! -z $1 ] && [ -n "$1" ] && [ ! -z $2 ] && [ -n "$2" ] && [ ! -z $3 ] && [ -n "$3" ] then - _ak_gpg --encypt -r $3 --armor --output $1 $2 + _ak_gpg --encrypt -r $3 --armor --output $1 $2 else exit 1 fi @@ -163,7 +173,7 @@ function _ak_gpg_encrypt(){ function _ak_gpg_encrypt_for_self(){ if [ ! -z $1 ] && [ -n "$1" ] && [ ! -z $2 ] && [ -n "$2" ] then - _ak_gpg --encypt -r $AK_FINGERPRINT --armor --output $1 $2 + _ak_gpg --encrypt -r $AK_FINGERPRINT --armor --output $1 $2 else exit 1 fi @@ -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 @@ -299,3 +332,5 @@ function _ak_gpg_delete_secret_key(){ fi fi } + +_ak_log_debug "_ak_gpg loaded $(caller)" |
