File: pgpkeys

package info (click to toggle)
surfraw 2.3.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 1,624 kB
  • sloc: sh: 7,977; perl: 824; makefile: 277
file content (91 lines) | stat: -rwxr-xr-x 2,631 bytes parent folder | download | duplicates (5)
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
84
85
86
87
88
89
90
91
#!/bin/sh
# elvis: pgpkeys		-- Search the PGP key database
# Author: Moritz Muehlenhoff <jmm@informatik.uni-bremen.de>
. surfraw || exit 1

w3_config_hook () {
def   SURFRAW_pgpkeys_sigs		off
defyn SURFRAW_pgpkeys_fingerprints	off
defyn SURFRAW_pgpkeys_exact		off
def   SURFRAW_pgpkeys_server		sks
}

w3_usage_hook () {
    cat <<EOF
Usage: $w3_argv0 [options] [search-string]
Description:
  Search the PGP key database
Local options:
  -s                            Displays signatures of the keys
				Default: $SURFRAW_pgpkeys_sigs
				Environment: SURFRAW_pgpkeys_sigs
  -f                            Displays fingerprints of the keys
				Default: $SURFRAW_pgpkeys_fingerprints
				Environment: SURFRAW_pgpkeys_fingerprints
  -e                            Exact matches only
				Default: $SURFRAW_pgpkeys_exact
				Environment: SURFRAW_pgpkeys_exact
  -k=				Keyserver to query. Supported:
      sks           |           www.sks-keyservers.net (default)
      gnupg         |           www-keys.gnupg.net
      pgp           |           www.uk.pgp.net
      mit           |           pgp.mit.edu
	                        Default: $SURFRAW_pgpkeys_server
	                        Environment: SURFRAW_pgpkeys_server
Examples:
  $w3_argv0 -s rms@gnu.org
EOF
    w3_global_usage
}

w3_parse_option_hook () {
    opt="$1"
    optarg="$2"
    case "$opt" in
	-s*)	setopt	 SURFRAW_pgpkeys_sigs on	  ;;
	-f*)	setoptyn SURFRAW_pgpkeys_fingerprints on  ;;
	-e*)	setoptyn SURFRAW_pgpkeys_exact	      on  ;;
        -k*=*)  setopt   SURFRAW_pgpkeys_server "$optarg" ;;
	*) return 1 ;;
    esac
    return 0
}

w3_config
w3_parse_args "$@"

case "$SURFRAW_pgpkeys_server" in
    mit)
        base="http://pgp.mit.edu"
        prefix="http://pgp.mit.edu:11371/pks/lookup?search=" ;;
    sks)
        base="http://www.sks-keyservers.net/i/"
        prefix="http://pool.sks-keyservers.net:11371/pks/lookup?search=" ;;
    gnupg)
        base="http://http-keys.gnupg.net"
        prefix="http://http-keys.gnupg.net/pks/lookup?search=" ;;
    pgp)
        base="http://www.uk.pgp.net/pgpnet/wwwkeys.html"
        prefix="http://wwwkeys.uk.pgp.net:11371/pks/lookup?search=" ;;
    *) err "Server \"$SURFRAW_pgpkeys_server\" not supported" ;;
esac

suffix="&op=index"
if [ $SURFRAW_pgpkeys_sigs = on ]; then
    suffix="&op=vindex"
fi

if ifyes SURFRAW_pgpkeys_fingerprints ;then
    suffix="$suffix&fingerprint=on"
fi

if ifyes SURFRAW_pgpkeys_exact ;then
    suffix="$suffix&exact=on"
fi

if null "$w3_args"; then
    w3_browse_url "$base"
else
    escaped_args=`w3_url_of_arg $w3_args`
    w3_browse_url "${prefix}${escaped_args}${suffix}"
fi