Function: plstore--insert-buffer
plstore--insert-buffer is a byte-compiled function defined in
plstore.el.gz.
Signature
(plstore--insert-buffer PLSTORE)
Documentation
Insert the file representation of PLSTORE at point.
Source Code
;; Defined in /usr/src/emacs/lisp/plstore.el.gz
(defun plstore--insert-buffer (plstore)
"Insert the file representation of PLSTORE at point."
(insert ";;; public entries -*- mode: plstore -*- \n"
(pp-to-string (plstore--get-alist plstore)))
(let ((pp-escape-newlines nil)
(cipher nil))
(cond
;; Reuse the encrypted data as cipher text if this store has not
;; been decrypted yet.
((plstore--get-encrypted-data plstore)
(setq cipher (plstore--get-encrypted-data plstore)))
;; Encrypt the secret alist to generate the cipher text.
((plstore--get-secret-alist plstore)
(let ((context (epg-make-context 'OpenPGP))
(recipients
(cond
((listp plstore-encrypt-to) plstore-encrypt-to)
((stringp plstore-encrypt-to) (list plstore-encrypt-to)))))
(setf (epg-context-armor context) t)
(epg-context-set-passphrase-callback
context
(cons #'plstore-passphrase-callback-function
plstore))
(setq cipher (epg-encrypt-string
context
(pp-to-string
(plstore--get-secret-alist plstore))
(if (or (eq plstore-select-keys t)
(and (null plstore-select-keys)
(not (local-variable-p 'plstore-encrypt-to
(current-buffer)))))
(epa-select-keys
context
"Select recipients for encryption.
If no one is selected, symmetric encryption will be performed. "
recipients)
(if plstore-encrypt-to
(epg-list-keys context recipients))))))))
(when cipher
(goto-char (point-max))
(insert ";;; secret entries\n" (pp-to-string cipher)))))