1 ;;; smime.el --- S/MIME support library
3 ;; Copyright (C) 2000, 2001, 2002, 2003, 2004,
4 ;; 2005, 2006, 2007 Free Software Foundation, Inc.
6 ;; Author: Simon Josefsson <simon@josefsson.org>
7 ;; Keywords: SMIME X.509 PEM OpenSSL
9 ;; This file is part of GNU Emacs.
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published
13 ;; by the Free Software Foundation; either version 3, or (at your
14 ;; option) any later version.
16 ;; GNU Emacs is distributed in the hope that it will be useful, but
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 ;; General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 ;; Boston, MA 02110-1301, USA.
28 ;; This library perform S/MIME operations from within Emacs.
30 ;; Functions for fetching certificates from public repositories are
31 ;; provided, currently from DNS and LDAP.
33 ;; It uses OpenSSL (tested with version 0.9.5a and 0.9.6) for signing,
34 ;; encryption and decryption.
36 ;; Some general knowledge of S/MIME, X.509, PKCS#12, PEM etc is
37 ;; probably required to use this library in any useful way.
38 ;; Especially, don't expect this library to buy security for you. If
39 ;; you don't understand what you are doing, you're as likely to lose
40 ;; security than gain any by using this library.
42 ;; This library is not intended to provide a "raw" API for S/MIME,
43 ;; PKCSx or similar, it's intended to perform common operations
44 ;; done on messages encoded in these formats. The terminology chosen
47 ;; The home of this file is in Gnus CVS, but also available from
48 ;; http://josefsson.org/smime.html.
50 ;;; Quick introduction:
52 ;; Get your S/MIME certificate from VeriSign or someplace. I used
53 ;; Netscape to generate the key and certificate request and stuff, and
54 ;; Netscape can export the key into PKCS#12 format.
56 ;; Enter OpenSSL. To be able to use this library, it need to have the
57 ;; SMIME key readable in PEM format. OpenSSL is used to convert the
60 ;; $ openssl pkcs12 -in mykey.p12 -clcerts -nodes > mykey.pem
63 ;; Now, use M-x customize-variable smime-keys and add mykey.pem as
66 ;; Now you should be able to sign messages! Create a buffer and write
67 ;; something and run M-x smime-sign-buffer RET RET and you should see
68 ;; your message MIME armoured and a signature. Encryption, M-x
69 ;; smime-encrypt-buffer, should also work.
71 ;; To be able to verify messages you need to build up trust with
72 ;; someone. Perhaps you trust the CA that issued your certificate, at
73 ;; least I did, so I export it's certificates from my PKCS#12
76 ;; $ openssl pkcs12 -in mykey.p12 -cacerts -nodes > cacert.pem
79 ;; Now, use M-x customize-variable smime-CAs and add cacert.pem as a
82 ;; You should now be able to sign messages, and even verify messages
83 ;; sent by others that use the same CA as you.
87 ;; Don't complain that this package doesn't do encrypted PEM files,
88 ;; submit a patch instead. I store my keys in a safe place, so I
89 ;; didn't need the encryption. Also, programming was made easier by
90 ;; that decision. One might think that this even influenced were I
91 ;; store my keys, and one would probably be right. :-)
93 ;; Update: Mathias Herberts sent the patch. However, it uses
94 ;; environment variables to pass the password to OpenSSL, which is
95 ;; slightly insecure. Hence a new todo: use a better -passin method.
97 ;; Cache password for e.g. 1h
99 ;; Suggestions and comments are appreciated, mail me at simon@josefsson.org.
103 ;; I would include pointers to introductory text on concepts used in
104 ;; this library here, but the material I've read are so horrible I
105 ;; don't want to recomend them.
107 ;; Why can't someone write a simple introduction to all this stuff?
108 ;; Until then, much of this resemble security by obscurity.
110 ;; Also, I'm not going to mention anything about the wonders of
111 ;; cryptopolitics. Oops, I just did.
115 ;;; Revision history:
117 ;; 2000-06-05 initial version, committed to Gnus CVS contrib/
118 ;; 2000-10-28 retrieve certificates via DNS CERT RRs
119 ;; 2001-10-14 posted to gnu.emacs.sources
120 ;; 2005-02-13 retrieve certificates via LDAP
125 (or (require 'password-cache nil t
)
127 (eval-when-compile (require 'cl
))
131 ((fboundp 'replace-in-string
)
132 (defalias 'smime-replace-in-string
'replace-in-string
))
133 ((fboundp 'replace-regexp-in-string
)
134 (defun smime-replace-in-string (string regexp newtext
&optional literal
)
135 "Replace all matches for REGEXP with NEWTEXT in STRING.
136 If LITERAL is non-nil, insert NEWTEXT literally. Return a new
137 string containing the replacements.
139 This is a compatibility function for different Emacsen."
140 (replace-regexp-in-string regexp newtext string nil literal
)))))
143 "S/MIME configuration."
146 (defcustom smime-keys nil
147 "*Map mail addresses to a file containing Certificate (and private key).
148 The file is assumed to be in PEM format. You can also associate additional
149 certificates to be sent with every message to each address."
150 :type
'(repeat (list (string :tag
"Mail address")
151 (file :tag
"File name")
152 (repeat :tag
"Additional certificate files"
153 (file :tag
"File name"))))
156 (defcustom smime-CA-directory nil
157 "*Directory containing certificates for CAs you trust.
158 Directory should contain files (in PEM format) named to the X.509
159 hash of the certificate. This can be done using OpenSSL such as:
161 $ ln -s ca.pem `openssl x509 -noout -hash -in ca.pem`.0
163 where `ca.pem' is the file containing a PEM encoded X.509 CA
165 :type
'(choice (const :tag
"none" nil
)
169 (defcustom smime-CA-file nil
170 "*Files containing certificates for CAs you trust.
171 File should contain certificates in PEM format."
173 :type
'(choice (const :tag
"none" nil
)
177 (defcustom smime-certificate-directory
"~/Mail/certs/"
178 "*Directory containing other people's certificates.
179 It should contain files named to the X.509 hash of the certificate,
180 and the files themself should be in PEM format."
181 ;The S/MIME library provide simple functionality for fetching
182 ;certificates into this directory, so there is no need to populate it
187 (defcustom smime-openssl-program
188 (and (condition-case ()
189 (eq 0 (call-process "openssl" nil nil nil
"version"))
192 "*Name of OpenSSL binary."
196 ;; OpenSSL option to select the encryption cipher
198 (defcustom smime-encrypt-cipher
"-des3"
199 "*Cipher algorithm used for encryption."
201 :type
'(choice (const :tag
"Triple DES" "-des3")
202 (const :tag
"DES" "-des")
203 (const :tag
"RC2 40 bits" "-rc2-40")
204 (const :tag
"RC2 64 bits" "-rc2-64")
205 (const :tag
"RC2 128 bits" "-rc2-128"))
208 (defcustom smime-crl-check nil
209 "*Check revocation status of signers certificate using CRLs.
210 Enabling this will have OpenSSL check the signers certificate
211 against a certificate revocation list (CRL).
213 For this to work the CRL must be up-to-date and since they are
214 normally updated quite often (ie. several times a day) you
215 probably need some tool to keep them up-to-date. Unfortunately
216 Gnus cannot do this for you.
218 The CRL should either be appended (in PEM format) to your
219 `smime-CA-file' or be located in a file (also in PEM format) in
220 your `smime-certificate-directory' named to the X.509 hash of the
221 certificate with .r0 as file name extension.
223 At least OpenSSL version 0.9.7 is required for this to work."
224 :type
'(choice (const :tag
"No check" nil
)
225 (const :tag
"Check certificate" "-crl_check")
226 (const :tag
"Check certificate chain" "-crl_check_all"))
229 (defcustom smime-dns-server nil
230 "*DNS server to query certificates from.
231 If nil, use system defaults."
233 :type
'(choice (const :tag
"System defaults")
237 (defcustom smime-ldap-host-list nil
238 "A list of LDAP hosts with S/MIME user certificates.
239 If needed search base, binddn, passwd, etc. for the LDAP host
240 must be set in `ldap-host-parameters-alist'."
241 :type
'(repeat (string :tag
"Host name"))
242 :version
"23.0" ;; No Gnus
245 (defvar smime-details-buffer
"*OpenSSL output*")
249 (defalias 'smime-make-temp-file
250 (if (fboundp 'make-temp-file
)
252 (lambda (prefix &optional dir-flag
) ;; Simple implementation
254 (make-temp-name prefix
)
255 (if (fboundp 'temp-directory
)
257 temporary-file-directory
))))))
259 ;; Password dialog function
261 (defun smime-ask-passphrase (&optional cache-key
)
262 "Asks the passphrase to unlock the secret key.
263 If `cache-key' and `password-cache' is non-nil then cache the
264 password under `cache-key'."
266 (password-read-and-add
267 "Passphrase for secret key (RET for no passphrase): " cache-key
)))
268 (if (string= passphrase
"")
274 (defun smime-call-openssl-region (b e buf
&rest args
)
275 (case (apply 'call-process-region b e smime-openssl-program nil buf nil args
)
277 (1 (message "OpenSSL: An error occurred parsing the command options.") nil
)
278 (2 (message "OpenSSL: One of the input files could not be read.") nil
)
279 (3 (message "OpenSSL: An error occurred creating the PKCS#7 file or when reading the MIME message.") nil
)
280 (4 (message "OpenSSL: An error occurred decrypting or verifying the message.") nil
)
281 (t (error "Unknown OpenSSL exitcode") nil
)))
283 (defun smime-make-certfiles (certfiles)
285 (append (list "-certfile" (expand-file-name (car certfiles
)))
286 (smime-make-certfiles (cdr certfiles
)))))
288 ;; Sign+encrypt region
290 (defun smime-sign-region (b e keyfile
)
291 "Sign region with certified key in KEYFILE.
292 If signing fails, the buffer is not modified. Region is assumed to
293 have proper MIME tags. KEYFILE is expected to contain a PEM encoded
294 private key and certificate as its car, and a list of additional
295 certificates to include in its caar. If no additional certificates is
296 included, KEYFILE may be the file containing the PEM encoded private
297 key and certificate itself."
298 (smime-new-details-buffer)
299 (let* ((certfiles (and (cdr-safe keyfile
) (cadr keyfile
)))
300 (keyfile (or (car-safe keyfile
) keyfile
))
301 (buffer (generate-new-buffer (generate-new-buffer-name " *smime*")))
302 (passphrase (smime-ask-passphrase (expand-file-name keyfile
)))
303 (tmpfile (smime-make-temp-file "smime")))
305 (setenv "GNUS_SMIME_PASSPHRASE" passphrase
))
308 (apply 'smime-call-openssl-region b e
(list buffer tmpfile
)
309 "smime" "-sign" "-signer" (expand-file-name keyfile
)
311 (smime-make-certfiles certfiles
)
313 (list "-passin" "env:GNUS_SMIME_PASSPHRASE"))))
315 (setenv "GNUS_SMIME_PASSPHRASE" "" t
))
316 (with-current-buffer smime-details-buffer
317 (insert-file-contents tmpfile
)
318 (delete-file tmpfile
)))
320 (insert-buffer-substring buffer
)
322 (when (looking-at "^MIME-Version: 1.0$")
323 (delete-region (point) (progn (forward-line 1) (point))))
325 (with-current-buffer smime-details-buffer
326 (goto-char (point-max))
327 (insert-buffer-substring buffer
))
328 (kill-buffer buffer
))))
330 (defun smime-encrypt-region (b e certfiles
)
331 "Encrypt region for recipients specified in CERTFILES.
332 If encryption fails, the buffer is not modified. Region is assumed to
333 have proper MIME tags. CERTFILES is a list of filenames, each file
334 is expected to contain of a PEM encoded certificate."
335 (smime-new-details-buffer)
336 (let ((buffer (generate-new-buffer (generate-new-buffer-name " *smime*")))
337 (tmpfile (smime-make-temp-file "smime")))
340 (apply 'smime-call-openssl-region b e
(list buffer tmpfile
)
341 "smime" "-encrypt" smime-encrypt-cipher
342 (mapcar 'expand-file-name certfiles
))
343 (with-current-buffer smime-details-buffer
344 (insert-file-contents tmpfile
)
345 (delete-file tmpfile
)))
347 (insert-buffer-substring buffer
)
349 (when (looking-at "^MIME-Version: 1.0$")
350 (delete-region (point) (progn (forward-line 1) (point))))
352 (with-current-buffer smime-details-buffer
353 (goto-char (point-max))
354 (insert-buffer-substring buffer
))
355 (kill-buffer buffer
))))
357 ;; Sign+encrypt buffer
359 (defun smime-sign-buffer (&optional keyfile buffer
)
360 "S/MIME sign BUFFER with key in KEYFILE.
361 KEYFILE should contain a PEM encoded key and certificate."
363 (with-current-buffer (or buffer
(current-buffer))
364 (unless (smime-sign-region
365 (point-min) (point-max)
368 (smime-get-key-with-certs-by-email
370 (concat "Sign using key"
372 (concat " (default " (caar smime-keys
) "): ")
374 smime-keys nil nil
(car-safe (car-safe smime-keys
))))))
375 (error "Signing failed"))))
377 (defun smime-encrypt-buffer (&optional certfiles buffer
)
378 "S/MIME encrypt BUFFER for recipients specified in CERTFILES.
379 CERTFILES is a list of filenames, each file is expected to consist of
380 a PEM encoded key and certificate. Uses current buffer if BUFFER is
383 (with-current-buffer (or buffer
(current-buffer))
384 (unless (smime-encrypt-region
385 (point-min) (point-max)
387 (list (read-file-name "Recipient's S/MIME certificate: "
388 smime-certificate-directory nil
))))
389 (error "Encryption failed"))))
391 ;; Verify+decrypt region
393 (defun smime-verify-region (b e
)
394 "Verify S/MIME message in region between B and E.
395 Returns non-nil on success.
396 Any details (stdout and stderr) are left in the buffer specified by
397 `smime-details-buffer'."
398 (smime-new-details-buffer)
399 (let ((CAs (append (if smime-CA-file
401 (expand-file-name smime-CA-file
)))
402 (if smime-CA-directory
404 (expand-file-name smime-CA-directory
))))))
406 (error "No CA configured"))
408 (add-to-list 'CAs smime-crl-check
))
409 (if (apply 'smime-call-openssl-region b e
(list smime-details-buffer t
)
410 "smime" "-verify" "-out" "/dev/null" CAs
)
412 (insert-buffer-substring smime-details-buffer
)
415 (defun smime-noverify-region (b e
)
416 "Verify integrity of S/MIME message in region between B and E.
417 Returns non-nil on success.
418 Any details (stdout and stderr) are left in the buffer specified by
419 `smime-details-buffer'."
420 (smime-new-details-buffer)
421 (if (apply 'smime-call-openssl-region b e
(list smime-details-buffer t
)
422 "smime" "-verify" "-noverify" "-out" '("/dev/null"))
424 (insert-buffer-substring smime-details-buffer
)
429 (defun smime-decrypt-region (b e keyfile
)
430 "Decrypt S/MIME message in region between B and E with key in KEYFILE.
431 On success, replaces region with decrypted data and return non-nil.
432 Any details (stderr on success, stdout and stderr on error) are left
433 in the buffer specified by `smime-details-buffer'."
434 (smime-new-details-buffer)
435 (let ((buffer (generate-new-buffer (generate-new-buffer-name " *smime*")))
436 CAs
(passphrase (smime-ask-passphrase (expand-file-name keyfile
)))
437 (tmpfile (smime-make-temp-file "smime")))
439 (setenv "GNUS_SMIME_PASSPHRASE" passphrase
))
441 (apply 'smime-call-openssl-region b e
442 (list buffer tmpfile
)
443 "smime" "-decrypt" "-recip" (expand-file-name keyfile
)
445 (list "-passin" "env:GNUS_SMIME_PASSPHRASE")))
447 (setenv "GNUS_SMIME_PASSPHRASE" "" t
))
448 (with-current-buffer smime-details-buffer
449 (insert-file-contents tmpfile
)
450 (delete-file tmpfile
)))
454 ;; `from' is dynamically bound in mm-dissect.
455 (insert "From: " from
"\n"))
456 (insert-buffer-substring buffer
)
459 (with-current-buffer smime-details-buffer
460 (insert-buffer-substring buffer
))
463 (insert-buffer-substring smime-details-buffer
)
466 ;; Verify+Decrypt buffer
468 (defun smime-verify-buffer (&optional buffer
)
469 "Verify integrity of S/MIME message in BUFFER.
470 Uses current buffer if BUFFER is nil. Returns non-nil on success.
471 Any details (stdout and stderr) are left in the buffer specified by
472 `smime-details-buffer'."
474 (with-current-buffer (or buffer
(current-buffer))
475 (smime-verify-region (point-min) (point-max))))
477 (defun smime-noverify-buffer (&optional buffer
)
478 "Verify integrity of S/MIME message in BUFFER.
479 Does NOT verify validity of certificate (only message integrity).
480 Uses current buffer if BUFFER is nil. Returns non-nil on success.
481 Any details (stdout and stderr) are left in the buffer specified by
482 `smime-details-buffer'."
484 (with-current-buffer (or buffer
(current-buffer))
485 (smime-noverify-region (point-min) (point-max))))
487 (defun smime-decrypt-buffer (&optional buffer keyfile
)
488 "Decrypt S/MIME message in BUFFER using KEYFILE.
489 Uses current buffer if BUFFER is nil, and query user of KEYFILE if it's nil.
490 On success, replaces data in buffer and return non-nil.
491 Any details (stderr on success, stdout and stderr on error) are left
492 in the buffer specified by `smime-details-buffer'."
494 (with-current-buffer (or buffer
(current-buffer))
495 (smime-decrypt-region
496 (point-min) (point-max)
499 (smime-get-key-by-email
501 (concat "Decipher using key"
502 (if smime-keys
(concat " (default " (caar smime-keys
) "): ")
504 smime-keys nil nil
(car-safe (car-safe smime-keys
)))))))))
506 ;; Various operations
508 (defun smime-new-details-buffer ()
509 (with-current-buffer (get-buffer-create smime-details-buffer
)
512 (defun smime-pkcs7-region (b e
)
513 "Convert S/MIME message between points B and E into a PKCS7 message."
514 (smime-new-details-buffer)
515 (when (smime-call-openssl-region b e smime-details-buffer
"smime" "-pk7out")
517 (insert-buffer-substring smime-details-buffer
)
520 (defun smime-pkcs7-certificates-region (b e
)
521 "Extract any certificates enclosed in PKCS7 message between points B and E."
522 (smime-new-details-buffer)
523 (when (smime-call-openssl-region
524 b e smime-details-buffer
"pkcs7" "-print_certs" "-text")
526 (insert-buffer-substring smime-details-buffer
)
529 (defun smime-pkcs7-email-region (b e
)
530 "Get email addresses contained in certificate between points B and E.
531 A string or a list of strings is returned."
532 (smime-new-details-buffer)
533 (when (smime-call-openssl-region
534 b e smime-details-buffer
"x509" "-email" "-noout")
536 (insert-buffer-substring smime-details-buffer
)
541 (defun smime-get-certfiles (keyfile keys
)
543 (let ((curkey (car keys
))
544 (otherkeys (cdr keys
)))
545 (if (string= keyfile
(cadr curkey
))
547 (smime-get-certfiles keyfile otherkeys
)))))
549 (defun smime-buffer-as-string-region (b e
)
550 "Return each line in region between B and E as a list of strings."
555 (let ((str (buffer-substring (point) (point-at-eol))))
556 (unless (string= "" str
)
563 (defun smime-mail-to-domain (mailaddr)
564 (if (string-match "@" mailaddr
)
565 (replace-match "." 'fixedcase
'literal mailaddr
)
568 (defun smime-cert-by-dns (mail)
569 "Find certificate via DNS for address MAIL."
570 (let* ((dig-dns-server smime-dns-server
)
571 (digbuf (dig-invoke (smime-mail-to-domain mail
) "cert" nil nil
"+vc"))
572 (retbuf (generate-new-buffer (format "*certificate for %s*" mail
)))
573 (certrr (with-current-buffer digbuf
574 (dig-extract-rr (smime-mail-to-domain mail
) "cert")))
575 (cert (and certrr
(dig-rr-get-pkix-cert certrr
))))
577 (with-current-buffer retbuf
578 (insert "-----BEGIN CERTIFICATE-----\n")
579 (let ((i 0) (len (length cert
)))
580 (while (> (- len
64) i
)
581 (insert (substring cert i
(+ i
64)) "\n")
583 (insert (substring cert i len
) "\n"))
584 (insert "-----END CERTIFICATE-----\n"))
590 (defun smime-cert-by-ldap-1 (mail host
)
591 "Get cetificate for MAIL from the ldap server at HOST."
594 (if (or (featurep 'xemacs
)
595 ;; For Emacs >= 22 we don't need smime-ldap.el
596 (< emacs-major-version
22))
598 (require 'smime-ldap
)
601 (concat "mail=" mail
)
602 host
'("userCertificate") nil
))
603 (retbuf (generate-new-buffer (format "*certificate for %s*" mail
)))
605 (if (and (>= (length ldapresult
) 1)
606 (> (length (cadaar ldapresult
)) 0))
607 (with-current-buffer retbuf
608 ;; Certificates on LDAP servers _should_ be in DER format,
609 ;; but there are some servers out there that distributes the
610 ;; certificates in PEM format (with or without
611 ;; header/footer) so we try to handle them anyway.
612 (if (or (string= (substring (cadaar ldapresult
) 0 27)
613 "-----BEGIN CERTIFICATE-----")
614 (string= (substring (cadaar ldapresult
) 0 3)
617 (smime-replace-in-string
619 (concat "\\(\n\\|\r\\|-----BEGIN CERTIFICATE-----\\|"
620 "-----END CERTIFICATE-----\\)")
622 (setq cert
(base64-encode-string (cadaar ldapresult
) t
)))
623 (insert "-----BEGIN CERTIFICATE-----\n")
624 (let ((i 0) (len (length cert
)))
625 (while (> (- len
64) i
)
626 (insert (substring cert i
(+ i
64)) "\n")
628 (insert (substring cert i len
) "\n"))
629 (insert "-----END CERTIFICATE-----\n"))
634 (defun smime-cert-by-ldap (mail)
635 "Find certificate via LDAP for address MAIL."
636 (if smime-ldap-host-list
638 (dolist (host smime-ldap-host-list
)
639 (let ((retbuf (smime-cert-by-ldap-1 mail host
)))
641 (throw 'certbuf retbuf
)))))))
645 (defvar smime-buffer
"*SMIME*")
647 (defvar smime-mode-map nil
)
648 (put 'smime-mode
'mode-class
'special
)
650 (unless smime-mode-map
651 (setq smime-mode-map
(make-sparse-keymap))
652 (suppress-keymap smime-mode-map
)
654 (define-key smime-mode-map
"q" 'smime-exit
)
655 (define-key smime-mode-map
"f" 'smime-certificate-info
))
658 "Major mode for browsing, viewing and fetching certificates.
660 All normal editing commands are switched off.
663 The following commands are available:
667 (kill-all-local-variables)
668 (setq major-mode
'smime-mode
)
669 (setq mode-name
"SMIME")
670 (setq mode-line-process nil
)
671 (use-local-map smime-mode-map
)
672 (buffer-disable-undo)
673 (setq truncate-lines t
)
674 (setq buffer-read-only t
)
675 (gnus-run-mode-hooks 'smime-mode-hook
))
677 (defun smime-certificate-info (certfile)
678 (interactive "fCertificate file: ")
679 (let ((buffer (get-buffer-create (format "*certificate %s*" certfile
))))
680 (switch-to-buffer buffer
)
682 (call-process smime-openssl-program nil buffer
'display
683 "x509" "-in" (expand-file-name certfile
) "-text")
685 (set-buffer-modified-p nil
)
687 (goto-char (point-min))))
689 (defun smime-draw-buffer ()
690 (with-current-buffer smime-buffer
691 (let (buffer-read-only)
693 (insert "\nYour keys:\n")
694 (dolist (key smime-keys
)
696 (format "\t\t%s: %s\n" (car key
) (cadr key
))))
697 (insert "\nTrusted Certificate Authoritys:\n")
698 (insert "\nKnown Certificates:\n"))))
701 "Go to the SMIME buffer."
703 (unless (get-buffer smime-buffer
)
705 (set-buffer (get-buffer-create smime-buffer
))
708 (switch-to-buffer smime-buffer
))
711 "Quit the S/MIME buffer."
713 (kill-buffer (current-buffer)))
717 (defun smime-get-key-by-email (email)
718 (cadr (assoc email smime-keys
)))
720 (defun smime-get-key-with-certs-by-email (email)
721 (cdr (assoc email smime-keys
)))
725 ;;; arch-tag: e3f9b938-5085-4510-8a11-6625269c9a9e
726 ;;; smime.el ends here