Function: plstore--decrypt

plstore--decrypt is a byte-compiled function defined in plstore.el.gz.

Signature

(plstore--decrypt PLSTORE)

Documentation

Decrypt the encrypted data of PLSTORE.

Update its internal alists and other data structures accordingly.

Source Code

;; Defined in /usr/src/emacs/lisp/plstore.el.gz
(defun plstore--decrypt (plstore)
  "Decrypt the encrypted data of PLSTORE.
Update its internal alists and other data structures
accordingly."
  (if (plstore--get-encrypted-data plstore)
      (let ((context (epg-make-context 'OpenPGP))
	    plain)
	(epg-context-set-passphrase-callback
	 context
	 (cons #'plstore-passphrase-callback-function
	       plstore))
	(epg-context-set-progress-callback
	 context
	 (cons #'plstore-progress-callback-function
	       (format "Decrypting %s" (plstore-get-file plstore))))
	(condition-case error
	    (setq plain
		  (epg-decrypt-string context
				      (plstore--get-encrypted-data plstore)))
	  (error
	   (let ((entry (assoc (plstore-get-file plstore)
			       plstore-passphrase-alist)))
	     (if entry
		 (setcdr entry nil)))
	   (signal error)))
	(plstore--set-secret-alist plstore (car (read-from-string plain)))
	(plstore--merge-secret plstore)
	(plstore--set-encrypted-data plstore nil))))