+(defun elpher-acquire-client-certificate ()
+ "Select and activate a pre-defined client certificate or prompt for one.
+In this case, \"pre-defined\" means a certificate provided by
+the `elpher-certificate-map' variable."
+ (let* ((current-url (elpher-address-to-url (elpher-page-address elpher-current-page)))
+ (entry (assoc current-url
+ elpher-certificate-map
+ #'string-prefix-p)))
+ (if entry
+ (let ((cert-url-regex (car entry))
+ (cert-name (cadr entry)))
+ (message "Using certificate \"%s\" specified in elpher-certificate-map with prefix \"%s\""
+ cert-name cert-url-regex)
+ (elpher-get-existing-certificate cert-name cert-url-regex))
+ (elpher-prompt-for-client-certificate current-url))))
+