aboutsummaryrefslogtreecommitdiff
path: root/src/data/pgp.lisp
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2022-05-05 08:29:21 -0300
committerSean Whitton <spwhitton@spwhitton.name>2022-05-05 12:26:10 -0700
commit8cfab42bc3a063f48a3934326818f1c5f2ca9721 (patch)
treea59b70aa5fd5ad6d977ad94ff4d727bd65b6ba19 /src/data/pgp.lisp
parent54d75297ea8b190a3b91bd662deb61e670e9f9ef (diff)
downloadconsfigurator-8cfab42bc3a063f48a3934326818f1c5f2ca9721.tar.gz
refactor use of gnupg in CONSFIGURATOR.DATA.PGP
Add a new low level function GPG, and a function GPG-FILE-AS-STRING intended for use in the pgp data source and the future pass(1) data source. Both of these functions support a new parameter *DATA-SOURCE-GNUPGHOME*, which allows the user (or test suite) to control where key material is stored for accessing data sources. Signed-off-by: David Bremner <david@tethera.net>
Diffstat (limited to 'src/data/pgp.lisp')
-rw-r--r--src/data/pgp.lisp19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/data/pgp.lisp b/src/data/pgp.lisp
index ef258d3..d0df280 100644
--- a/src/data/pgp.lisp
+++ b/src/data/pgp.lisp
@@ -51,20 +51,15 @@
(cons #'check #'extract))))
(defun read-store (location)
- (handler-case
- (safe-read-from-string
- (run-program
- (sh-escape (list "gpg" "--decrypt" location)) :output :string))
- (subprocess-error (error)
- (missing-data-source "While attempt to decrypt, gpg exited with ~A"
- (uiop:subprocess-error-code error)))))
+ (safe-read-from-string
+ (gpg-file-as-string location)))
(defun put-store (location data)
- (run-program (list "gpg" "--encrypt")
- :input (make-string-input-stream
- (with-standard-io-syntax
- (prin1-to-string data)))
- :output (unix-namestring location)))
+ (gpg '("--encrypt")
+ :input (make-string-input-stream
+ (with-standard-io-syntax
+ (prin1-to-string data)))
+ :output (unix-namestring location)))
(defun data-assoc (iden1 iden2 data)
(assoc (cons iden1 iden2) data