Function: imap-cram-md5-auth

imap-cram-md5-auth is a byte-compiled function defined in imap.el.gz.

Signature

(imap-cram-md5-auth BUFFER)

Documentation

Login to server using the AUTH CRAM-MD5 method.

Source Code

;; Defined in /usr/src/emacs/lisp/net/imap.el.gz
(defun imap-cram-md5-auth (buffer)
  "Login to server using the AUTH CRAM-MD5 method."
  (message "imap: Authenticating using CRAM-MD5...")
  (let ((done (imap-interactive-login
	       buffer
	       (lambda (user passwd)
		 (imap-ok-p
		  (imap-send-command-wait
		   (list
		    "AUTHENTICATE CRAM-MD5"
		    (lambda (challenge)
		      (let* ((decoded (base64-decode-string challenge))
			     (hash (rfc2104-hash 'md5 64 16 passwd decoded))
			     (response (concat user " " hash))
			     (encoded (base64-encode-string response)))
			encoded)))))))))
    (if done
	(message "imap: Authenticating using CRAM-MD5...done")
      (message "imap: Authenticating using CRAM-MD5...failed"))))