summaryrefslogtreecommitdiff
path: root/lib/rsa/rsa-sign.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rsa/rsa-sign.c')
-rw-r--r--lib/rsa/rsa-sign.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/rsa/rsa-sign.c b/lib/rsa/rsa-sign.c
index fb5e07b56d..5b5905aeb5 100644
--- a/lib/rsa/rsa-sign.c
+++ b/lib/rsa/rsa-sign.c
@@ -141,6 +141,15 @@ static int rsa_engine_get_pub_key(const char *keydir, const char *name,
snprintf(key_id, sizeof(key_id),
"pkcs11:object=%s;type=public",
name);
+ } else if (engine_id) {
+ if (keydir)
+ snprintf(key_id, sizeof(key_id),
+ "%s%s",
+ keydir, name);
+ else
+ snprintf(key_id, sizeof(key_id),
+ "%s",
+ name);
} else {
fprintf(stderr, "Engine not supported\n");
return -ENOTSUP;
@@ -252,6 +261,15 @@ static int rsa_engine_get_priv_key(const char *keydir, const char *name,
snprintf(key_id, sizeof(key_id),
"pkcs11:object=%s;type=private",
name);
+ } else if (engine_id) {
+ if (keydir)
+ snprintf(key_id, sizeof(key_id),
+ "%s%s",
+ keydir, name);
+ else
+ snprintf(key_id, sizeof(key_id),
+ "%s",
+ name);
} else {
fprintf(stderr, "Engine not supported\n");
return -ENOTSUP;