home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / alt / security / pgp / 448 < prev    next >
Encoding:
Text File  |  1992-12-31  |  8.7 KB  |  260 lines

  1. Xref: sparky alt.security.pgp:448 gnu.emacs.vm.info:491
  2. Path: sparky!uunet!oracle!unrepliable!bounce
  3. Newsgroups: alt.security.pgp,gnu.emacs.vm.info
  4. From: mwarren@oracle.com (Mark Warren)
  5. Subject: Re: Signing messages with headers only.
  6. In-Reply-To: jef@netcom.com's message of 30 Dec 92 17:51:47 GMT
  7. Message-ID: <MWARREN.92Dec31121907@af9hp.oracle.com>
  8. Sender: usenet@oracle.us.oracle.com (Oracle News Poster)
  9. Nntp-Posting-Host: af9hp.us.oracle.com
  10. Organization: Oracle Corporation, Belmont, CA
  11. References: <9212291517.AA00464@chaos.intercon.com> <1992Dec30.175147.17244@netcom.com>
  12. Date: Thu, 31 Dec 1992 20:19:07 GMT
  13. X-Disclaimer: This message was written by an unauthenticated user
  14.               at Oracle Corporation.  The opinions expressed are those
  15.               of the user and not necessarily those of Oracle.
  16. Lines: 242
  17.  
  18.  
  19. There is a package md4.el (included below) to do message fingerprint
  20. verification. Perhaps this combined with the -b option of pgp could be
  21. used to create an automatic signature generation/checking for use in
  22. emacs and vm (this is probably of limited value for elm/mh and
  23. rn/nn/trn users). Hopefully someone will have already hacked together
  24. a package.
  25.  
  26. Thanks,
  27.  
  28. Mark
  29.  
  30. From alt.security.pgp:
  31. In article <1992Dec30.175147.17244@netcom.com> jef@netcom.com (Jef Poskanzer) writes:
  32.  
  33.    amanda@intercon.com (Amanda Walker):
  34.    }-----BEGIN PRIVACY-ENHANCED MESSAGE-----
  35.    }jef@netcom.com (Jef Poskanzer) writes:
  36.    }> Note, since posting this I've fetched RIPEM, and found that it
  37.    }> doesn't have this headers-only option either.
  38.    }
  39.    }If I understand this correctly, I believe it does; that is to say, RIPEM
  40.    }can indeed produce a signed message, where the body remains in the clear.
  41.    }You just have to use the "-m mic-clear" option.  For example, this article
  42.    }was produced by piping the body through "ripem -e -m mic-clear".
  43.    }-----END PRIVACY-ENHANCED MESSAGE-----
  44.  
  45.    Yeah, I noticed that feature.  PGP has the equivalent.  What neither
  46.    has is a mode to sign using *headers only*.  As in, up there at the
  47.    top with my X-Face, without all that ---BEGIN arglebargle messing up
  48.    the message.
  49.    ---
  50.    Jef
  51.  
  52.           Jef Poskanzer  jef@netcom.com  jef@well.sf.ca.us
  53.     "You striving, bickering, foolishly brave humans." -- Apollo
  54.  
  55. ======================================================================
  56.  
  57. ;; md4.el -- MD4 support for GNUS
  58. ;;
  59. ;; SCCS Status     : @(#)@ md4    1.5
  60. ;; Author          : Johan Vromans
  61. ;; Created On      : Sat May 11 09:10:04 1991
  62. ;; Last Modified By: Dave Brennan
  63. ;; Last Modified On: Mon Jul  6 16:42:14 1992
  64. ;; Update Count    : 13
  65. ;; Status          : OK
  66. ;;
  67. ;; LCD Archive Entry:
  68. ;; md4|Johan Vromans|jv@mh.nl|
  69. ;; MD4 support for GNUS|
  70. ;; 92-06-16|1.5|~/misc/md4.el.Z|
  71. ;;
  72. ;; This file defines functions to calculate a MD4 signature, add
  73. ;; it to outgoing postings, and validate it on incoming postings.
  74. ;;
  75. ;; It uses "gnus-Inews-article-hook", called by GNUS just before passing
  76. ;; the articel to inews, to install the signature.
  77. ;;
  78. ;; "gnus-Article-prepare-hook" is used to validate the signature on
  79. ;; an article if you read it.
  80. ;;
  81. ;; Advised usage: load this file after loading gnus, e.g. from the
  82. ;; gnus-Startup-hook.
  83. ;; You also can do this explicitly:
  84. ;;
  85. ;;      (load "gnus" nil t)
  86. ;;    (load "md4" t nil)    ; optional
  87. ;;    (gnus)
  88. ;;
  89. ;; This file, if useful, is covered by the GPL.
  90. ;;
  91. ;;    Johan Vromans <jv@mh.nl>
  92.  
  93. ;; HISTORY 
  94. ;; 16-Jun-1992        Johan Vromans    
  95. ;;    Added LCD entry.
  96. ;; 22-May-1991        Johan Vromans    
  97. ;;    Enhanced comments and improved customization.
  98. ;;    Added provide 'md4 and require 'add-hook.
  99. ;;    Normalized .signature file inclusion.
  100.  
  101. (provide 'md4)
  102. ;;(or (fboundp 'add-hook)
  103. ;;    (require 'add-hook))    ; by Dan LaLiberte <liberte@cs.uiuc.edu>
  104.  
  105. ;; Customizations
  106. ;;
  107. ;; This function only uses program md4; it doesn't need md4hash nor 
  108. ;; md4check.
  109. ;; The md4 programs can be retrieved from your nearest comp.sources.misc
  110. ;; archive site. Contact the moderator of comp.sources.misc for details.
  111. ;;
  112. (defvar md4-command "md5"
  113.   "*Where to find the md4 program. This program should be in your PATH.")
  114.  
  115. (defvar md4-insertion t
  116.   "*Controls MD4 signature insertion. If nil, no signature is inserted.")
  117.  
  118. (defvar md4-validation 1
  119.   "*Controls MD4 signature validation. If nil, no validation is
  120.   performed. If t, validation is performed, and failures are reported.
  121.   Any other value causes validation to be performed, and failures as
  122.   well as successes to be reported.")
  123.  
  124. ;; If the variable gnus-signature-file is not null, GNUS will append
  125. ;; this file to the article before posting. If null, your .signature
  126. ;; is supposed to be added by your news system. In this case, the md4
  127. ;; calculation will temporary insert the signature to make sure a
  128. ;; correct checksum is calculated.
  129. ;; You may have to change the md4-signature-separator if needed.
  130.  
  131. (defvar md4-signature-separator "-- \n"
  132.   "*If your news posting system appends your .signature file for you, 
  133.   then set this variable to the separator string used. In this case, 
  134.   the signature will be added on behalf of the calculation of the MD4
  135.   checksum, and removed before the article is transferred to the news
  136.   system.
  137.   In general, set it to "--\\n" or "-- \\n" for classic B-news or C-news.")
  138.  
  139. ;;
  140. ;; End of customizations
  141. ;;
  142.  
  143. (defvar md4-signature-header "X-Md4-Signature")
  144.  
  145. ;; Hook definitions and insertions.
  146. ;;
  147. ;; Commented out these two lines since I don't have the package add-hook yet
  148. ;; maw 9/28/92
  149. ;; (add-hook 'gnus-Inews-article-hook 'md4-add-signature)
  150. ;; (add-hook 'gnus-Article-prepare-hook 'md4-validate-signature)
  151. ;;
  152. ;; Calcuates the MD4 signature for the article to be posted, which
  153. ;; is assumed to be in the current buffer.
  154. ;;
  155. (defun md4-add-signature ()
  156.   "Adds a MD4-signature to the article being posted. Must be called
  157. from gnus-Inews-article-hook."
  158.   (interactive)
  159.  
  160.   (if (null md4-insertion)
  161.       nil
  162.     (let (start-of-body end-of-body sigfile)
  163.  
  164.       ;; .signature handling. may be system specific
  165.       (goto-char (point-max))
  166.       (setq end-of-body (point-marker))
  167.       (if (not gnus-signature-file)    ;skip if gnus-sig set
  168.       (if (file-exists-p
  169.            (setq sigfile (expand-file-name "~/.signature")))
  170.           (progn
  171.         (insert md4-signature-separator)
  172.         (insert-file sigfile))
  173.         (setq sigfile nil)))    ;signal 'no file'
  174.  
  175.       (goto-char (point-min))
  176.       (search-forward "\n\n")
  177.       (setq start-of-body (point-marker))    ; remember where
  178.       
  179.       ;; Run md4 and add the signature.
  180.       (forward-line -1)
  181.       (insert md4-signature-header ": ")
  182.       (insert (md4-signature-region start-of-body (point-max)))
  183.       (insert "\n")
  184.  
  185.       (if sigfile
  186.       (delete-region end-of-body (point-max)))
  187.       )))
  188.  
  189. ;;
  190. ;; Validate MD4 signature. A message is shown with the result.
  191. ;; If the signature does not match, buffer "*MD4 Buffer*" holds more
  192. ;; information.
  193. ;;
  194. (defun md4-validate-signature ()
  195.   "Checks a MD4-signature in the article being read. May be called
  196. from gnus-article-prepare-hook."
  197.   (interactive)
  198.  
  199.   (if (null md4-validation)
  200.       nil
  201.     (let (start-of-body)
  202.       (goto-char (point-min))
  203.       (search-forward "\n\n")
  204.       (setq start-of-body (point-marker))    ; remember where
  205.  
  206.       ;; Check if a signature header is present
  207.       (goto-char (point-min))
  208.       (if (search-forward 
  209.        (concat "\n" md4-signature-header ": ")
  210.        start-of-body t)
  211.       (let (signature (here (point)))
  212.         (forward-line 1)
  213.         (setq signature (buffer-substring here (1- (point))))
  214.  
  215.         ;; Validate
  216.         (if (string= 
  217.          signature
  218.          (md4-signature-region start-of-body (point-max)))
  219.         (progn
  220.           (if (not (equal md4-validation t))
  221.               (message "MD4 signature valid."))
  222.           (bury-buffer md4-buffer))
  223.           (beep)
  224.           (save-excursion
  225.         (set-buffer md4-buffer)
  226.         (goto-char (point-min))
  227.         (insert (message "MD4 signature mismatch!")
  228.             "\nPosted:     " signature
  229.             "\nCalculated: ")
  230.         (goto-char (point-min))))
  231.         )))))
  232.  
  233. (defun md4-signature-region (start end)
  234.   "Calculates MD4 signature."
  235.  
  236.   ;; Get buffer and clear it
  237.   (setq md4-buffer (get-buffer-create "*MD4 Buffer*"))
  238.   (save-excursion
  239.     (set-buffer md4-buffer)
  240.     (erase-buffer))
  241.  
  242.   ;; Run md4
  243.   (call-process-region start end
  244.                md4-command nil md4-buffer nil)
  245.  
  246.   ;; Verify normal result
  247.   (save-excursion
  248.     (set-buffer md4-buffer)
  249.     (if (= (buffer-size) 33)
  250.     (buffer-substring (point-min) (1- (point-max)))
  251.       (error "Unexpected result from %s: %s" md4-command
  252.          (buffer-substring (point-min) (point-max))))))
  253. --
  254. Mark Warren                      300 Oracle Parkway, office #423, mail #659304
  255. warren@us.oracle.com                                  Redwood Shores, CA 94065
  256. (415) 506-4639 Voice or 506-7292 Fax         Friends don't let friends run DOS
  257. --
  258. The X-Face header is my picture! Get `faces' from iuvax.cs.indiana.edu
  259. ----------------------------------------------------------------------
  260.