summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2020-04-30 15:56:54 +0200
committerLudovic Courtès <ludo@gnu.org>2020-05-04 09:56:13 +0200
commitb835e158d51c873a99367afd27f3d57cfe92e10e (patch)
tree8171de07c5efe95411327208aa7990286aabf69e /tests
parentbd8126558dc7a022d7853d803d7134ffa1b7bc52 (diff)
downloadpatches-b835e158d51c873a99367afd27f3d57cfe92e10e.tar
patches-b835e158d51c873a99367afd27f3d57cfe92e10e.tar.gz
openpgp: Add 'string->openpgp-packet'.
* guix/openpgp.scm (string->openpgp-packet): New procedure. * tests/openpgp.scm ("verify-openpgp-signature, missing key") ("verify-openpgp-signature, good signatures") ("verify-openpgp-signature, bad signature"): Use it.
Diffstat (limited to 'tests')
-rw-r--r--tests/openpgp.scm15
1 files changed, 3 insertions, 12 deletions
diff --git a/tests/openpgp.scm b/tests/openpgp.scm
index a85fe6a6cb..0beab6f88b 100644
--- a/tests/openpgp.scm
+++ b/tests/openpgp.scm
@@ -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?!"))))