accept a hex string for community id

This commit is contained in:
Frank Morgner
2013-02-27 21:31:21 +01:00
parent 4f7851d03c
commit 9be74c7886
2 changed files with 12 additions and 4 deletions

View File

@@ -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;
}

View File

@@ -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"