Mercurial > emacs
annotate lisp/pgg-parse.el @ 106433:7c2192f52cb6
Fix a comment and delete trailing whitespace.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Sat, 05 Dec 2009 20:09:49 +0000 |
parents | a9dc0e7c3f2b |
children | 1d1d5d9bd884 |
rev | line source |
---|---|
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
1 ;;; pgg-parse.el --- OpenPGP packet parsing |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
2 |
68651
3bd95f4f2941
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
66383
diff
changeset
|
3 ;; Copyright (C) 1999, 2002, 2003, 2004, 2005, |
100908 | 4 ;; 2006, 2007, 2008, 2009 Free Software Foundation, Inc. |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
5 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
6 ;; Author: Daiki Ueno <ueno@unixuser.org> |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
7 ;; Created: 1999/10/28 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
8 ;; Keywords: PGP, OpenPGP, GnuPG |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
9 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
10 ;; This file is part of GNU Emacs. |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
11 |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
12 ;; GNU Emacs is free software: you can redistribute it and/or modify |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
13 ;; it under the terms of the GNU General Public License as published by |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
14 ;; the Free Software Foundation, either version 3 of the License, or |
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
15 ;; (at your option) any later version. |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
16 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
17 ;; GNU Emacs is distributed in the hope that it will be useful, |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
20 ;; GNU General Public License for more details. |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
21 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
22 ;; You should have received a copy of the GNU General Public License |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
24 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
25 ;;; Commentary: |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
26 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
27 ;; This module is based on |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
28 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
29 ;; [OpenPGP] RFC 2440: "OpenPGP Message Format" |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
30 ;; by John W. Noerenberg, II <jwn2@qualcomm.com>, |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
31 ;; Jon Callas <jon@pgp.com>, Lutz Donnerhacke <lutz@iks-jena.de>, |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
32 ;; Hal Finney <hal@pgp.com> and Rodney Thayer <rodney@unitran.com> |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
33 ;; (1998/11) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
34 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
35 ;;; Code: |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
36 |
87209 | 37 (eval-when-compile |
38 (unless (fboundp 'declare-function) (defmacro declare-function (&rest r))) | |
39 (require 'cl)) | |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
40 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
41 (defgroup pgg-parse () |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
42 "OpenPGP packet parsing." |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
43 :group 'pgg) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
44 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
45 (defcustom pgg-parse-public-key-algorithm-alist |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
46 '((1 . RSA) (2 . RSA-E) (3 . RSA-S) (16 . ELG-E) (17 . DSA) (20 . ELG)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
47 "Alist of the assigned number to the public key algorithm." |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
48 :group 'pgg-parse |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
49 :type '(repeat |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
50 (cons (sexp :tag "Number") (sexp :tag "Type")))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
51 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
52 (defcustom pgg-parse-symmetric-key-algorithm-alist |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
53 '((1 . IDEA) (2 . 3DES) (4 . CAST5) (5 . SAFER-SK128)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
54 "Alist of the assigned number to the simmetric key algorithm." |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
55 :group 'pgg-parse |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
56 :type '(repeat |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
57 (cons (sexp :tag "Number") (sexp :tag "Type")))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
58 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
59 (defcustom pgg-parse-hash-algorithm-alist |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
60 '((1 . MD5) (2 . SHA1) (3 . RIPEMD160) (5 . MD2) (8 . SHA256) (9 . SHA384) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
61 (10 . SHA512)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
62 "Alist of the assigned number to the cryptographic hash algorithm." |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
63 :group 'pgg-parse |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
64 :type '(repeat |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
65 (cons (sexp :tag "Number") (sexp :tag "Type")))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
66 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
67 (defcustom pgg-parse-compression-algorithm-alist |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
68 '((0 . nil); Uncompressed |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
69 (1 . ZIP) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
70 (2 . ZLIB)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
71 "Alist of the assigned number to the compression algorithm." |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
72 :group 'pgg-parse |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
73 :type '(repeat |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
74 (cons (sexp :tag "Number") (sexp :tag "Type")))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
75 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
76 (defcustom pgg-parse-signature-type-alist |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
77 '((0 . "Signature of a binary document") |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
78 (1 . "Signature of a canonical text document") |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
79 (2 . "Standalone signature") |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
80 (16 . "Generic certification of a User ID and Public Key packet") |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
81 (17 . "Persona certification of a User ID and Public Key packet") |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
82 (18 . "Casual certification of a User ID and Public Key packet") |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
83 (19 . "Positive certification of a User ID and Public Key packet") |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
84 (24 . "Subkey Binding Signature") |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
85 (31 . "Signature directly on a key") |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
86 (32 . "Key revocation signature") |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
87 (40 . "Subkey revocation signature") |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
88 (48 . "Certification revocation signature") |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
89 (64 . "Timestamp signature.")) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
90 "Alist of the assigned number to the signature type." |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
91 :group 'pgg-parse |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
92 :type '(repeat |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
93 (cons (sexp :tag "Number") (sexp :tag "Type")))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
94 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
95 (defcustom pgg-ignore-packet-checksum t; XXX |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
96 "If non-nil checksum of each ascii armored packet will be ignored." |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
97 :group 'pgg-parse |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
98 :type 'boolean) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
99 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
100 (defvar pgg-armor-header-lines |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
101 '("^-----BEGIN PGP MESSAGE\\(, PART [0-9]+\\(/[0-9]+\\)?\\)?-----\r?$" |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
102 "^-----BEGIN PGP PUBLIC KEY BLOCK-----\r?$" |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
103 "^-----BEGIN PGP PRIVATE KEY BLOCK-----\r?$" |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
104 "^-----BEGIN PGP SIGNATURE-----\r?$") |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
105 "Armor headers.") |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
106 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
107 (eval-and-compile |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
108 (defalias 'pgg-char-int (if (fboundp 'char-int) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
109 'char-int |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
110 'identity))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
111 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
112 (defmacro pgg-format-key-identifier (string) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
113 `(mapconcat (lambda (c) (format "%02X" (pgg-char-int c))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
114 ,string "") |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
115 ;; `(upcase (apply #'format "%02x%02x%02x%02x%02x%02x%02x%02x" |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
116 ;; (string-to-number-list ,string))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
117 ) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
118 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
119 (defmacro pgg-parse-time-field (bytes) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
120 `(list (logior (lsh (car ,bytes) 8) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
121 (nth 1 ,bytes)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
122 (logior (lsh (nth 2 ,bytes) 8) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
123 (nth 3 ,bytes)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
124 0)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
125 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
126 (defmacro pgg-byte-after (&optional pos) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
127 `(pgg-char-int (char-after ,(or pos `(point))))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
128 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
129 (defmacro pgg-read-byte () |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
130 `(pgg-char-int (char-after (prog1 (point) (forward-char))))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
131 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
132 (defmacro pgg-read-bytes-string (nbytes) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
133 `(buffer-substring |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
134 (point) (prog1 (+ ,nbytes (point)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
135 (forward-char ,nbytes)))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
136 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
137 (defmacro pgg-read-bytes (nbytes) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
138 `(mapcar #'pgg-char-int (pgg-read-bytes-string ,nbytes)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
139 ;; `(string-to-number-list (pgg-read-bytes-string ,nbytes)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
140 ) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
141 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
142 (defmacro pgg-read-body-string (ptag) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
143 `(if (nth 1 ,ptag) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
144 (pgg-read-bytes-string (nth 1 ,ptag)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
145 (pgg-read-bytes-string (- (point-max) (point))))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
146 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
147 (defmacro pgg-read-body (ptag) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
148 `(mapcar #'pgg-char-int (pgg-read-body-string ,ptag)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
149 ;; `(string-to-number-list (pgg-read-body-string ,ptag)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
150 ) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
151 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
152 (defalias 'pgg-skip-bytes 'forward-char) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
153 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
154 (defmacro pgg-skip-header (ptag) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
155 `(pgg-skip-bytes (nth 2 ,ptag))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
156 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
157 (defmacro pgg-skip-body (ptag) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
158 `(pgg-skip-bytes (nth 1 ,ptag))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
159 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
160 (defmacro pgg-set-alist (alist key value) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
161 `(setq ,alist (nconc ,alist (list (cons ,key ,value))))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
162 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
163 (when (fboundp 'define-ccl-program) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
164 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
165 (define-ccl-program pgg-parse-crc24 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
166 '(1 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
167 ((loop |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
168 (read r0) (r1 ^= r0) (r2 ^= 0) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
169 (r5 = 0) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
170 (loop |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
171 (r1 <<= 1) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
172 (r1 += ((r2 >> 15) & 1)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
173 (r2 <<= 1) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
174 (if (r1 & 256) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
175 ((r1 ^= 390) (r2 ^= 19707))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
176 (if (r5 < 7) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
177 ((r5 += 1) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
178 (repeat)))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
179 (repeat))))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
180 |
86484
b7d08fe21e5e
(pgg-parse-24, pgg-parse-crc24-string): Define for compiler.
Glenn Morris <rgm@gnu.org>
parents:
78236
diff
changeset
|
181 (defvar pgg-parse-crc24) |
b7d08fe21e5e
(pgg-parse-24, pgg-parse-crc24-string): Define for compiler.
Glenn Morris <rgm@gnu.org>
parents:
78236
diff
changeset
|
182 |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
183 (defun pgg-parse-crc24-string (string) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
184 (let ((h (vector nil 183 1230 nil nil nil nil nil nil))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
185 (ccl-execute-on-string pgg-parse-crc24 h string) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
186 (format "%c%c%c" |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
187 (logand (aref h 1) 255) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
188 (logand (lsh (aref h 2) -8) 255) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
189 (logand (aref h 2) 255))))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
190 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
191 (defmacro pgg-parse-length-type (c) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
192 `(cond |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
193 ((< ,c 192) (cons ,c 1)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
194 ((< ,c 224) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
195 (cons (+ (lsh (- ,c 192) 8) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
196 (pgg-byte-after (+ 2 (point))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
197 192) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
198 2)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
199 ((= ,c 255) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
200 (cons (cons (logior (lsh (pgg-byte-after (+ 2 (point))) 8) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
201 (pgg-byte-after (+ 3 (point)))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
202 (logior (lsh (pgg-byte-after (+ 4 (point))) 8) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
203 (pgg-byte-after (+ 5 (point))))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
204 5)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
205 (t;partial body length |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
206 '(0 . 0)))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
207 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
208 (defun pgg-parse-packet-header () |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
209 (let ((ptag (pgg-byte-after)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
210 length-type content-tag packet-bytes header-bytes) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
211 (if (zerop (logand 64 ptag));Old format |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
212 (progn |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
213 (setq length-type (logand ptag 3) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
214 length-type (if (= 3 length-type) 0 (lsh 1 length-type)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
215 content-tag (logand 15 (lsh ptag -2)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
216 packet-bytes 0 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
217 header-bytes (1+ length-type)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
218 (dotimes (i length-type) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
219 (setq packet-bytes |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
220 (logior (lsh packet-bytes 8) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
221 (pgg-byte-after (+ 1 i (point))))))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
222 (setq content-tag (logand 63 ptag) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
223 length-type (pgg-parse-length-type |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
224 (pgg-byte-after (1+ (point)))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
225 packet-bytes (car length-type) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
226 header-bytes (1+ (cdr length-type)))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
227 (list content-tag packet-bytes header-bytes))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
228 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
229 (defun pgg-parse-packet (ptag) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
230 (case (car ptag) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
231 (1 ;Public-Key Encrypted Session Key Packet |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
232 (pgg-parse-public-key-encrypted-session-key-packet ptag)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
233 (2 ;Signature Packet |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
234 (pgg-parse-signature-packet ptag)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
235 (3 ;Symmetric-Key Encrypted Session Key Packet |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
236 (pgg-parse-symmetric-key-encrypted-session-key-packet ptag)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
237 ;; 4 -- One-Pass Signature Packet |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
238 ;; 5 -- Secret Key Packet |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
239 (6 ;Public Key Packet |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
240 (pgg-parse-public-key-packet ptag)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
241 ;; 7 -- Secret Subkey Packet |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
242 ;; 8 -- Compressed Data Packet |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
243 (9 ;Symmetrically Encrypted Data Packet |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
244 (pgg-read-body-string ptag)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
245 (10 ;Marker Packet |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
246 (pgg-read-body-string ptag)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
247 (11 ;Literal Data Packet |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
248 (pgg-read-body-string ptag)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
249 ;; 12 -- Trust Packet |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
250 (13 ;User ID Packet |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
251 (pgg-read-body-string ptag)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
252 ;; 14 -- Public Subkey Packet |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
253 ;; 60 .. 63 -- Private or Experimental Values |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
254 )) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
255 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
256 (defun pgg-parse-packets (&optional header-parser body-parser) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
257 (let ((header-parser |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
258 (or header-parser |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
259 (function pgg-parse-packet-header))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
260 (body-parser |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
261 (or body-parser |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
262 (function pgg-parse-packet))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
263 result ptag) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
264 (while (> (point-max) (1+ (point))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
265 (setq ptag (funcall header-parser)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
266 (pgg-skip-header ptag) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
267 (push (cons (car ptag) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
268 (save-excursion |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
269 (funcall body-parser ptag))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
270 result) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
271 (if (zerop (nth 1 ptag)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
272 (goto-char (point-max)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
273 (forward-char (nth 1 ptag)))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
274 result)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
275 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
276 (defun pgg-parse-signature-subpacket-header () |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
277 (let ((length-type (pgg-parse-length-type (pgg-byte-after)))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
278 (list (pgg-byte-after (+ (cdr length-type) (point))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
279 (1- (car length-type)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
280 (1+ (cdr length-type))))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
281 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
282 (defun pgg-parse-signature-subpacket (ptag) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
283 (case (car ptag) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
284 (2 ;signature creation time |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
285 (cons 'creation-time |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
286 (let ((bytes (pgg-read-bytes 4))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
287 (pgg-parse-time-field bytes)))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
288 (3 ;signature expiration time |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
289 (cons 'signature-expiry |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
290 (let ((bytes (pgg-read-bytes 4))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
291 (pgg-parse-time-field bytes)))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
292 (4 ;exportable certification |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
293 (cons 'exportability (pgg-read-byte))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
294 (5 ;trust signature |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
295 (cons 'trust-level (pgg-read-byte))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
296 (6 ;regular expression |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
297 (cons 'regular-expression |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
298 (pgg-read-body-string ptag))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
299 (7 ;revocable |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
300 (cons 'revocability (pgg-read-byte))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
301 (9 ;key expiration time |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
302 (cons 'key-expiry |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
303 (let ((bytes (pgg-read-bytes 4))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
304 (pgg-parse-time-field bytes)))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
305 ;; 10 = placeholder for backward compatibility |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
306 (11 ;preferred symmetric algorithms |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
307 (cons 'preferred-symmetric-key-algorithm |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
308 (cdr (assq (pgg-read-byte) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
309 pgg-parse-symmetric-key-algorithm-alist)))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
310 (12 ;revocation key |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
311 ) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
312 (16 ;issuer key ID |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
313 (cons 'key-identifier |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
314 (pgg-format-key-identifier (pgg-read-body-string ptag)))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
315 (20 ;notation data |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
316 (pgg-skip-bytes 4) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
317 (cons 'notation |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
318 (let ((name-bytes (pgg-read-bytes 2)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
319 (value-bytes (pgg-read-bytes 2))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
320 (cons (pgg-read-bytes-string |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
321 (logior (lsh (car name-bytes) 8) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
322 (nth 1 name-bytes))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
323 (pgg-read-bytes-string |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
324 (logior (lsh (car value-bytes) 8) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
325 (nth 1 value-bytes))))))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
326 (21 ;preferred hash algorithms |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
327 (cons 'preferred-hash-algorithm |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
328 (cdr (assq (pgg-read-byte) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
329 pgg-parse-hash-algorithm-alist)))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
330 (22 ;preferred compression algorithms |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
331 (cons 'preferred-compression-algorithm |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
332 (cdr (assq (pgg-read-byte) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
333 pgg-parse-compression-algorithm-alist)))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
334 (23 ;key server preferences |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
335 (cons 'key-server-preferences |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
336 (pgg-read-body ptag))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
337 (24 ;preferred key server |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
338 (cons 'preferred-key-server |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
339 (pgg-read-body-string ptag))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
340 ;; 25 = primary user id |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
341 (26 ;policy URL |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
342 (cons 'policy-url (pgg-read-body-string ptag))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
343 ;; 27 = key flags |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
344 ;; 28 = signer's user id |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
345 ;; 29 = reason for revocation |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
346 ;; 100 to 110 = internal or user-defined |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
347 )) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
348 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
349 (defun pgg-parse-signature-packet (ptag) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
350 (let* ((signature-version (pgg-byte-after)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
351 (result (list (cons 'version signature-version))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
352 hashed-material field n) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
353 (cond |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
354 ((= signature-version 3) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
355 (pgg-skip-bytes 2) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
356 (setq hashed-material (pgg-read-bytes 5)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
357 (pgg-set-alist result |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
358 'signature-type |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
359 (cdr (assq (pop hashed-material) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
360 pgg-parse-signature-type-alist))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
361 (pgg-set-alist result |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
362 'creation-time |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
363 (pgg-parse-time-field hashed-material)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
364 (pgg-set-alist result |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
365 'key-identifier |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
366 (pgg-format-key-identifier |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
367 (pgg-read-bytes-string 8))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
368 (pgg-set-alist result |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
369 'public-key-algorithm (pgg-read-byte)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
370 (pgg-set-alist result |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
371 'hash-algorithm (pgg-read-byte))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
372 ((= signature-version 4) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
373 (pgg-skip-bytes 1) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
374 (pgg-set-alist result |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
375 'signature-type |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
376 (cdr (assq (pgg-read-byte) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
377 pgg-parse-signature-type-alist))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
378 (pgg-set-alist result |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
379 'public-key-algorithm |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
380 (pgg-read-byte)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
381 (pgg-set-alist result |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
382 'hash-algorithm (pgg-read-byte)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
383 (when (>= 10000 (setq n (pgg-read-bytes 2) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
384 n (logior (lsh (car n) 8) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
385 (nth 1 n)))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
386 (save-restriction |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
387 (narrow-to-region (point)(+ n (point))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
388 (nconc result |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
389 (mapcar (function cdr) ;remove packet types |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
390 (pgg-parse-packets |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
391 #'pgg-parse-signature-subpacket-header |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
392 #'pgg-parse-signature-subpacket))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
393 (goto-char (point-max)))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
394 (when (>= 10000 (setq n (pgg-read-bytes 2) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
395 n (logior (lsh (car n) 8) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
396 (nth 1 n)))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
397 (save-restriction |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
398 (narrow-to-region (point)(+ n (point))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
399 (nconc result |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
400 (mapcar (function cdr) ;remove packet types |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
401 (pgg-parse-packets |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
402 #'pgg-parse-signature-subpacket-header |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
403 #'pgg-parse-signature-subpacket))))))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
404 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
405 (setcdr (setq field (assq 'public-key-algorithm |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
406 result)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
407 (cdr (assq (cdr field) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
408 pgg-parse-public-key-algorithm-alist))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
409 (setcdr (setq field (assq 'hash-algorithm |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
410 result)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
411 (cdr (assq (cdr field) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
412 pgg-parse-hash-algorithm-alist))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
413 result)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
414 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
415 (defun pgg-parse-public-key-encrypted-session-key-packet (ptag) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
416 (let (result) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
417 (pgg-set-alist result |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
418 'version (pgg-read-byte)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
419 (pgg-set-alist result |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
420 'key-identifier |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
421 (pgg-format-key-identifier |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
422 (pgg-read-bytes-string 8))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
423 (pgg-set-alist result |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
424 'public-key-algorithm |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
425 (cdr (assq (pgg-read-byte) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
426 pgg-parse-public-key-algorithm-alist))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
427 result)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
428 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
429 (defun pgg-parse-symmetric-key-encrypted-session-key-packet (ptag) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
430 (let (result) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
431 (pgg-set-alist result |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
432 'version |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
433 (pgg-read-byte)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
434 (pgg-set-alist result |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
435 'symmetric-key-algorithm |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
436 (cdr (assq (pgg-read-byte) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
437 pgg-parse-symmetric-key-algorithm-alist))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
438 result)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
439 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
440 (defun pgg-parse-public-key-packet (ptag) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
441 (let* ((key-version (pgg-read-byte)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
442 (result (list (cons 'version key-version))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
443 field) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
444 (cond |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
445 ((= 3 key-version) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
446 (pgg-set-alist result |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
447 'creation-time |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
448 (let ((bytes (pgg-read-bytes 4))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
449 (pgg-parse-time-field bytes))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
450 (pgg-set-alist result |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
451 'key-expiry (pgg-read-bytes 2)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
452 (pgg-set-alist result |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
453 'public-key-algorithm (pgg-read-byte))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
454 ((= 4 key-version) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
455 (pgg-set-alist result |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
456 'creation-time |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
457 (let ((bytes (pgg-read-bytes 4))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
458 (pgg-parse-time-field bytes))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
459 (pgg-set-alist result |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
460 'public-key-algorithm (pgg-read-byte)))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
461 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
462 (setcdr (setq field (assq 'public-key-algorithm |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
463 result)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
464 (cdr (assq (cdr field) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
465 pgg-parse-public-key-algorithm-alist))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
466 result)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
467 |
86484
b7d08fe21e5e
(pgg-parse-24, pgg-parse-crc24-string): Define for compiler.
Glenn Morris <rgm@gnu.org>
parents:
78236
diff
changeset
|
468 ;; p-d-p only calls this if it is defined, but the compiler does not |
b7d08fe21e5e
(pgg-parse-24, pgg-parse-crc24-string): Define for compiler.
Glenn Morris <rgm@gnu.org>
parents:
78236
diff
changeset
|
469 ;; recognize that. |
b7d08fe21e5e
(pgg-parse-24, pgg-parse-crc24-string): Define for compiler.
Glenn Morris <rgm@gnu.org>
parents:
78236
diff
changeset
|
470 (declare-function pgg-parse-crc24-string "pgg-parse" (string)) |
b7d08fe21e5e
(pgg-parse-24, pgg-parse-crc24-string): Define for compiler.
Glenn Morris <rgm@gnu.org>
parents:
78236
diff
changeset
|
471 |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
472 (defun pgg-decode-packets () |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
473 (if (re-search-forward "^=\\([A-Za-z0-9+/]\\{4\\}\\)$" nil t) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
474 (let ((p (match-beginning 0)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
475 (checksum (match-string 1))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
476 (delete-region p (point-max)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
477 (if (ignore-errors (base64-decode-region (point-min) p)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
478 (or (not (fboundp 'pgg-parse-crc24-string)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
479 pgg-ignore-packet-checksum |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
480 (string-equal (base64-encode-string (pgg-parse-crc24-string |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
481 (buffer-string))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
482 checksum) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
483 (progn |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
484 (message "PGP packet checksum does not match") |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
485 nil)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
486 (message "PGP packet contain invalid base64") |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
487 nil)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
488 (message "PGP packet checksum not found") |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
489 nil)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
490 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
491 (defun pgg-decode-armor-region (start end) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
492 (save-restriction |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
493 (narrow-to-region start end) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
494 (goto-char (point-min)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
495 (re-search-forward "^-+BEGIN PGP" nil t) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
496 (delete-region (point-min) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
497 (and (search-forward "\n\n") |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
498 (match-end 0))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
499 (when (pgg-decode-packets) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
500 (goto-char (point-min)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
501 (pgg-parse-packets)))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
502 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
503 (defun pgg-parse-armor (string) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
504 (with-temp-buffer |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
505 (buffer-disable-undo) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
506 (if (fboundp 'set-buffer-multibyte) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
507 (set-buffer-multibyte nil)) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
508 (insert string) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
509 (pgg-decode-armor-region (point-min)(point)))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
510 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
511 (eval-and-compile |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
512 (defalias 'pgg-string-as-unibyte (if (fboundp 'string-as-unibyte) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
513 'string-as-unibyte |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
514 'identity))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
515 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
516 (defun pgg-parse-armor-region (start end) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
517 (pgg-parse-armor (pgg-string-as-unibyte (buffer-substring start end)))) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
518 |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
519 (provide 'pgg-parse) |
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
520 |
93975
1e3a407766b9
Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
521 ;; arch-tag: 16c2eb82-1313-4a7c-a70f-420709b5b43e |
66383
c82982d6cbc4
Moved pgg*.el files from lisp/gnus to lisp.
Eli Zaretskii <eliz@gnu.org>
parents:
diff
changeset
|
522 ;;; pgg-parse.el ends here |