diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2020-04-26 23:20:26 +0200 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2020-05-04 09:56:12 +0200 |
| commit | efe1f0122c61b8932671d07419f0200c170a994e (patch) | |
| tree | 970bd488de86bc1009dabc3c64e6d59f7ceeb5c5 /tests/openpgp.scm | |
| parent | 7b2b3a13cc2d9b043f37b2e7ba0f147c08de8fad (diff) | |
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.scm | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/tests/openpgp.scm b/tests/openpgp.scm index 1709167859d..eac2e88f747 100644 --- a/tests/openpgp.scm +++ b/tests/openpgp.scm | |||
| @@ -162,13 +162,15 @@ Pz7oopeN72xgggYUNT37ezqN3MeCqw0= | |||
| 162 | (call-with-input-file key read-radix-64))))) | 162 | (call-with-input-file key read-radix-64))))) |
| 163 | (match (lookup-key-by-id keyring %civodul-key-id) | 163 | (match (lookup-key-by-id keyring %civodul-key-id) |
| 164 | (((? openpgp-public-key? primary) packets ...) | 164 | (((? openpgp-public-key? primary) packets ...) |
| 165 | (and (= (openpgp-public-key-id primary) %civodul-key-id) | 165 | (let ((fingerprint (openpgp-public-key-fingerprint primary))) |
| 166 | (not (openpgp-public-key-subkey? primary)) | 166 | (and (= (openpgp-public-key-id primary) %civodul-key-id) |
| 167 | (string=? (openpgp-format-fingerprint | 167 | (not (openpgp-public-key-subkey? primary)) |
| 168 | (openpgp-public-key-fingerprint primary)) | 168 | (string=? (openpgp-format-fingerprint fingerprint) |
| 169 | %civodul-fingerprint) | 169 | %civodul-fingerprint) |
| 170 | (string=? (openpgp-user-id-value (find openpgp-user-id? packets)) | 170 | (string=? (openpgp-user-id-value (find openpgp-user-id? packets)) |
| 171 | "Ludovic Courtès <ludo@gnu.org>")))))) | 171 | "Ludovic Courtès <ludo@gnu.org>") |
| 172 | (equal? (lookup-key-by-id keyring %civodul-key-id) | ||
| 173 | (lookup-key-by-fingerprint keyring fingerprint)))))))) | ||
| 172 | 174 | ||
| 173 | (test-equal "get-openpgp-detached-signature/ascii" | 175 | (test-equal "get-openpgp-detached-signature/ascii" |
| 174 | (list `(,%dsa-key-id ,%dsa-key-fingerprint dsa sha256) | 176 | (list `(,%dsa-key-id ,%dsa-key-fingerprint dsa sha256) |
