diff --git a/npa/src/npa-tool.c b/npa/src/npa-tool.c index bfa6535..34dc521 100644 --- a/npa/src/npa-tool.c +++ b/npa/src/npa-tool.c @@ -287,6 +287,8 @@ main (int argc, char **argv) size_t privkey_len = 0; unsigned char auxiliary_data[0xff]; size_t auxiliary_data_len = 0; + unsigned char community_id[0xf]; + size_t community_id_len = 0; sc_context_t *ctx = NULL; sc_card_t *card = NULL; @@ -605,10 +607,15 @@ main (int argc, char **argv) goto err; } if (cmdline.verify_community_given) { + community_id_len = sizeof community_id; + if (sc_hex_to_bin(cmdline.verify_community_arg, community_id, + &community_id_len) < 0) { + fprintf(stderr, "Could not parse community ID.\n"); + exit(2); + } r = add_to_ASN1_AUXILIARY_DATA(&templates, NID_id_CommunityID, - (unsigned char *) cmdline.verify_community_arg, - strlen(cmdline.verify_community_arg)); + community_id, community_id_len); if (r < 0) goto err; } diff --git a/npa/src/npa-tool.ggo.in b/npa/src/npa-tool.ggo.in index d464919..2df8c08 100644 --- a/npa/src/npa-tool.ggo.in +++ b/npa/src/npa-tool.ggo.in @@ -69,7 +69,7 @@ option "chat" - typestr="HEX_STRING" optional option "auxiliary-data" A - "Terminal's auxiliary data (default is determined by age verification and community id verification)." + "Terminal's auxiliary data (default is determined by verification of validity, age and community ID)." string typestr="HEX_STRING" optional @@ -189,7 +189,7 @@ option "write-dg21" - section "Verification of validity, age and community ID" option "verify-validity" - - "Verify the chip's validity with a reference date" + "Verify chip's validity with a reference date" string typestr="YYYYMMDD" optional @@ -201,6 +201,7 @@ option "older-than" - option "verify-community" - "Verify community ID with a reference ID" string + typestr="HEX_STRING" optional section "Special options, not always useful"