emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/net/tls.el [lexbind]


From: Miles Bader
Subject: [Emacs-diffs] Changes to emacs/lisp/net/tls.el [lexbind]
Date: Mon, 25 Oct 2004 00:43:10 -0400

Index: emacs/lisp/net/tls.el
diff -c emacs/lisp/net/tls.el:1.1.2.3 emacs/lisp/net/tls.el:1.1.2.4
*** emacs/lisp/net/tls.el:1.1.2.3       Thu Sep 16 00:12:22 2004
--- emacs/lisp/net/tls.el       Mon Oct 25 04:19:39 2004
***************
*** 1,6 ****
  ;;; tls.el --- TLS/SSL support via wrapper around GnuTLS
  
! ;; Copyright (C) 2003 Free Software Foundation, Inc.
  
  ;; Author: Simon Josefsson <address@hidden>
  ;; Keywords: comm, tls, gnutls, ssl
--- 1,6 ----
  ;;; tls.el --- TLS/SSL support via wrapper around GnuTLS
  
! ;; Copyright (C) 1996-1999, 2003, 2004 Free Software Foundation, Inc.
  
  ;; Author: Simon Josefsson <address@hidden>
  ;; Keywords: comm, tls, gnutls, ssl
***************
*** 76,81 ****
--- 76,110 ----
    :type 'regexp
    :group 'tls)
  
+ (defcustom tls-certtool-program (executable-find "certtool")
+   "Name of  GnuTLS certtool.
+ Used by `tls-certificate-information'."
+   :type '(repeat string)
+   :group 'tls)
+ 
+ (defun tls-certificate-information (der)
+   "Parse X.509 certificate in DER format into an assoc list."
+   (let ((certificate (concat "-----BEGIN CERTIFICATE-----\n"
+                            (base64-encode-string der)
+                            "\n-----END CERTIFICATE-----\n"))
+       (exit-code 0))
+     (with-current-buffer (get-buffer-create " *certtool*")
+       (erase-buffer)
+       (insert certificate)
+       (setq exit-code (condition-case ()
+                         (call-process-region (point-min) (point-max)
+                                              tls-certtool-program
+                                              t (list (current-buffer) nil) t
+                                              "--certificate-info")
+                       (error -1)))
+       (if (/= exit-code 0)
+         nil
+       (let ((vals nil))
+         (goto-char (point-min))
+         (while (re-search-forward "^\\([^:]+\\): \\(.*\\)" nil t)
+           (push (cons (match-string 1) (match-string 2)) vals))
+         (nreverse vals))))))
+ 
  (defun open-tls-stream (name buffer host service)
    "Open a TLS connection for a service to a host.
  Returns a subprocess-object to represent the connection.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]