Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MyEID: For the private key, use the ACLs that are defined in the prof… #3020

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
MyEID: For the private key, use the ACLs that are defined in the prof…
…ile.

Another issue regarding setting the ACL to a private key was raised in
issue #2963.  This patch removes a part of the code that makes it
impossible to set the ACL according to the selected profile.
  • Loading branch information
popovec committed Feb 7, 2024
commit 15b5f558e8d7d85368fbfc6be97220d54e013a05
35 changes: 0 additions & 35 deletions src/pkcs15init/pkcs15-myeid.c
Original file line number Diff line number Diff line change
Expand Up @@ -537,9 +537,6 @@ myeid_create_key(struct sc_profile *profile, struct sc_pkcs15_card *p15card,
struct sc_path *path;
int *key_reference;
struct sc_file *file = NULL;
struct sc_pkcs15_object *pin_object = NULL;
struct sc_pkcs15_auth_info *pkcs15_auth_info = NULL;
unsigned char sec_attrs[] = {0xFF, 0xFF, 0xFF};
int r, ef_structure = 0, pin_reference = -1;
size_t keybits = 0;
unsigned char prop_info[] = {0x00, 0x00};
Expand Down Expand Up @@ -619,38 +616,6 @@ myeid_create_key(struct sc_profile *profile, struct sc_pkcs15_card *p15card,
sc_log(ctx, "Path of MyEID key file to create %s",
sc_print_path(&file->path));

if (object->auth_id.len >= 1) {
r = sc_pkcs15_find_pin_by_auth_id(p15card, &object->auth_id, &pin_object);

if (r != SC_SUCCESS)
sc_file_free(file);
LOG_TEST_RET(ctx, r, "Failed to get pin object by auth_id");

if (pin_object->type != SC_PKCS15_TYPE_AUTH_PIN) {
sc_file_free(file);
LOG_TEST_RET(ctx, SC_ERROR_OBJECT_NOT_VALID, "Invalid object returned when locating pin object.");
}

pkcs15_auth_info = (struct sc_pkcs15_auth_info*) pin_object->data;

if (pkcs15_auth_info == NULL || pkcs15_auth_info->auth_type != SC_PKCS15_PIN_AUTH_TYPE_PIN) {
sc_file_free(file);
LOG_TEST_RET(ctx, SC_ERROR_OBJECT_NOT_VALID, "NULL or invalid sc_pkcs15_auth_info in pin object");
}

pin_reference = pkcs15_auth_info->attrs.pin.reference;

if (pin_reference >= 1 && pin_reference < MYEID_MAX_PINS) {
sec_attrs[0] = (pin_reference << 4 | (pin_reference & 0x0F));
sec_attrs[1] = (pin_reference << 4 | (pin_reference & 0x0F));
sc_file_set_sec_attr(file, sec_attrs, sizeof(sec_attrs));
}
}
else {
sc_file_free(file);
LOG_TEST_RET(ctx, SC_ERROR_INVALID_ARGUMENTS, "Invalid AuthID value for a private key.");
}

/* TODO: fill all proprietary attributes here based on the object */

if (object->user_consent != 0 && pin_reference >= 1)
Expand Down
Loading