Function: nsm-format-certificate

nsm-format-certificate is a byte-compiled function defined in nsm.el.gz.

Signature

(nsm-format-certificate STATUS)

Source Code

;; Defined in /usr/src/emacs/lisp/net/nsm.el.gz
(defun nsm-format-certificate (status)
  (let ((cert (plist-get status :certificate)))
    (when cert
      (with-temp-buffer
        (insert
	 (propertize "Certificate information" 'face 'underline) "\n"
	 "  Issued by:"
         (nsm-certificate-part (plist-get cert :issuer) "CN" t) "\n"
	 "  Issued to:"
	 (or (nsm-certificate-part (plist-get cert :subject) "O")
	     (nsm-certificate-part (plist-get cert :subject) "OU" t))
         "\n"
	 "  Hostname:"
	 (nsm-certificate-part (plist-get cert :subject) "CN" t) "\n")
	(when (and (plist-get cert :public-key-algorithm)
		   (plist-get cert :signature-algorithm)
		   (or (plist-get cert :public-key-id-sha256)
		       (plist-get cert :public-key-id)))
	  (insert
	   "  Public key:" (plist-get cert :public-key-algorithm)
	   ", signature: " (plist-get cert :signature-algorithm) "\n"
	   "  Public key ID:" (or (plist-get cert :public-key-id-sha256)
				  (plist-get cert :public-key-id)) "\n"))
        (when (and (plist-get status :key-exchange)
		   (plist-get status :cipher)
		   (plist-get status :mac)
		   (plist-get status :protocol))
	  (insert
	   "  Session:" (plist-get status :protocol)
	   ", key: " (plist-get status :key-exchange)
	   ", cipher: " (plist-get status :cipher)
	   ", mac: " (plist-get status :mac) "\n"))
        (when (plist-get cert :certificate-security-level)
	  (insert
	   "  Security level:"
	   (propertize (plist-get cert :certificate-security-level)
		       'face 'bold)
	   "\n"))
	(insert
	 "  Valid:From " (plist-get cert :valid-from)
	 " to " (plist-get cert :valid-to) "\n")
        (insert "\n")
        (goto-char (point-min))
	(while (re-search-forward "^[^:]+:" nil t)
	  (insert (make-string (- 22 (current-column)) ? )))
	(buffer-string)))))