gnu: hss: Edit description.
[jackhill/guix/guix.git] / tests / openpgp.scm
index cc5e6cb..0beab6f 100644 (file)
@@ -160,17 +160,17 @@ Pz7oopeN72xgggYUNT37ezqN3MeCqw0=
          (keyring (get-openpgp-keyring
                    (open-bytevector-input-port
                     (call-with-input-file key read-radix-64)))))
-    (match (lookup-key-by-id keyring %civodul-key-id)
-      (((? openpgp-public-key? primary) packets ...)
-       (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))))))))
+    (let-values (((primary packets)
+                  (lookup-key-by-id keyring %civodul-key-id)))
+      (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>")
+             (eq? (lookup-key-by-fingerprint keyring fingerprint)
+                  primary))))))
 
 (test-equal "get-openpgp-detached-signature/ascii"
   (list `(,%dsa-key-id ,%dsa-key-fingerprint dsa sha256)
@@ -194,10 +194,7 @@ Pz7oopeN72xgggYUNT37ezqN3MeCqw0=
 (test-equal "verify-openpgp-signature, missing key"
   `(missing-key ,%rsa-key-fingerprint)
   (let* ((keyring   (get-openpgp-keyring (%make-void-port "r")))
-         (signature (get-openpgp-packet
-                     (open-bytevector-input-port
-                      (call-with-input-string %hello-signature/rsa
-                        read-radix-64)))))
+         (signature (string->openpgp-packet %hello-signature/rsa)))
     (let-values (((status key)
                   (verify-openpgp-signature signature keyring
                                             (open-input-string "Hello!\n"))))
@@ -214,10 +211,7 @@ Pz7oopeN72xgggYUNT37ezqN3MeCqw0=
                 (keyring   (get-openpgp-keyring
                             (open-bytevector-input-port
                              (call-with-input-file key read-radix-64))))
-                (signature (get-openpgp-packet
-                            (open-bytevector-input-port
-                             (call-with-input-string signature
-                               read-radix-64)))))
+                (signature (string->openpgp-packet signature)))
            (let-values (((status key)
                          (verify-openpgp-signature signature keyring
                                                    (open-input-string "Hello!\n"))))
@@ -246,10 +240,7 @@ Pz7oopeN72xgggYUNT37ezqN3MeCqw0=
                          "tests/ed25519.key" "tests/ed25519.key"
                          "tests/ed25519.key"))))
     (map (lambda (signature)
-           (let ((signature (get-openpgp-packet
-                             (open-bytevector-input-port
-                              (call-with-input-string signature
-                                read-radix-64)))))
+           (let ((signature (string->openpgp-packet signature)))
              (let-values (((status key)
                            (verify-openpgp-signature signature keyring
                                                      (open-input-string "What?!"))))