Track all certificates that are invalid
Return the valid-from/to as a string instead of an integer

The integer might not fit in all Emacs ints
Display the certificate details when querying
Make all TLS/STARTTLS connections go through the security manager

* net/network-stream.el (network-stream-open-starttls): Use the
network security manager.
(network-stream-open-tls): Ditto.
Make IMAP and POP3 warn unless encrypted, and SMTP warn if passwords

* net/network-stream.el (network-stream-open-starttls): Use the
network security manager.
(network-stream-open-tls): Ditto.

* mail/smtpmail.el (smtpmail-via-smtp): Warn unless encrypted if
we're sending a password.
Doc typo fix
Display the certificate more pretty
Clear pending input after reading the char to avoid confusing Emacs
Document the Network Security Manager briefly

* processes.texi (Network): Mention the Network Security Manager.
Have the NSM deny all non-validating connections non-interactively

* net/nsm.el (nsm-query): If running non-interactively, then say
`no' to everything.
Export running_asynch_code to Lisp

* lisp.h: Remove "extern bool running_asynch_code".

* emacs.c (syms_of_emacs): Export running_asynch_code to Lisp so
that functions can tell what context they are being run under.
(nsm-query): Also make asynch code say `no' to everything.
Store (some) host names in the security manager database

(nsm-save-host-names): New variable.
(nsm-save-host): Use it to save host names in the network manager
database.
Format certificates prettier in the NSM

(nsm-format-certificate): Format certificate prettier.  Format
suggested by Toke Høiland-Jørgensen <toke@toke.dk>.
Tweak meaning of self-signed certificates in gnutls

* gnutls.c (Fgnutls_peer_status): SIGNER_NOT_FOUND probably means
:self-signed more than SIGNER_NOT_CA does.
(nsm-check-tls-connection): Make `high' do certificate pinning

(nsm-check-tls-connection): Make `high' do certificate pinning,
and `paranoid' query for every new host.
(nsm-level): New function.
Revert commit 75ccb64a946a6668288aee50508888be392a0e7f

Exporting running_async_code does not help the NSM user interface
(gnutls_certificate_details): Return the public key fingerprint

* gnutls.c (gnutls_certificate_details): Also return the public
key fingerprint.
(Fgnutls_peer_status): Don't return the certificate fingerprint.
NSM: Use the public key hash as the fingerprint

* net/nsm.el (nsm-fingerprint): New function.
(nsm-fingerprint-ok-p): Use the public key hash as the fingerprint
instead of the certificate fingerprint.
NSM exception handling on changed certificates

* net/nsm.el (nsm-fingerprint): New function.
(nsm-fingerprint-ok-p): Use the public key hash as the fingerprint
instead of the certificate fingerprint.
(nsm-fingerprint-ok-p): If the fingerprint changed, then remove
previously accepted warnings.