plstore

Homepage: https://www.gnu.org/software/emacs

Author: Daiki Ueno

Summary

Secure plist store

Commentary

Plist based data store providing search and partial encryption.

Creating:

;; Open a new store associated with ~/.emacs.d/auth.plist.
(setq store (plstore-open (expand-file-name "~/.emacs.d/auth.plist")))
;; Both `:host' and `:port' are public property.
(plstore-put store "foo" '(:host "foo.example.org" :port 80) nil)
;; No encryption will be needed.
(plstore-save store)

;; `:user' is marked as secret.
(plstore-put store "bar" '(:host "bar.example.org") '(:user "test"))
;; `:password' is marked as secret.
(plstore-put store "baz" '(:host "baz.example.org") '(:password "test"))
;; Those secret properties are encrypted together.
(plstore-save store)

;; Kill the buffer visiting ~/.emacs.d/auth.plist.
(plstore-close store)

Searching:

(setq store (plstore-open (expand-file-name "~/.emacs.d/auth.plist")))

;; As the entry "foo" associated with "foo.example.org" has no
;; secret properties, no need to decryption.
(plstore-find store '(:host ("foo.example.org")))

;; As the entry "bar" associated with "bar.example.org" has a
;; secret property `:user', Emacs tries to decrypt the secret (and
;; thus you will need to input passphrase).
(plstore-find store '(:host ("bar.example.org")))

;; While the entry "baz" associated with "baz.example.org" has also
;; a secret property `:password', it is encrypted together with
;; `:user' of "bar", so no need to decrypt the secret.
(plstore-find store '(:host ("bar.example.org")))

(plstore-close store)

Editing:

This file also provides `plstore-mode', a major mode for editing
the PLSTORE format file.  Visit a non-existing file and put the
following line:

(("foo" :host "foo.example.org" :secret-user "user"))

where the prefixing `:secret-' means the property (without
`:secret-' prefix) is marked as secret.  Thus, when you save the
buffer, the `:secret-user' property is encrypted as `:user'.

You can toggle the view between encrypted form and the decrypted
form with C-c C-c.

Dependencies

Reverse dependencies