aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Bottomley <James.Bottomley@HansenPartnership.com>2019-01-29 15:09:00 -0800
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2019-01-29 15:09:00 -0800
commit2f2c2a573f3be34992f5735669acb4d57a8e1512 (patch)
tree43a7ea8665bb5a4697510e5fe4c4a8800fde56bf
parent5f268a9f772f034f7116f606a28d58a01df6b8bf (diff)
downloadopenssl-pkcs11-export-2f2c2a573f3be34992f5735669acb4d57a8e1512.tar.gz
fix openssl rsa public key export from pkcs11 engine
Apparently the openssl pkcs11 engine won't recognize us unless we populate the slot flags with CKF_TOKEN_PRESENT, so do this and add other slot info (the openssl engine prints out the slot strings not the token strings when debugging) With this, both openssl rsa -text -engine pkcs11 -inform engine -pubin -in <URI> and p11tool --export <URI> Work correctly on the public key URI to export the public key Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
-rw-r--r--pkcs11.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/pkcs11.c b/pkcs11.c
index e536f52..46ba0f2 100644
--- a/pkcs11.c
+++ b/pkcs11.c
@@ -125,6 +125,19 @@ C_GetSlotInfo(CK_SLOT_ID slot, CK_SLOT_INFO_PTR info)
if (!info)
return CKR_ARGUMENTS_BAD;
memset(info, 0, sizeof(*info));
+ info->firmwareVersion.major = LIBRARY_VERSION_MAJOR;
+ info->firmwareVersion.minor = LIBRARY_VERSION_MINOR;
+
+ info->hardwareVersion.major = LIBRARY_VERSION_MAJOR;
+ info->hardwareVersion.minor = LIBRARY_VERSION_MINOR;
+ info->flags = 0;
+ ATTRIB(info->manufacturerID,
+ cache_get_default(GLOBAL_SECTION, "manufacturer id",
+ PACKAGE_NAME));
+ ATTRIB(info->slotDescription,
+ cache_get_default(GLOBAL_SECTION, "slot description",
+ PACKAGE_STRING));
+ info->flags = CKF_TOKEN_PRESENT;
return CKR_OK;
}