diff options
author | Ludovic Courtès <ludo@gnu.org> | 2013-12-30 22:46:21 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2013-12-30 22:57:37 +0100 |
commit | 554f26ece3c6e3fb04d8069e6be1095e622a97c5 (patch) | |
tree | 4a64678b2f1c34c72a53e84264ca56a09b34c72c /guix/pk-crypto.scm | |
parent | dedb5d947ee2890524a5c6fb1343b3299e7731c3 (diff) | |
download | guix-patches-554f26ece3c6e3fb04d8069e6be1095e622a97c5.tar guix-patches-554f26ece3c6e3fb04d8069e6be1095e622a97c5.tar.gz |
archive: Add '--generate-key'.
* guix/pk-crypto.scm (error-source, error-string): New procedures.
* guix/pki.scm (%private-key-file): New variable.
* guix/scripts/archive.scm (show-help): Document '--generate-key'.
(%options): Add "generate-key".
(generate-key-pair): New procedure.
(guix-archive): Call 'generate-key' when OPTS contains a
'generate-key' pair.
* doc/guix.texi (Setting Up the Daemon): Suggest generating a key pair.
(Invoking guix archive): Document '--generate-key'.
Diffstat (limited to 'guix/pk-crypto.scm')
-rw-r--r-- | guix/pk-crypto.scm | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/guix/pk-crypto.scm b/guix/pk-crypto.scm index d5b3eeb350..50f709418c 100644 --- a/guix/pk-crypto.scm +++ b/guix/pk-crypto.scm @@ -25,6 +25,8 @@ #:use-module (rnrs bytevectors) #:use-module (ice-9 match) #:export (canonical-sexp? + error-source + error-string string->canonical-sexp canonical-sexp->string number->canonical-sexp @@ -98,6 +100,22 @@ (set-pointer-finalizer! ptr finalize-canonical-sexp!)) sexp)) +(define error-source + (let* ((ptr (libgcrypt-func "gcry_strsource")) + (proc (pointer->procedure '* ptr (list int)))) + (lambda (err) + "Return the error source (a string) for ERR, an error code as thrown +along with 'gcry-error'." + (pointer->string (proc err))))) + +(define error-string + (let* ((ptr (libgcrypt-func "gcry_strerror")) + (proc (pointer->procedure '* ptr (list int)))) + (lambda (err) + "Return the error description (a string) for ERR, an error code as +thrown along with 'gcry-error'." + (pointer->string (proc err))))) + (define string->canonical-sexp (let* ((ptr (libgcrypt-func "gcry_sexp_new")) (proc (pointer->procedure int ptr `(* * ,size_t ,int)))) |