From: Marcus Brinkmann Date: Tue, 17 Aug 2004 21:13:20 +0000 (+0000) Subject: 2004-08-17 Marcus Brinkmann X-Git-Tag: gpgme-1-0-0~26 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=6d65ae9632d9c92366f25e51e32c703cea8de8ce;p=gpgme.git 2004-08-17 Marcus Brinkmann * gpgsm/t-keylist.c (struct): Add new fields VALIDITY and KEY_LENGTH. (main): Use them. * gpgsm/t-import.c (check_result): New argument total_stat. (main): Pass this argument. Reduce number of total considered keys to 1 for the second test. --- diff --git a/tests/ChangeLog b/tests/ChangeLog index eb3f3ec..563757c 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,12 @@ +2004-08-17 Marcus Brinkmann + + * gpgsm/t-keylist.c (struct): Add new fields VALIDITY and + KEY_LENGTH. + (main): Use them. + * gpgsm/t-import.c (check_result): New argument total_stat. + (main): Pass this argument. Reduce number of total considered + keys to 1 for the second test. + 2004-04-05 Werner Koch * gpgsm/Makefile.am: Changed the faked system time to 20011213T12000. diff --git a/tests/gpgsm/t-import.c b/tests/gpgsm/t-import.c index 8270492..50737bb 100644 --- a/tests/gpgsm/t-import.c +++ b/tests/gpgsm/t-import.c @@ -35,7 +35,8 @@ void -check_result (gpgme_import_result_t result, char *fpr, int total) +check_result (gpgme_import_result_t result, char *fpr, int total, + int total_stat) { if (result->considered != total) { @@ -124,7 +125,7 @@ check_result (gpgme_import_result_t result, char *fpr, int total) for (n=0, r=result->imports; r; r=r->next) n++; - if (n != total) + if (n != total_stat) { fprintf (stderr, "Unexpected number of status reports\n"); exit (1); @@ -156,7 +157,7 @@ main (int argc, char **argv) err = gpgme_op_import (ctx, in); fail_if_err (err); result = gpgme_op_import_result (ctx); - check_result (result, "DFA56FB5FC41E3A8921F77AD1622EEFD9152A5AD", 1); + check_result (result, "DFA56FB5FC41E3A8921F77AD1622EEFD9152A5AD", 1, 1); gpgme_data_release (in); err = gpgme_data_new_from_file (&in, cert_2, 1); @@ -165,7 +166,7 @@ main (int argc, char **argv) err = gpgme_op_import (ctx, in); fail_if_err (err); result = gpgme_op_import_result (ctx); - check_result (result, "2C8F3C356AB761CB3674835B792CDA52937F9285", 2); + check_result (result, "2C8F3C356AB761CB3674835B792CDA52937F9285", 1, 2); gpgme_data_release (in); gpgme_release (ctx); diff --git a/tests/gpgsm/t-keylist.c b/tests/gpgsm/t-keylist.c index 06aecef..be4e7cc 100644 --- a/tests/gpgsm/t-keylist.c +++ b/tests/gpgsm/t-keylist.c @@ -43,13 +43,17 @@ struct char *issuer_name; char *chain_id; char *uid; + gpgme_validity_t validity; + unsigned int key_length; } keys[] = { { "3CF405464F66ED4A7DF45BBDD1E4282E33BDB76E", 1, 1007372198, 1038908198, "00", "CN=test cert 1,OU=Aegypten Project,O=g10 Code GmbH,L=D\xc3\xbcsseldorf,C=DE", "3CF405464F66ED4A7DF45BBDD1E4282E33BDB76E", - "CN=test cert 1,OU=Aegypten Project,O=g10 Code GmbH,L=D\xc3\xbcsseldorf,C=DE" }, + "CN=test cert 1,OU=Aegypten Project,O=g10 Code GmbH,L=D\xc3\xbcsseldorf,C=DE", + GPGME_VALIDITY_ULTIMATE, 1024 + }, { "DFA56FB5FC41E3A8921F77AD1622EEFD9152A5AD", 0, 909684190, 1009821790, "01", "1.2.840.113549.1.9.1=#63657274696679407063612E64666E2E6465," "CN=DFN Top Level Certification Authority,OU=DFN-PCA," @@ -57,7 +61,9 @@ keys[] = "DFA56FB5FC41E3A8921F77AD1622EEFD9152A5AD", "1.2.840.113549.1.9.1=#63657274696679407063612E64666E2E6465," "CN=DFN Top Level Certification Authority,OU=DFN-PCA," - "O=Deutsches Forschungsnetz,C=DE" }, + "O=Deutsches Forschungsnetz,C=DE", + GPGME_VALIDITY_NEVER, 2048 + }, { "2C8F3C356AB761CB3674835B792CDA52937F9285", 0, 973183644, 1009735200, "15", "1.2.840.113549.1.9.1=#63657274696679407063612E64666E2E6465," "CN=DFN Top Level Certification Authority,OU=DFN-PCA," @@ -65,7 +71,9 @@ keys[] = "DFA56FB5FC41E3A8921F77AD1622EEFD9152A5AD", "1.2.840.113549.1.9.1=#63657274696679407063612E64666E2E6465," "CN=DFN Server Certification Authority,OU=DFN-PCA," - "O=Deutsches Forschungsnetz,C=DE" }, + "O=Deutsches Forschungsnetz,C=DE", + GPGME_VALIDITY_UNKNOWN, 2048 + }, { NULL } }; @@ -246,7 +254,7 @@ main (int argc, char **argv) gpgme_pubkey_algo_name (key->subkeys->pubkey_algo)); exit (1); } - if (key->subkeys->length != 1024) + if (key->subkeys->length != keys[i].key_length) { fprintf (stderr, "Primary key has unexpected length: %i\n", key->subkeys->length); @@ -292,7 +300,7 @@ main (int argc, char **argv) fprintf (stderr, "User ID unexpectedly invalid\n"); exit (1); } - if (key->uids->validity != GPGME_VALIDITY_UNKNOWN) + if (key->uids->validity != keys[i].validity) { fprintf (stderr, "User ID unexpectedly validity: %i\n", key->uids->validity);