diff options
author | Justus Winter <[email protected]> | 2016-12-13 15:30:47 +0000 |
---|---|---|
committer | Justus Winter <[email protected]> | 2016-12-13 15:35:08 +0000 |
commit | dd3dde07a9a46130ac01d849f8edf0566e44f11f (patch) | |
tree | 5a80f57d3c2ba6eb403af9fc492af23c69dd4a89 /tests/openpgp/quick-key-manipulation.scm | |
parent | gpgscm: Print failed and skipped tests. (diff) | |
download | gnupg-dd3dde07a9a46130ac01d849f8edf0566e44f11f.tar.gz gnupg-dd3dde07a9a46130ac01d849f8edf0566e44f11f.zip |
g10: Create expiring keys in quick key generation mode.
* doc/gpg.texi: Document that fact.
* g10/keygen.c (quick_generate_keypair): Use a default value.
* tests/openpgp/quick-key-manipulation.scm: Test that fact.
GnuPG-bug-id: 2701
Signed-off-by: Justus Winter <[email protected]>
Diffstat (limited to 'tests/openpgp/quick-key-manipulation.scm')
-rwxr-xr-x | tests/openpgp/quick-key-manipulation.scm | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/tests/openpgp/quick-key-manipulation.scm b/tests/openpgp/quick-key-manipulation.scm index 360c48e69..639fd6256 100755 --- a/tests/openpgp/quick-key-manipulation.scm +++ b/tests/openpgp/quick-key-manipulation.scm @@ -27,6 +27,13 @@ (define (exact id) (string-append "=" id)) +;; Convenient accessors for the colon output. +(define (:length x) (string->number (list-ref x 2))) +(define (:alg x) (string->number (list-ref x 3))) +(define (:expire x) (list-ref x 6)) +(define (:fpr x) (list-ref x 9)) +(define (:cap x) (list-ref x 11)) + (define (count-uids-of-secret-key id) (length (filter (lambda (x) (and (string=? "uid" (car x)) (not (string=? "r" (cadr x))))) @@ -47,10 +54,11 @@ (info "Checking quick key generation...") (call-check `(,@GPG --quick-gen-key ,alpha)) -(assert (= 1 (count-uids-of-secret-key alpha))) +(define keyinfo (gpg-with-colons `(-k ,(exact alpha)))) +(define fpr (:fpr (assoc "fpr" keyinfo))) -(define fpr (list-ref (assoc "fpr" (gpg-with-colons `(-k ,(exact alpha)))) - 9)) +(assert (= 1 (count-uids-of-secret-key alpha))) +(assert (not (equal? "" (:expire (assoc "pub" keyinfo))))) (info "Checking that we can add a user ID...") @@ -82,11 +90,10 @@ (info "Checking that we can change the expiration time.") (define (expiration-time id) - (list-ref (assoc "pub" (gpg-with-colons `(-k ,id))) - 6)) + (:expire (assoc "pub" (gpg-with-colons `(-k ,id))))) -;; XXX This assumes that by default keys are created without -;; expiration date. See issue2701. +;; Remove the expiration date. +(call-check `(,@gpg --quick-set-expire ,fpr "0")) (assert (equal? "" (expiration-time fpr))) ;; Make the key expire in one year. @@ -94,10 +101,6 @@ ;; XXX It'd be nice to check that the value is right. (assert (not (equal? "" (expiration-time fpr)))) -;; And remove the expiration date. -(call-check `(,@gpg --quick-set-expire ,fpr "0")) -(assert (equal? "" (expiration-time fpr))) - ;; ;; Check --quick-addkey @@ -111,12 +114,6 @@ ;; This keeps track of the number of subkeys. (define count (length (get-subkeys))) -;; Convenient accessors for the colon output. -(define (:length x) (string->number (list-ref x 2))) -(define (:alg x) (string->number (list-ref x 3))) -(define (:expire x) (list-ref x 6)) -(define (:cap x) (list-ref x 11)) - (for-each-p "Checking that we can add subkeys..." (lambda (args check) |