PGG
Simon Josefsson
jas at extundo.com
Mon Sep 30 05:45:17 JST 2002
Simon Josefsson <jas at extundo.com> writes:
>> Similar to the above reason, if luna.el shipped with Gnus, the
>> maintainance would be more difficult for developers of luna
>> applications as well as for FLIM developers. And furthermore, luna is
>> still in active development.
>
> OK, makes sense. Should I remove the dependencies, or do you want to?
I did it, the following are the final patches to make pgg*.el
standalone (compared to the files I copied from the EMIKO branch).
The files are committed to Oort CVS and the XEmacs package CVS
(unsupported/simon/pgg). Maybe bump the PGG version to 0.2?
Thanks alot for your work, finally Gnus users will be able to use
OpenPGP.
Index: pgg.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/pgg/pgg.el,v
retrieving revision 1.1
retrieving revision 1.6
diff -u -p -r1.1 -r1.6
--- pgg.el 2002/09/24 15:15:31 1.1
+++ pgg.el 2002/09/29 20:47:41 1.6
@@ -29,10 +29,6 @@
;;; Code:
-(require 'calist)
-
-(eval-and-compile (require 'luna))
-
(require 'pgg-def)
(require 'pgg-parse)
@@ -40,113 +36,21 @@
(ignore-errors
(require 'w3)
(require 'url)))
-
-(in-calist-package 'pgg)
-
-(defun pgg-field-match-method-with-containment
- (calist field-type field-value)
- (let ((s-field (assq field-type calist)))
- (cond ((null s-field)
- (cons (cons field-type field-value) calist))
- ((memq (cdr s-field) field-value)
- calist))))
-
-(define-calist-field-match-method 'signature-version
- #'pgg-field-match-method-with-containment)
-
-(define-calist-field-match-method 'symmetric-key-algorithm
- #'pgg-field-match-method-with-containment)
-
-(define-calist-field-match-method 'public-key-algorithm
- #'pgg-field-match-method-with-containment)
-
-(define-calist-field-match-method 'hash-algorithm
- #'pgg-field-match-method-with-containment)
-
-(defvar pgg-verify-condition nil
- "Condition-tree about which PGP implementation is used for verifying.")
-
-(defvar pgg-decrypt-condition nil
- "Condition-tree about which PGP implementation is used for decrypting.")
-
-(ctree-set-calist-strictly
- 'pgg-verify-condition
- '((signature-version 3)(public-key-algorithm RSA)(hash-algorithm MD5)
- (scheme . pgp)))
-
-(ctree-set-calist-strictly
- 'pgg-decrypt-condition
- '((public-key-algorithm RSA)(symmetric-key-algorithm IDEA)
- (scheme . pgp)))
-
-(ctree-set-calist-strictly
- 'pgg-verify-condition
- '((signature-version 3 4)
- (public-key-algorithm RSA ELG DSA)
- (hash-algorithm MD5 SHA1 RIPEMD160)
- (scheme . pgp5)))
-
-(ctree-set-calist-strictly
- 'pgg-decrypt-condition
- '((public-key-algorithm RSA ELG DSA)
- (symmetric-key-algorithm 3DES CAST5 IDEA)
- (scheme . pgp5)))
-
-(ctree-set-calist-strictly
- 'pgg-verify-condition
- '((signature-version 3 4)
- (public-key-algorithm ELG-E DSA ELG)
- (hash-algorithm MD5 SHA1 RIPEMD160)
- (scheme . gpg)))
-
-(ctree-set-calist-strictly
- 'pgg-decrypt-condition
- '((public-key-algorithm ELG-E DSA ELG)
- (symmetric-key-algorithm
- 3DES CAST5 BLOWFISH RIJNDAEL RIJNDAEL192 RIJNDAEL256 TWOFISH)
- (scheme . gpg)))
-
-;;; @ definition of the implementation scheme
-;;;
-
-(eval-and-compile
- (luna-define-class pgg-scheme ())
-
- (luna-define-internal-accessors 'pgg-scheme))
-
-(luna-define-generic pgg-scheme-lookup-key (scheme string &optional type)
- "Search keys associated with STRING.")
-(luna-define-generic pgg-scheme-encrypt-region (scheme start end recipients)
- "Encrypt the current region between START and END.")
+(defvar pgg-temporary-file-directory
+ (cond ((fboundp 'temp-directory) (temp-directory))
+ ((boundp 'temporary-file-directory) temporary-file-directory)
+ ("/tmp/")))
-(luna-define-generic pgg-scheme-decrypt-region (scheme start end)
- "Decrypt the current region between START and END.")
-
-(luna-define-generic pgg-scheme-sign-region
- (scheme start end &optional cleartext)
- "Make detached signature from text between START and END.")
-
-(luna-define-generic pgg-scheme-verify-region
- (scheme start end &optional signature)
- "Verify region between START and END as the detached signature SIGNATURE.")
-
-(luna-define-generic pgg-scheme-insert-key (scheme)
- "Insert public key at point.")
-
-(luna-define-generic pgg-scheme-snarf-keys-region (scheme start end)
- "Add all public keys in region between START and END to the keyring.")
-
;;; @ utility functions
;;;
(defvar pgg-fetch-key-function (function pgg-fetch-key-with-w3))
-(defmacro pgg-make-scheme (scheme)
- `(progn
- (require (intern (format "pgg-%s" ,scheme)))
- (funcall (intern (format "pgg-make-scheme-%s"
- ,scheme)))))
+(defun pgg-invoke (func scheme &rest args)
+ (progn
+ (require (intern (format "pgg-%s" scheme)))
+ (apply 'funcall (intern (format "pgg-%s-%s" scheme func)) args)))
(put 'pgg-save-coding-system 'lisp-indent-function 2)
@@ -245,7 +149,6 @@
`(with-current-buffer pgg-output-buffer
(if (zerop (buffer-size)) nil , at body t)))
-
;;; @ interface functions
;;;
@@ -255,10 +158,10 @@
(interactive
(list (region-beginning)(region-end)
(split-string (read-string "Recipients: ") "[ \t,]+")))
- (let* ((entity (pgg-make-scheme pgg-default-scheme))
- (status
- (pgg-save-coding-system start end
- (pgg-scheme-encrypt-region entity (point-min)(point-max) rcpts))))
+ (let ((status
+ (pgg-save-coding-system start end
+ (pgg-invoke "encrypt-region" (or pgg-scheme pgg-default-scheme)
+ (point-min) (point-max) rcpts))))
(when (interactive-p)
(pgg-display-output-buffer start end status))
status))
@@ -267,19 +170,10 @@
(defun pgg-decrypt-region (start end)
"Decrypt the current region between START and END."
(interactive "r")
- (let* ((packet (cdr (assq 1 (pgg-parse-armor-region start end))))
- (scheme
- (or pgg-scheme
- (cdr (assq 'scheme
- (progn
- (in-calist-package 'pgg)
- (ctree-match-calist pgg-decrypt-condition
- packet))))
- pgg-default-scheme))
- (entity (pgg-make-scheme scheme))
- (status
- (pgg-save-coding-system start end
- (pgg-scheme-decrypt-region entity (point-min)(point-max)))))
+ (let ((status
+ (pgg-save-coding-system start end
+ (pgg-invoke "decrypt-region" (or pgg-scheme pgg-default-scheme)
+ (point-min) (point-max)))))
(when (interactive-p)
(pgg-display-output-buffer start end status))
status))
@@ -290,10 +184,10 @@
If the optional 3rd argument CLEARTEXT is non-nil, it does not create
a detached signature."
(interactive "r")
- (let* ((entity (pgg-make-scheme pgg-default-scheme))
- (status (pgg-save-coding-system start end
- (pgg-scheme-sign-region entity (point-min)(point-max)
- (or (interactive-p) cleartext)))))
+ (let ((status (pgg-save-coding-system start end
+ (pgg-invoke "sign-region" (or pgg-scheme pgg-default-scheme)
+ (point-min) (point-max)
+ (or (interactive-p) cleartext)))))
(when (interactive-p)
(pgg-display-output-buffer start end status))
status))
@@ -311,34 +205,26 @@ signer's public key from `pgg-default-ke
(if (null signature) nil
(with-temp-buffer
(buffer-disable-undo)
- (set-buffer-multibyte nil)
+ (if (fboundp 'set-buffer-multibyte)
+ (set-buffer-multibyte nil))
(insert-file-contents signature)
(cdr (assq 2 (pgg-decode-armor-region
(point-min)(point-max)))))))
- (scheme
- (or pgg-scheme
- (cdr (assq 'scheme
- (progn
- (in-calist-package 'pgg)
- (ctree-match-calist pgg-verify-condition
- packet))))
- pgg-default-scheme))
- (entity (pgg-make-scheme scheme))
(key (cdr (assq 'key-identifier packet)))
status keyserver)
(and (stringp key)
(setq key (concat "0x" (pgg-truncate-key-identifier key)))
- (null (let ((pgg-scheme scheme))
- (pgg-lookup-key key)))
+ (null (pgg-lookup-key key))
(or fetch (interactive-p))
(y-or-n-p (format "Key %s not found; attempt to fetch? " key))
(setq keyserver
(or (cdr (assq 'preferred-key-server packet))
pgg-default-keyserver-address))
(pgg-fetch-key keyserver key))
- (setq status (pgg-save-coding-system start end
- (pgg-scheme-verify-region entity (point-min)(point-max)
- signature)))
+ (setq status
+ (pgg-save-coding-system start end
+ (pgg-invoke "verify-region" (or pgg-scheme pgg-default-scheme)
+ (point-min) (point-max) signature)))
(when (interactive-p)
(let ((temp-buffer-show-function
(function pgg-temp-buffer-show-function)))
@@ -352,20 +238,18 @@ signer's public key from `pgg-default-ke
(defun pgg-insert-key ()
"Insert the ASCII armored public key."
(interactive)
- (let ((entity (pgg-make-scheme (or pgg-scheme pgg-default-scheme))))
- (pgg-scheme-insert-key entity)))
+ (pgg-invoke "insert-key" (or pgg-scheme pgg-default-scheme)))
;;;###autoload
(defun pgg-snarf-keys-region (start end)
"Import public keys in the current region between START and END."
(interactive "r")
- (let ((entity (pgg-make-scheme (or pgg-scheme pgg-default-scheme))))
- (pgg-save-coding-system start end
- (pgg-scheme-snarf-keys-region entity start end))))
+ (pgg-save-coding-system start end
+ (pgg-invoke "snarf-keys-region" (or pgg-scheme pgg-default-scheme)
+ start end)))
(defun pgg-lookup-key (string &optional type)
- (let ((entity (pgg-make-scheme (or pgg-scheme pgg-default-scheme))))
- (pgg-scheme-lookup-key entity string type)))
+ (pgg-invoke "lookup-key" (or pgg-scheme pgg-default-scheme) string type))
(defvar pgg-insert-url-function (function pgg-insert-url-with-w3))
Index: pgg-gpg.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/pgg/pgg-gpg.el,v
retrieving revision 1.1
retrieving revision 1.4
diff -u -p -r1.1 -r1.4
--- pgg-gpg.el 2002/09/24 15:15:31 1.1
+++ pgg-gpg.el 2002/09/29 20:39:30 1.4
@@ -25,7 +25,6 @@
;;; Code:
-(require 'mel) ; binary-to-text-funcall
(eval-when-compile (require 'pgg))
(defgroup pgg-gpg ()
@@ -42,23 +41,12 @@
:group 'pgg-gpg
:type 'string)
-(eval-and-compile
- (luna-define-class pgg-scheme-gpg (pgg-scheme)))
-
(defvar pgg-gpg-user-id nil
"GnuPG ID of your default identity.")
-(defvar pgg-scheme-gpg-instance nil)
-
-;;;###autoload
-(defun pgg-make-scheme-gpg ()
- (or pgg-scheme-gpg-instance
- (setq pgg-scheme-gpg-instance
- (luna-make-entity 'pgg-scheme-gpg))))
-
(defun pgg-gpg-process-region (start end passphrase program args)
(let* ((output-file-name
- (concat temporary-file-directory (make-temp-name "pgg-output")))
+ (concat pgg-temporary-file-directory (make-temp-name "pgg-output")))
(args
`("--status-fd" "2"
,@(if passphrase '("--passphrase-fd" "0"))
@@ -119,8 +107,8 @@
(substring (match-string 0) -8)))
passphrase)))
-(luna-define-method pgg-scheme-lookup-key ((scheme pgg-scheme-gpg)
- string &optional type)
+(defun pgg-gpg-lookup-key (string &optional type)
+ "Search keys associated with STRING."
(let ((args (list "--with-colons" "--no-greeting" "--batch"
(if type "--list-secret-keys" "--list-keys")
string)))
@@ -134,8 +122,8 @@
(progn (end-of-line)(point)))
":")) 8)))))
-(luna-define-method pgg-scheme-encrypt-region ((scheme pgg-scheme-gpg)
- start end recipients)
+(defun pgg-gpg-encrypt-region (start end recipients)
+ "Encrypt the current region between START and END."
(let* ((pgg-gpg-user-id (or pgg-gpg-user-id pgg-default-user-id))
(args
`("--batch" "--armor" "--always-trust" "--encrypt"
@@ -150,13 +138,13 @@
(pgg-gpg-process-region start end nil pgg-gpg-program args))
(pgg-process-when-success)))
-(luna-define-method pgg-scheme-decrypt-region ((scheme pgg-scheme-gpg)
- start end)
+(defun pgg-gpg-decrypt-region (start end)
+ "Decrypt the current region between START and END."
(let* ((pgg-gpg-user-id (or pgg-gpg-user-id pgg-default-user-id))
(passphrase
(pgg-read-passphrase
(format "GnuPG passphrase for %s: " pgg-gpg-user-id)
- (pgg-scheme-lookup-key scheme pgg-gpg-user-id 'encrypt)))
+ (pgg-gpg-lookup-key pgg-gpg-user-id 'encrypt)))
(args '("--batch" "--decrypt")))
(pgg-gpg-process-region start end passphrase pgg-gpg-program args)
(with-current-buffer pgg-errors-buffer
@@ -164,13 +152,13 @@
(goto-char (point-min))
(re-search-forward "^\\[GNUPG:] DECRYPTION_OKAY\\>" nil t))))
-(luna-define-method pgg-scheme-sign-region ((scheme pgg-scheme-gpg)
- start end &optional cleartext)
+(defun pgg-gpg-sign-region (start end &optional cleartext)
+ "Make detached signature from text between START and END."
(let* ((pgg-gpg-user-id (or pgg-gpg-user-id pgg-default-user-id))
(passphrase
(pgg-read-passphrase
(format "GnuPG passphrase for %s: " pgg-gpg-user-id)
- (pgg-scheme-lookup-key scheme pgg-gpg-user-id 'sign)))
+ (pgg-gpg-lookup-key pgg-gpg-user-id 'sign)))
(args
(list (if cleartext "--clearsign" "--detach-sign")
"--armor" "--batch" "--verbose"
@@ -183,8 +171,8 @@
(pgg-gpg-possibly-cache-passphrase passphrase))
(pgg-process-when-success)))
-(luna-define-method pgg-scheme-verify-region ((scheme pgg-scheme-gpg)
- start end &optional signature)
+(defun pgg-gpg-verify-region (start end &optional signature)
+ "Verify region between START and END as the detached signature SIGNATURE."
(let ((args '("--batch" "--verify")))
(when (stringp signature)
(setq args (append args (list signature))))
@@ -201,15 +189,16 @@
(set-buffer pgg-output-buffer)
(insert-buffer-substring pgg-errors-buffer)))))
-(luna-define-method pgg-scheme-insert-key ((scheme pgg-scheme-gpg))
+(defun pgg-gpg-insert-key ()
+ "Insert public key at point."
(let* ((pgg-gpg-user-id (or pgg-gpg-user-id pgg-default-user-id))
(args (list "--batch" "--export" "--armor"
pgg-gpg-user-id)))
(pgg-gpg-process-region (point)(point) nil pgg-gpg-program args)
(insert-buffer-substring pgg-output-buffer)))
-(luna-define-method pgg-scheme-snarf-keys-region ((scheme pgg-scheme-gpg)
- start end)
+(defun pgg-gpg-snarf-keys-region (start end)
+ "Add all public keys in region between START and END to the keyring."
(let ((args '("--import" "--batch" "-")) status)
(pgg-gpg-process-region start end nil pgg-gpg-program args)
(set-buffer pgg-errors-buffer)
Index: pgg-pgp5.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/pgg/pgg-pgp5.el,v
retrieving revision 1.1
retrieving revision 1.4
diff -u -p -r1.1 -r1.4
--- pgg-pgp5.el 2002/09/24 15:15:31 1.1
+++ pgg-pgp5.el 2002/09/29 20:39:30 1.4
@@ -25,7 +25,6 @@
;;; Code:
-(require 'mel) ; binary-to-text-funcall, binary-write-decoded-region
(eval-when-compile (require 'pgg))
(defgroup pgg-pgp5 ()
@@ -68,23 +67,12 @@ Bourne shell or its equivalent \(not tcs
:group 'pgg-pgp5
:type 'string)
-(eval-and-compile
- (luna-define-class pgg-scheme-pgp5 (pgg-scheme)))
-
(defvar pgg-pgp5-user-id nil
"PGP 5.* ID of your default identity.")
-(defvar pgg-scheme-pgp5-instance nil)
-
-;;;###autoload
-(defun pgg-make-scheme-pgp5 ()
- (or pgg-scheme-pgp5-instance
- (setq pgg-scheme-pgp5-instance
- (luna-make-entity 'pgg-scheme-pgp5))))
-
(defun pgg-pgp5-process-region (start end passphrase program args)
(let* ((errors-file-name
- (concat temporary-file-directory
+ (concat pgg-temporary-file-directory
(make-temp-name "pgg-errors")))
(args
(append args
@@ -136,8 +124,8 @@ Bourne shell or its equivalent \(not tcs
(delete-file errors-file-name)
(file-error nil)))))
-(luna-define-method pgg-scheme-lookup-key ((scheme pgg-scheme-pgp5)
- string &optional type)
+(defun pgg-pgp5-lookup-key (string &optional type)
+ "Search keys associated with STRING."
(let ((args (list "+language=en" "-l" string)))
(with-current-buffer (get-buffer-create pgg-output-buffer)
(buffer-disable-undo)
@@ -150,8 +138,8 @@ Bourne shell or its equivalent \(not tcs
(buffer-substring (match-end 0)(progn (end-of-line)(point)))))
2)))))
-(luna-define-method pgg-scheme-encrypt-region ((scheme pgg-scheme-pgp5)
- start end recipients)
+(defun pgg-pgp5-encrypt-region (start end recipients)
+ "Encrypt the current region between START and END."
(let* ((pgg-pgp5-user-id (or pgg-pgp5-user-id pgg-default-user-id))
(args
`("+NoBatchInvalidKeys=off" "-fat" "+batchmode=1"
@@ -166,25 +154,25 @@ Bourne shell or its equivalent \(not tcs
(pgg-pgp5-process-region start end nil pgg-pgp5-pgpe-program args)
(pgg-process-when-success nil)))
-(luna-define-method pgg-scheme-decrypt-region ((scheme pgg-scheme-pgp5)
- start end)
+(defun pgg-pgp5-decrypt-region (start end)
+ "Decrypt the current region between START and END."
(let* ((pgg-pgp5-user-id (or pgg-pgp5-user-id pgg-default-user-id))
(passphrase
(pgg-read-passphrase
(format "PGP passphrase for %s: " pgg-pgp5-user-id)
- (pgg-scheme-lookup-key scheme pgg-pgp5-user-id 'encrypt)))
+ (pgg-pgp5-lookup-key pgg-pgp5-user-id 'encrypt)))
(args
'("+verbose=1" "+batchmode=1" "+language=us" "-f")))
(pgg-pgp5-process-region start end passphrase pgg-pgp5-pgpv-program args)
(pgg-process-when-success nil)))
-(luna-define-method pgg-scheme-sign-region ((scheme pgg-scheme-pgp5)
- start end &optional clearsign)
+(defun pgg-pgp5-sign-region (start end &optional clearsign)
+ "Make detached signature from text between START and END."
(let* ((pgg-pgp5-user-id (or pgg-pgp5-user-id pgg-default-user-id))
(passphrase
(pgg-read-passphrase
(format "PGP passphrase for %s: " pgg-pgp5-user-id)
- (pgg-scheme-lookup-key scheme pgg-pgp5-user-id 'sign)))
+ (pgg-pgp5-lookup-key pgg-pgp5-user-id 'sign)))
(args
(list (if clearsign "-fat" "-fbat")
"+verbose=1" "+language=us" "+batchmode=1"
@@ -202,16 +190,18 @@ Bourne shell or its equivalent \(not tcs
(cdr (assq 'key-identifier packet))
passphrase)))))))
-(luna-define-method pgg-scheme-verify-region ((scheme pgg-scheme-pgp5)
- start end &optional signature)
- (let* ((basename (expand-file-name "pgg" temporary-file-directory))
+(defun pgg-pgp5-verify-region (start end &optional signature)
+ "Verify region between START and END as the detached signature SIGNATURE."
+ (let* ((basename (expand-file-name "pgg" pgg-temporary-file-directory))
(orig-file (make-temp-name basename))
(args '("+verbose=1" "+batchmode=1" "+language=us"))
(orig-mode (default-file-modes)))
(unwind-protect
(progn
(set-default-file-modes 448)
- (binary-write-decoded-region start end orig-file))
+ (let ((coding-system-for-write 'binary)
+ jka-compr-compression-info-list jam-zcat-filename-list)
+ (write-region start end orig-file)))
(set-default-file-modes orig-mode))
(when (stringp signature)
(copy-file signature (setq signature (concat orig-file ".asc")))
@@ -228,7 +218,8 @@ Bourne shell or its equivalent \(not tcs
t)
nil))))
-(luna-define-method pgg-scheme-insert-key ((scheme pgg-scheme-pgp5))
+(defun pgg-pgp5-insert-key ()
+ "Insert public key at point."
(let* ((pgg-pgp5-user-id (or pgg-pgp5-user-id pgg-default-user-id))
(args
(list "+verbose=1" "+batchmode=1" "+language=us" "-x"
@@ -236,10 +227,10 @@ Bourne shell or its equivalent \(not tcs
(pgg-pgp5-process-region (point)(point) nil pgg-pgp5-pgpk-program args)
(insert-buffer-substring pgg-output-buffer)))
-(luna-define-method pgg-scheme-snarf-keys-region ((scheme pgg-scheme-pgp5)
- start end)
+(defun pgg-pgp5-snarf-keys-region (start end)
+ "Add all public keys in region between START and END to the keyring."
(let* ((pgg-pgp5-user-id (or pgg-pgp5-user-id pgg-default-user-id))
- (basename (expand-file-name "pgg" temporary-file-directory))
+ (basename (expand-file-name "pgg" pgg-temporary-file-directory))
(key-file (make-temp-name basename))
(args
(list "+verbose=1" "+batchmode=1" "+language=us" "-a"
Index: pgg-parse.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/pgg/pgg-parse.el,v
retrieving revision 1.1
retrieving revision 1.4
diff -u -p -r1.1 -r1.4
--- pgg-parse.el 2002/09/24 15:15:31 1.1
+++ pgg-parse.el 2002/09/29 20:47:41 1.4
@@ -37,11 +37,7 @@
(eval-when-compile (require 'cl))
-(eval-when-compile (require 'static))
-
-(require 'pccl)
(require 'custom)
-(require 'mel)
(defgroup pgg-parse ()
"OpenPGP packet parsing"
@@ -103,8 +99,13 @@
"^-----BEGIN PGP SIGNATURE-----\r?$")
"Armor headers.")
+(eval-and-compile
+ (defalias 'pgg-char-int (if (fboundp 'char-int)
+ 'char-int
+ 'identity)))
+
(defmacro pgg-format-key-identifier (string)
- `(mapconcat (lambda (c) (format "%02X" (char-int c)))
+ `(mapconcat (lambda (c) (format "%02X" (pgg-char-int c)))
,string "")
;; `(upcase (apply #'format "%02x%02x%02x%02x%02x%02x%02x%02x"
;; (string-to-int-list ,string)))
@@ -118,10 +119,10 @@
0))
(defmacro pgg-byte-after (&optional pos)
- `(char-int (char-after ,(or pos `(point)))))
+ `(pgg-char-int (char-after ,(or pos `(point)))))
(defmacro pgg-read-byte ()
- `(char-int (char-after (prog1 (point) (forward-char)))))
+ `(pgg-char-int (char-after (prog1 (point) (forward-char)))))
(defmacro pgg-read-bytes-string (nbytes)
`(buffer-substring
@@ -129,7 +130,7 @@
(forward-char ,nbytes))))
(defmacro pgg-read-bytes (nbytes)
- `(mapcar #'char-int (pgg-read-bytes-string ,nbytes))
+ `(mapcar #'pgg-char-int (pgg-read-bytes-string ,nbytes))
;; `(string-to-int-list (pgg-read-bytes-string ,nbytes))
)
@@ -139,7 +140,7 @@
(pgg-read-bytes-string (- (point-max) (point)))))
(defmacro pgg-read-body (ptag)
- `(mapcar #'char-int (pgg-read-body-string ,ptag))
+ `(mapcar #'pgg-char-int (pgg-read-body-string ,ptag))
;; `(string-to-int-list (pgg-read-body-string ,ptag))
)
@@ -154,7 +155,8 @@
(defmacro pgg-set-alist (alist key value)
`(setq ,alist (nconc ,alist (list (cons ,key ,value)))))
-(unless-broken ccl-usable
+(when (fboundp 'define-ccl-program)
+
(define-ccl-program pgg-parse-crc24
'(1
((loop
@@ -463,13 +465,12 @@
(match-beginning 0))))
(checksum (buffer-substring (point) (+ 4 (point)))))
(delete-region marker (point-max))
- (mime-decode-region (point-min) marker "base64")
- (static-when (fboundp 'pgg-parse-crc24-string )
+ (base64-decode-region (point-min) marker)
+ (when (fboundp 'pgg-parse-crc24-string)
(or pgg-ignore-packet-checksum
(string-equal
- (funcall (mel-find-function 'mime-encode-string "base64")
- (pgg-parse-crc24-string
- (buffer-string)))
+ (base64-encode-string (pgg-parse-crc24-string
+ (buffer-string)))
checksum)
(error "PGP packet checksum does not match")))))
@@ -488,12 +489,18 @@
(defun pgg-parse-armor (string)
(with-temp-buffer
(buffer-disable-undo)
- (set-buffer-multibyte nil)
+ (if (fboundp 'set-buffer-multibyte)
+ (set-buffer-multibyte nil))
(insert string)
(pgg-decode-armor-region (point-min)(point))))
+(eval-and-compile
+ (defalias 'pgg-string-as-unibyte (if (fboundp 'string-as-unibyte)
+ 'string-as-unibyte
+ 'identity)))
+
(defun pgg-parse-armor-region (start end)
- (pgg-parse-armor (string-as-unibyte (buffer-substring start end))))
+ (pgg-parse-armor (pgg-string-as-unibyte (buffer-substring start end))))
(provide 'pgg-parse)
Index: pgg.texi
===================================================================
RCS file: /usr/local/cvsroot/gnus/pgg/pgg.texi,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -r1.1 -r1.2
--- pgg.texi 2002/09/24 15:15:44 1.1
+++ pgg.texi 2002/09/29 18:51:47 1.2
@@ -233,7 +233,6 @@ while finding out how to write the PGG b
* Initializing::
* Backend methods::
* Getting output::
-* Registering backend::
@end menu
@node Initializing
@@ -327,55 +326,6 @@ The standard output of the execution of
The rest of status information of the execution of the PGP command is
stored here.
@end defvar
-
- at node Registering backend
- at section Registering backend
-
-When decrypting and verifying PGG searches the registered scheme for an
-implementation from @var{pgg-verify-condition} and
- at var{pgg-decrypt-condition}. These variable hold capability information
-of backend implementations.
-
-The @code{gpg} backend, for example, is registered as below:
-
- at lisp
-(ctree-set-calist-strictly
- 'pgg-verify-condition
- '((signature-version 3 4)
- (public-key-algorithm ELG-E DSA ELG)
- (hash-algorithm MD5 SHA1 RIPEMD160)
- (scheme . gpg)))
-
-(ctree-set-calist-strictly
- 'pgg-decrypt-condition
- '((public-key-algorithm ELG-E DSA ELG)
- (symmetric-key-algorithm 3DES CAST5 BLOWFISH TWOFISH)
- (scheme . gpg)))
- at end lisp
-
-The former expression says:
-
- at itemize
- at item
-the backend @code{gpg} supports version 3 and 4 of the signature format
- at item
-the backend @code{gpg} supports ELG-E, DSA, and ELG as public-key
-algorithm for signing
- at item
-the backend @code{gpg} supports MD5, SHA1, and RIPEMD160 as hash
-algorithm for signing
- at end itemize
-
-And the latter expression says:
-
- at itemize
- at item
-the backend @code{gpg} supports ELG-E, DSA, and ELG as public-key
-algorithm for decrypting
- at item
-the backend @code{gpg} supports 3DES, CAST5, BLOWFISH, and TWOFISH as
-cipher algorithm for decrypting.
- at end itemize
@node Parsing OpenPGP packets
@chapter Parsing OpenPGP packets
More information about the Emacs-mime-en
mailing list