Allow specifying application name for data objects at pkcs15-init.
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3403 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
parent
1875a25c40
commit
741330ba19
|
@ -122,6 +122,7 @@ enum {
|
|||
OPT_SECRET,
|
||||
OPT_PUBKEY_LABEL,
|
||||
OPT_CERT_LABEL,
|
||||
OPT_APPLICATION_NAME,
|
||||
OPT_APPLICATION_ID,
|
||||
|
||||
OPT_PIN1 = 0x10000, /* don't touch these values */
|
||||
|
@ -158,6 +159,7 @@ const struct option options[] = {
|
|||
{ "label", required_argument, NULL, 'l' },
|
||||
{ "public-key-label", required_argument, NULL, OPT_PUBKEY_LABEL },
|
||||
{ "cert-label", required_argument, NULL, OPT_CERT_LABEL },
|
||||
{ "application-name", required_argument, NULL, OPT_APPLICATION_NAME },
|
||||
{ "application-id", required_argument, NULL, OPT_APPLICATION_ID },
|
||||
{ "output-file", required_argument, NULL, 'o' },
|
||||
{ "format", required_argument, NULL, 'f' },
|
||||
|
@ -211,6 +213,7 @@ static const char * option_help[] = {
|
|||
"Specify label of PIN/key",
|
||||
"Specify public key label (use with --generate-key)",
|
||||
"Specify user cert label (use with --store-private-key)",
|
||||
"Specify application name of data object (use with --store-data-object)",
|
||||
"Specify application id of data object (use with --store-data-object)",
|
||||
"Output public portion of generated key to file",
|
||||
"Specify key/cert file format: PEM (=default), DER or PKCS12",
|
||||
|
@ -318,6 +321,7 @@ static char * opt_passphrase = NULL;
|
|||
static char * opt_newkey = NULL;
|
||||
static char * opt_outkey = NULL;
|
||||
static char * opt_application_id = NULL;
|
||||
static char * opt_application_name = NULL;
|
||||
static unsigned int opt_x509_usage = 0;
|
||||
static unsigned int opt_delete_flags = 0;
|
||||
static unsigned int opt_type = 0;
|
||||
|
@ -1070,7 +1074,7 @@ do_store_data_object(struct sc_profile *profile)
|
|||
if (opt_authid)
|
||||
sc_pkcs15_format_id(opt_authid, &args.auth_id);
|
||||
args.label = opt_label;
|
||||
args.app_label = "pkcs15-init";
|
||||
args.app_label = opt_application_name ? opt_application_name : "pkcs15-init";
|
||||
|
||||
sc_format_oid(&args.app_oid, opt_application_id);
|
||||
|
||||
|
@ -2425,6 +2429,9 @@ handle_option(const struct option *opt)
|
|||
case OPT_SOFT_KEYGEN:
|
||||
opt_softkeygen = 1;
|
||||
break;
|
||||
case OPT_APPLICATION_NAME:
|
||||
opt_application_name = optarg;
|
||||
break;
|
||||
case OPT_APPLICATION_ID:
|
||||
opt_application_id = optarg;
|
||||
break;
|
||||
|
|
|
@ -106,7 +106,7 @@ static const char *option_help[] = {
|
|||
"Stores card info to cache",
|
||||
"Reads certificate with ID <arg>",
|
||||
"Lists certificates",
|
||||
"Reads data object with applicationName or OID <arg>",
|
||||
"Reads data object with OID, applicationName or label <arg>",
|
||||
"Lists data objects",
|
||||
"Lists PIN codes",
|
||||
"Dump card objects",
|
||||
|
@ -317,7 +317,7 @@ static int read_data_object(void)
|
|||
if (memcmp(oid.value, cinfo->app_oid.value, sizeof(int) * oid_len))
|
||||
continue;
|
||||
} else {
|
||||
if (memcmp(opt_data, &cinfo->app_label, strlen(opt_data)))
|
||||
if (strcmp(opt_data, cinfo->app_label) && strcmp(opt_data, objs[i]->label))
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -361,6 +361,7 @@ static int list_data_objects(void)
|
|||
|
||||
printf("Reading data object <%i>\n", i);
|
||||
printf("applicationName: %s\n", cinfo->app_label);
|
||||
printf("Label: %s\n", objs[i]->label);
|
||||
printf("applicationOID: ");
|
||||
if (cinfo->app_oid.value[0] >= 0) {
|
||||
printf("%i", cinfo->app_oid.value[0]);
|
||||
|
|
Loading…
Reference in New Issue