aboutsummaryrefslogtreecommitdiff
path: root/tests/openpgp.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2020-04-26 23:20:26 +0200
committerLudovic Courtès <ludo@gnu.org>2020-05-04 09:56:12 +0200
commitefe1f0122c61b8932671d07419f0200c170a994e (patch)
tree970bd488de86bc1009dabc3c64e6d59f7ceeb5c5 /tests/openpgp.scm
parent7b2b3a13cc2d9b043f37b2e7ba0f147c08de8fad (diff)
downloadguix-efe1f0122c61b8932671d07419f0200c170a994e.tar
guix-efe1f0122c61b8932671d07419f0200c170a994e.tar.gz
openpgp: Add 'lookup-key-by-fingerprint'.
* guix/openpgp.scm (<openpgp-keyring>)[table]: Rename to... [ids]: ... this. [fingerprints]: New field. (keyring-insert, lookup-key-by-fingerprint): New procedures. (%empty-keyring): Adjust. (get-openpgp-keyring): Manipulate KEYRING instead of its vhash, use 'keyring-insert'. * tests/openpgp.scm ("get-openpgp-keyring"): Test 'lookup-key-by-fingerprint'.
Diffstat (limited to 'tests/openpgp.scm')
-rw-r--r--tests/openpgp.scm16
1 files changed, 9 insertions, 7 deletions
diff --git a/tests/openpgp.scm b/tests/openpgp.scm
index 1709167859..eac2e88f74 100644
--- a/tests/openpgp.scm
+++ b/tests/openpgp.scm
@@ -162,13 +162,15 @@ Pz7oopeN72xgggYUNT37ezqN3MeCqw0=
(call-with-input-file key read-radix-64)))))
(match (lookup-key-by-id keyring %civodul-key-id)
(((? openpgp-public-key? primary) packets ...)
- (and (= (openpgp-public-key-id primary) %civodul-key-id)
- (not (openpgp-public-key-subkey? primary))
- (string=? (openpgp-format-fingerprint
- (openpgp-public-key-fingerprint primary))
- %civodul-fingerprint)
- (string=? (openpgp-user-id-value (find openpgp-user-id? packets))
- "Ludovic Courtès <ludo@gnu.org>"))))))
+ (let ((fingerprint (openpgp-public-key-fingerprint primary)))
+ (and (= (openpgp-public-key-id primary) %civodul-key-id)
+ (not (openpgp-public-key-subkey? primary))
+ (string=? (openpgp-format-fingerprint fingerprint)
+ %civodul-fingerprint)
+ (string=? (openpgp-user-id-value (find openpgp-user-id? packets))
+ "Ludovic Courtès <ludo@gnu.org>")
+ (equal? (lookup-key-by-id keyring %civodul-key-id)
+ (lookup-key-by-fingerprint keyring fingerprint))))))))
(test-equal "get-openpgp-detached-signature/ascii"
(list `(,%dsa-key-id ,%dsa-key-fingerprint dsa sha256)