1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
#!/usr/bin/env bash
###
### arching-kaos-tools
### Tools to interact and build an Arching Kaos Infochain
### Copyright (C) 2021 - 2025 kaotisk
###
### This program is free software: you can redistribute it and/or modify
### it under the terms of the GNU General Public License as published by
### the Free Software Foundation, either version 3 of the License, or
### (at your option) any later version.
###
### This program is distributed in the hope that it will be useful,
### but WITHOUT ANY WARRANTY; without even the implied warranty of
### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
### GNU General Public License for more details.
###
### You should have received a copy of the GNU General Public License
### along with this program. If not, see <http://www.gnu.org/licenses/>.
###
##
## It is a minimal wrapper aroung lib/_ak_gpg.
##
## Usage:
##
## -h, --help Prints this help message
## --get-key-self-as-ipfs Returns your key as an IPFS hash
## --get-key-self-as-fingerprint Returns the fingerprint of your key
## --get-key-fingerprint-from-ipfs Returns the fingerprint of a given key
## --export-key-self-to-file Exports self public key as 'self.pub'
## --clear-sign <file> <output> Sign a file clearly
## --verify-file <file> Verify a clear signed file
## -l, --list-keys Returns a list of known GPG keys
## -lp, --list-keys-plain Returns a list of known GPG keys as
## plain GPG output
## -ll, --list-keys-long Returns a list of known GPG keys with
## their 1st uid
## -ls, --list-secret-keys Returns a list of secret GPG keys
## -lsp, --list-secret-keys-plain Returns a list of secret GPG keys as
## plain GPG output
## -lsl, --list-secret-keys-long Returns a list of secret GPG keys with
## their 1st uid
## -c, --create-key <email> Creates a GPG key with a label <email>
## -s, --select-key Selects the GPG key you want to use
## -d, --delete-key Delete GPG keys from your keyring
## -ds, --delete-secret-key <fingerprint>
## Delete GPG keys from your keyring
##
fullprogrampath="$(realpath $0)"
PROGRAM=$(basename $0)
descriptionString="GPG cli tool"
# At least these
source $AK_LIBDIR/_ak_log
source $AK_LIBDIR/_ak_script
source $AK_LIBDIR/_ak_gpg
# Flags to run
if [ ! -z $1 ]; then
case $1 in
-h | --help) _ak_usage; exit;;
--example) example; exit;;
--get-key-self-as-ipfs) _ak_gpg_key_self_get_fingerprint_from_config; exit;;
--get-key-self-as-fingerprint) _ak_gpg_key_self_get_fingerprint; exit;;
--get-key-fingerprint-from-ipfs) _ak_gpg_key_get_fingerprint_from_ipfs $1; exit;;
--export-key-self-to-file) _ak_gpg_key_self_export 'self.pub'; exit;;
--clear-sign) shift; _ak_gpg_sign_clear "$2" "$1"; exit;;
--verify-file) shift; _ak_gpg_verify_clear_signature "$1"; exit;;
--list-keys | -l) _ak_gpg_list_keys; exit;;
--list-keys-long | -ll) _ak_gpg_list_keys_long; exit;;
--list-keys-plain | -lp) _ak_gpg_list_keys_plain; exit;;
--list-secret-keys | -ls) _ak_gpg_list_secret_keys; exit;;
--list-secret-keys-long | -lsl) _ak_gpg_list_secret_keys_long; exit;;
--list-secret-keys-plain | -lsp) _ak_gpg_list_secret_keys_plain; exit;;
--create-key | -c) shift; _ak_gpg_create_key $1; exit;;
--select-key | -s) _ak_gpg_select_key; exit;;
--delete-key | -d) _ak_gpg_delete_key; exit;;
--delete-secret-key | -ds) shift; _ak_gpg_delete_secret_key $1; exit;;
* ) _ak_usage;;
esac
else _ak_usage
fi
|