File: .pgp~

package info (click to toggle)
pinepgp 3.3
  • links: PTS
  • area: contrib
  • in suites: hamm
  • size: 116 kB
  • ctags: 8
  • sloc: sh: 203; makefile: 52
file content (77 lines) | stat: -rw-r--r-- 2,570 bytes parent folder | download
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
## created for use with PGP 2.6.3

if [  ! -z "`grep -- "-----BEGIN PGP PUBLIC KEY BLOCK-----" $1`" ]; then
  pgp -ka $1 2>&1 | tee /dev/tty | tr -d '\a' | tee $PGPPATH/tmp.res
elif [ -z "`grep -- "-----BEGIN PGP MESSAGE-----" $1`" ]; then
  pgp $1 +LANGUAGE=en +batch=on -o $PGPPATH/tmp.check 2>&1 | tr -d '\a' | tee $PGPPATH/tmp.res
else
  pgp $1 +LANGUAGE=en -o $PGPPATH/tmp.check 2>&1 | tee /dev/tty | tr -d '\a' | tee $PGPPATH/tmp.res
fi

# avoid adding unnecessary blank lines
if [ ! -z "$HEAD" ]; then
  echo "$HEAD" > $1
  echo >> $1
  echo "$starttext" >> $1
else
  echo "$starttext" > $1
fi
cat $PGPPATH/tmp.check >> $1
rm $PGPPATH/tmp.check

msg=`grep "Good signature" $PGPPATH/tmp.res`
note=
if [ -z "$msg" ]; then
  if [ -z "`grep "Bad signature" $PGPPATH/tmp.res`" ]; then
    if grep -q "Can't find the right public key" $PGPPATH/tmp.res; then
      msg="Cannot find matching public key, signature not checked."
    elif grep -q "Unsupported packet format" $PGPPATH/tmp.res; then
      msg="Unsupported packet format."
      note="You need a newer version of PGP for this message."
    elif grep -q "message can only be read by" $PGPPATH/tmp.res; then
      msg="Cannot decrypt message."
      note=`grep -A 1 "message can only be read by" $PGPPATH/tmp.res`
    else
      msg="No signature could be found."
    fi
  fi
else
  adj="Good"
  if grep -q "WARNING" $PGPPATH/tmp.res; then
    if grep -q "public key is not certified with a trusted" $PGPPATH/tmp.res; then
      note="Key is not certified with a trusted signature."
    elif grep -q "public key is not certified with enough trusted" $PGPPATH/tmp.res; then
      note="Key is not certified with enough trusted signatures."
    elif grep -q "public key is not trusted" $PGPPATH/tmp.res; then
      adj=Untrusted
      note="Key is not trusted."
    elif grep -q "revoked" $PGPPATH/tmp.res; then
      adj=Revoked
      note="Key has been revoked by its owner."
    fi
    msg=`echo $msg | sed -e "s/Good/$adj/"`
  fi
fi

if [ ! -z "`grep "No new keys or signatures in keyfile." $PGPPATH/tmp.res`" ]; then
  msg="No new keys could be found in this keyblock.";
fi

if [ ! -z "`grep "Keyfile contains:" $PGPPATH/tmp.res`" ]; then
  msg="Keys added to keyring.";
fi

# if it's greater than a given width, Pine puts it in a new window.
echo "$msg" | sed -e 's/user //' -e 's/signature/sig/' | cut -c 1-58 > $2
echo >> $1
echo -- >> $1
echo $msg >> $1
if [ -n "$note" ]; then
  echo $note >> $1
fi
rm $PGPPATH/tmp.res
echo "$endtext" >> $1
if [ ! -z "$TAIL" ]; then
  echo >> $1
  echo "$TAIL" >> $1
fi