pk-crypto: Improve docstring of signature-related procedures.
* guix/pk-crypto.scm (bytevector->hash-data, sign): Augment docstring.
This commit is contained in:
parent
fcdebadf39
commit
828c0bec6b
|
@ -1,5 +1,5 @@
|
||||||
;;; GNU Guix --- Functional package management for GNU
|
;;; GNU Guix --- Functional package management for GNU
|
||||||
;;; Copyright © 2013, 2014 Ludovic Courtès <ludo@gnu.org>
|
;;; Copyright © 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
;;;
|
;;;
|
||||||
|
@ -254,9 +254,9 @@ (define* (bytevector->hash-data bv
|
||||||
#:optional
|
#:optional
|
||||||
(hash-algo "sha256")
|
(hash-algo "sha256")
|
||||||
#:key (key-type 'ecc))
|
#:key (key-type 'ecc))
|
||||||
"Given BV, a bytevector containing a hash, return an s-expression suitable
|
"Given BV, a bytevector containing a hash of type HASH-ALGO, return an
|
||||||
for use as the data for 'sign'. KEY-TYPE must be a symbol: 'dsa, 'ecc, or
|
s-expression suitable for use as the 'data' argument for 'sign'. KEY-TYPE
|
||||||
'rsa."
|
must be a symbol: 'dsa, 'ecc, or 'rsa."
|
||||||
(string->canonical-sexp
|
(string->canonical-sexp
|
||||||
(format #f "(data (flags ~a) (hash \"~a\" #~a#))"
|
(format #f "(data (flags ~a) (hash \"~a\" #~a#))"
|
||||||
(case key-type
|
(case key-type
|
||||||
|
@ -289,8 +289,10 @@ (define sign
|
||||||
(let* ((ptr (libgcrypt-func "gcry_pk_sign"))
|
(let* ((ptr (libgcrypt-func "gcry_pk_sign"))
|
||||||
(proc (pointer->procedure int ptr '(* * *))))
|
(proc (pointer->procedure int ptr '(* * *))))
|
||||||
(lambda (data secret-key)
|
(lambda (data secret-key)
|
||||||
"Sign DATA (an s-expression) with SECRET-KEY (an s-expression whose car
|
"Sign DATA, a canonical s-expression representing a suitable hash, with
|
||||||
is 'private-key'.)"
|
SECRET-KEY (a canonical s-expression whose car is 'private-key'.) Note that
|
||||||
|
DATA must be a 'data' s-expression, as returned by
|
||||||
|
'bytevector->hash-data' (info \"(gcrypt) Cryptographic Functions\")."
|
||||||
(let* ((sig (bytevector->pointer (make-bytevector (sizeof '*))))
|
(let* ((sig (bytevector->pointer (make-bytevector (sizeof '*))))
|
||||||
(err (proc sig (canonical-sexp->pointer data)
|
(err (proc sig (canonical-sexp->pointer data)
|
||||||
(canonical-sexp->pointer secret-key))))
|
(canonical-sexp->pointer secret-key))))
|
||||||
|
|
Loading…
Reference in a new issue