diff options
| author | Attila Lendvai <attila@lendvai.name> | 2021-12-21 22:56:10 +0100 |
|---|---|---|
| committer | Mathieu Othacehe <othacehe@gnu.org> | 2021-12-22 10:53:19 +0100 |
| commit | 9ebc9ca070a21ba0aeb3f61202a8071bb250ccc8 (patch) | |
| tree | f29313e0c83112cf7aceeec893f1ee68135af78b /tests/openpgp.scm | |
| parent | 5b8ae331f73d970e29566b82c9fe36aa0d77ccb7 (diff) | |
tests: Move keys into ./tests/keys/ and add a third ed25519 key.
The third key will be used in an upcoming commit.
Rename public keys to .pub.
* guix/tests/gnupg.scm (%ed25519-3-public-key-file): New variable.
(%ed25519-3-secret-key-file): New variable.
(%ed25519-2-public-key-file): Renamed from %ed25519bis-public-key-file.
(%ed25519-2-secret-key-file): Renamed from %ed25519bis-secret-key-file.
* tests/keys/ed25519-3.key: New file.
* tests/keys/ed25519-3.sec: New file.
Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
Diffstat (limited to 'tests/openpgp.scm')
| -rw-r--r-- | tests/openpgp.scm | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/tests/openpgp.scm b/tests/openpgp.scm index c2be26fa493..1f204667721 100644 --- a/tests/openpgp.scm +++ b/tests/openpgp.scm | |||
| @@ -59,18 +59,22 @@ vBSFjNSiVHsuAA== | |||
| 59 | (define %civodul-fingerprint | 59 | (define %civodul-fingerprint |
| 60 | "3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5") | 60 | "3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5") |
| 61 | 61 | ||
| 62 | (define %civodul-key-id #x090B11993D9AEBB5) ;civodul.key | 62 | (define %civodul-key-id #x090B11993D9AEBB5) ;civodul.pub |
| 63 | 63 | ||
| 64 | ;; Test keys. They were generated in a container along these lines: | 64 | #| |
| 65 | ;; guix environment -CP --ad-hoc gnupg pinentry | 65 | Test keys in ./tests/keys. They were generated in a container along these lines: |
| 66 | ;; then, within the container: | 66 | guix environment -CP --ad-hoc gnupg pinentry coreutils |
| 67 | ;; mkdir ~/.gnupg | 67 | then, within the container: |
| 68 | ;; echo pinentry-program ~/.guix-profile/bin/pinentry-tty > ~/.gnupg/gpg-agent.conf | 68 | mkdir ~/.gnupg && chmod -R og-rwx ~/.gnupg |
| 69 | ;; gpg --quick-gen-key '<ludo+test-rsa@chbouib.org>' rsa | 69 | gpg --batch --passphrase '' --quick-gen-key '<example@example.com>' ed25519 |
| 70 | ;; or similar. | 70 | gpg --armor --export example@example.com |
| 71 | (define %rsa-key-id #xAE25DA2A70DEED59) ;rsa.key | 71 | gpg --armor --export-secret-key example@example.com |
| 72 | (define %dsa-key-id #x587918047BE8BD2C) ;dsa.key | 72 | # echo pinentry-program ~/.guix-profile/bin/pinentry-curses > ~/.gnupg/gpg-agent.conf |
| 73 | (define %ed25519-key-id #x771F49CBFAAE072D) ;ed25519.key | 73 | or similar. |
| 74 | |# | ||
| 75 | (define %rsa-key-id #xAE25DA2A70DEED59) ;rsa.pub | ||
| 76 | (define %dsa-key-id #x587918047BE8BD2C) ;dsa.pub | ||
| 77 | (define %ed25519-key-id #x771F49CBFAAE072D) ;ed25519.pub | ||
| 74 | 78 | ||
| 75 | (define %rsa-key-fingerprint | 79 | (define %rsa-key-fingerprint |
| 76 | (base16-string->bytevector | 80 | (base16-string->bytevector |
| @@ -168,7 +172,7 @@ Pz7oopeN72xgggYUNT37ezqN3MeCqw0= | |||
| 168 | (not (port-ascii-armored? (open-bytevector-input-port %binary-sample)))) | 172 | (not (port-ascii-armored? (open-bytevector-input-port %binary-sample)))) |
| 169 | 173 | ||
| 170 | (test-assert "get-openpgp-keyring" | 174 | (test-assert "get-openpgp-keyring" |
| 171 | (let* ((key (search-path %load-path "tests/civodul.key")) | 175 | (let* ((key (search-path %load-path "tests/keys/civodul.pub")) |
| 172 | (keyring (get-openpgp-keyring | 176 | (keyring (get-openpgp-keyring |
| 173 | (open-bytevector-input-port | 177 | (open-bytevector-input-port |
| 174 | (call-with-input-file key read-radix-64))))) | 178 | (call-with-input-file key read-radix-64))))) |
| @@ -228,8 +232,10 @@ Pz7oopeN72xgggYUNT37ezqN3MeCqw0= | |||
| 228 | (verify-openpgp-signature signature keyring | 232 | (verify-openpgp-signature signature keyring |
| 229 | (open-input-string "Hello!\n")))) | 233 | (open-input-string "Hello!\n")))) |
| 230 | (list status (openpgp-public-key-id key))))) | 234 | (list status (openpgp-public-key-id key))))) |
| 231 | (list "tests/rsa.key" "tests/dsa.key" | 235 | (list "tests/keys/rsa.pub" "tests/keys/dsa.pub" |
| 232 | "tests/ed25519.key" "tests/ed25519.key" "tests/ed25519.key") | 236 | "tests/keys/ed25519.pub" |
| 237 | "tests/keys/ed25519.pub" | ||
| 238 | "tests/keys/ed25519.pub") | ||
| 233 | (list %hello-signature/rsa %hello-signature/dsa | 239 | (list %hello-signature/rsa %hello-signature/dsa |
| 234 | %hello-signature/ed25519/sha256 | 240 | %hello-signature/ed25519/sha256 |
| 235 | %hello-signature/ed25519/sha512 | 241 | %hello-signature/ed25519/sha512 |
| @@ -248,9 +254,9 @@ Pz7oopeN72xgggYUNT37ezqN3MeCqw0= | |||
| 248 | (call-with-input-file key read-radix-64)) | 254 | (call-with-input-file key read-radix-64)) |
| 249 | keyring))) | 255 | keyring))) |
| 250 | %empty-keyring | 256 | %empty-keyring |
| 251 | '("tests/rsa.key" "tests/dsa.key" | 257 | '("tests/keys/rsa.pub" "tests/keys/dsa.pub" |
| 252 | "tests/ed25519.key" "tests/ed25519.key" | 258 | "tests/keys/ed25519.pub" "tests/keys/ed25519.pub" |
| 253 | "tests/ed25519.key")))) | 259 | "tests/keys/ed25519.pub")))) |
| 254 | (map (lambda (signature) | 260 | (map (lambda (signature) |
| 255 | (let ((signature (string->openpgp-packet signature))) | 261 | (let ((signature (string->openpgp-packet signature))) |
| 256 | (let-values (((status key) | 262 | (let-values (((status key) |
