Added set_userpin_ref() to link a PIN value to a PIN ref for an existing user PIN
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2512 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
parent
858ea38e97
commit
8e3dee0585
|
@ -101,6 +101,7 @@ static int do_read_certificate(const char *, const char *, X509 **);
|
||||||
static void parse_commandline(int argc, char **argv);
|
static void parse_commandline(int argc, char **argv);
|
||||||
static void read_options_file(const char *);
|
static void read_options_file(const char *);
|
||||||
static void ossl_print_errors(void);
|
static void ossl_print_errors(void);
|
||||||
|
static void set_userpin_ref();
|
||||||
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
@ -1074,6 +1075,8 @@ do_delete_objects(struct sc_profile *profile, unsigned int opt_delete_flags)
|
||||||
{
|
{
|
||||||
int r, count = 0;
|
int r, count = 0;
|
||||||
|
|
||||||
|
set_userpin_ref();
|
||||||
|
|
||||||
if (opt_delete_flags & SC_PKCS15INIT_DEL_DATA) {
|
if (opt_delete_flags & SC_PKCS15INIT_DEL_DATA) {
|
||||||
struct sc_object_id app_oid;
|
struct sc_object_id app_oid;
|
||||||
sc_pkcs15_object_t *obj;
|
sc_pkcs15_object_t *obj;
|
||||||
|
@ -2013,6 +2016,26 @@ parse_delete_flags(const char *list)
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If the user PIN and it's ID is given, put the pin ref in the keycache */
|
||||||
|
static void set_userpin_ref()
|
||||||
|
{
|
||||||
|
int r;
|
||||||
|
|
||||||
|
if ((opt_pins[0] != NULL) && (opt_authid != 0)) {
|
||||||
|
sc_path_t path;
|
||||||
|
sc_pkcs15_id_t auth_id;
|
||||||
|
sc_pkcs15_object_t *pinobj;
|
||||||
|
sc_pkcs15_pin_info_t *pin_info;
|
||||||
|
sc_format_path("3F00", &path);
|
||||||
|
sc_pkcs15_format_id(opt_authid, &auth_id);
|
||||||
|
r = sc_pkcs15_find_pin_by_auth_id(p15card, &auth_id, &pinobj);
|
||||||
|
if (r < 0)
|
||||||
|
fatal("Searching for user PIN %d failed: %s\n", opt_authid, sc_strerror(r));
|
||||||
|
pin_info = (sc_pkcs15_pin_info_t *) pinobj->data;
|
||||||
|
sc_keycache_set_pin_name(&path, pin_info->reference, SC_PKCS15INIT_USER_PIN);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Parse X.509 key usage list
|
* Parse X.509 key usage list
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue