Function: auth-source--obfuscate
auth-source--obfuscate is a byte-compiled function defined in
auth-source.el.gz.
Signature
(auth-source--obfuscate STRING)
Source Code
;; Defined in /usr/src/emacs/lisp/auth-source.el.gz
(defun auth-source--obfuscate (string)
;; We want to keep passwords out of backtraces and bug reports and
;; the like, so if we have GnuTLS available, we encrypt them with a
;; nonce that we just keep in memory. If somebody has access to the
;; current Emacs session, they can be decrypted, but if not, little
;; useful information is leaked. If you reset the nonce, you also
;; have to call `auth-source-forget-all-cached'.
(unless auth-source--session-nonce
(setq auth-source--session-nonce
(apply #'string (cl-loop repeat 16
collect (random 128)))))
(if (and (fboundp 'gnutls-symmetric-encrypt)
(gnutls-available-p))
(let ((cdata (car (last (gnutls-ciphers)))))
(mapconcat
#'base64-encode-string
(gnutls-symmetric-encrypt
(pop cdata)
(auth-source--pad auth-source--session-nonce
(plist-get cdata :cipher-keysize))
(list 'iv-auto (plist-get cdata :cipher-ivsize))
(auth-source--pad (encode-coding-string string 'utf-8)
(plist-get cdata :cipher-blocksize)))
"-"))
(mapcar #'1- string)))