;;; mime-pgp.el --- mime-view internal methods for PGP.
-;; Copyright (C) 1995,1996,1997 MORIOKA Tomohiko
+;; Copyright (C) 1995,1996,1997,1998 MORIOKA Tomohiko
;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
;; Created: 1995/12/7
;; Renamed: 1997/2/27 from tm-pgp.el
-;; Version: $Id: mime-pgp.el,v 0.23 1997-11-15 14:55:43 morioka Exp $
;; Keywords: PGP, security, MIME, multimedia, mail, news
-;; This file is part of SEMI (SEMI is Emacs MIME Interfaces).
+;; This file is part of SEMI (Secure Emacs MIME Interface).
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
;;;
;;; It is based on draft-kazu-pgp-mime-00.txt
-(defun mime-article/view-application/pgp (beg end cal)
+(defun mime-process-application/pgp (beg end cal)
(let* ((cnum (mime-article/point-content-number beg))
(p-win (or (get-buffer-window mime-view-buffer)
(get-largest-window)))
(set-atype 'mime-acting-condition
'((type . "application/pgp")
- (method . mime-article/view-application/pgp)
+ (method . mime-process-application/pgp)
))
(set-atype 'mime-acting-condition
'((type . "text/x-pgp")
- (method . mime-article/view-application/pgp)
+ (method . mime-process-application/pgp)
+ ))
+
+
+;;; @ Internal method for multipart/signed
+;;;
+
+(defun mime-check-multipart/signed (beg end cal)
+ "Internal method to check multipart/signed."
+ (let* ((rcnum (reverse (mime-article/point-content-number beg)))
+ (oinfo (mime-article/rcnum-to-cinfo (cons '1 rcnum)
+ mime-raw-content-info))
+ )
+ (mime-playback-entity oinfo (cdr (assq 'mode cal)))
+ ))
+
+(set-atype 'mime-acting-condition
+ '((type . "multipart/signed")
+ (method . mime-check-multipart/signed)
))
'((en . "Key matching expected Key ID \\(\\S +\\) not found"))
"Alist of language vs regexp to detect ``Key expected''.")
-(defun mime::article/call-pgp-to-check-signature (output-buffer orig-file)
+(defun mime-pgp-check-signature (output-buffer orig-file)
(save-excursion
(set-buffer output-buffer)
- (erase-buffer)
- )
+ (erase-buffer))
(let* ((lang (or mime-pgp-default-language 'en))
(status (call-process-region (point-min)(point-max)
mime-pgp-command
nil output-buffer nil
orig-file (format "+language=%s" lang)))
- (regexp (cdr (assq lang mime-pgp-good-signature-regexp-alist)))
- )
+ (regexp (cdr (assq lang mime-pgp-good-signature-regexp-alist))))
(if (= status 0)
(save-excursion
(set-buffer output-buffer)
(cond ((not (stringp regexp))
"Please specify right regexp for specified language")
((re-search-forward regexp nil t)
- (buffer-substring (match-beginning 0) (match-end 0))
- )
- (t
- "Bad signature")))
+ (buffer-substring (match-beginning 0) (match-end 0)))
+ (t "Bad signature")))
))))
-(defun mime-article/check-pgp-signature (beg end cal)
+(defun mime-pgp-check-application/pgp-signature (beg end cal)
"Internal method to check PGP/MIME signature."
(let* ((encoding (cdr (assq 'encoding cal)))
(cnum (mime-article/point-content-number beg))
)
(mime-decode-region (point-min)(point-max) encoding)
(as-binary-output-file (write-region (point-min)(point-max) sig-file))
- (or (mime::article/call-pgp-to-check-signature
- mime-echo-buffer-name orig-file)
+ (or (mime-pgp-check-signature mime-echo-buffer-name orig-file)
(let (pgp-id)
(save-excursion
(set-buffer mime-echo-buffer-name)
)
(progn
(funcall (pgp-function 'fetch-key) (cons nil pgp-id))
- (mime::article/call-pgp-to-check-signature
- mime-echo-buffer-name orig-file)
+ (mime-pgp-check-signature mime-echo-buffer-name orig-file)
))
))
(let ((other-window-scroll-buffer mime-echo-buffer-name))
(set-atype 'mime-acting-condition
'((type . "application/pgp-signature")
- (method . mime-article/check-pgp-signature)
+ (method . mime-pgp-check-application/pgp-signature)
))
;;;
;;; It is based on RFC 2015.
-(defun mime-article/decrypt-pgp (beg end cal)
+(defun mime-pgp-decrypt-application/pgp-encrypted (beg end cal)
(let* ((cnum (mime-article/point-content-number beg))
(rcnum (reverse cnum))
(rmcnum (cdr rcnum))
(obeg (mime-entity-info-point-min oinfo))
(oend (mime-entity-info-point-max oinfo))
)
- (mime-article/view-application/pgp obeg oend cal)
+ (mime-process-application/pgp obeg oend cal)
))
(set-atype 'mime-acting-condition
'((type . "application/pgp-encrypted")
- (method . mime-article/decrypt-pgp)
+ (method . mime-pgp-decrypt-application/pgp-encrypted)
))
;;;
;;; It is based on RFC 2015.
-(defun mime-article/add-pgp-keys (beg end cal)
+(defun mime-pgp-add-keys (beg end cal)
(let* ((cnum (mime-article/point-content-number beg))
(new-name (format "%s-%s" (buffer-name) cnum))
(encoding (cdr (assq 'encoding cal)))
(set-atype 'mime-acting-condition
'((type . "application/pgp-keys")
- (method . mime-article/add-pgp-keys)
+ (method . mime-pgp-add-keys)
))