diff options
author | James Bottomley <James.Bottomley@HansenPartnership.com> | 2019-01-29 15:09:00 -0800 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2019-01-29 15:09:00 -0800 |
commit | 2f2c2a573f3be34992f5735669acb4d57a8e1512 (patch) | |
tree | 43a7ea8665bb5a4697510e5fe4c4a8800fde56bf | |
parent | 5f268a9f772f034f7116f606a28d58a01df6b8bf (diff) | |
download | openssl-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.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -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; } |