add methods to convert slot and token info from C-structure; refs #28
This commit is contained in:
@@ -872,13 +872,20 @@ namespace cryptoki {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! Read Slot Information
|
||||||
SlotInfo slotinfo() {
|
SlotInfo slotinfo() {
|
||||||
CRYPTOLOG("log");
|
CRYPTOLOG("log");
|
||||||
SlotInfo info;
|
|
||||||
CK_SLOT_INFO cInfo;
|
CK_SLOT_INFO cInfo;
|
||||||
//! calls @c C_GetSlotInfo
|
//! calls @c C_GetSlotInfo
|
||||||
if (!check(_library->C_GetSlotInfo(_slot, &cInfo),
|
if (!check(_library->C_GetSlotInfo(_slot, &cInfo),
|
||||||
CRYPTOKI_FN_LOG("C_GetSlotInfo"))) return info;
|
CRYPTOKI_FN_LOG("C_GetSlotInfo")))
|
||||||
|
return slotinfo(cInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Convert C-Structure of Slot Information Into C++
|
||||||
|
SlotInfo slotinfo(const CK_SLOT_INFO& cInfo) {
|
||||||
|
CRYPTOLOG("log");
|
||||||
|
SlotInfo info;
|
||||||
info.slotDescription = cInfo.slotDescription;
|
info.slotDescription = cInfo.slotDescription;
|
||||||
info.manufacturerID = cInfo.manufacturerID;
|
info.manufacturerID = cInfo.manufacturerID;
|
||||||
info.flags = cInfo.flags;
|
info.flags = cInfo.flags;
|
||||||
@@ -886,14 +893,20 @@ namespace cryptoki {
|
|||||||
info.firmwareVersion = cInfo.firmwareVersion;
|
info.firmwareVersion = cInfo.firmwareVersion;
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! Read Token Information
|
||||||
TokenInfo tokeninfo() {
|
TokenInfo tokeninfo() {
|
||||||
CRYPTOLOG("log");
|
CRYPTOLOG("log");
|
||||||
TokenInfo info;
|
|
||||||
//! calls @c C_GetTokenInfo
|
//! calls @c C_GetTokenInfo
|
||||||
CK_TOKEN_INFO cInfo;
|
CK_TOKEN_INFO cInfo;
|
||||||
if (!check(_library->C_GetTokenInfo(_slot, &cInfo),
|
if (!check(_library->C_GetTokenInfo(_slot, &cInfo),
|
||||||
CRYPTOKI_FN_LOG("C_GetTokenInfo"))) return info;
|
CRYPTOKI_FN_LOG("C_GetTokenInfo")))
|
||||||
|
return tokeninfo(cInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Convert C-Structure of Token Information Into C++
|
||||||
|
TokenInfo tokeninfo(const CK_TOKEN_INFO cInfo) {
|
||||||
|
TokenInfo info;
|
||||||
info.label = cInfo.label;
|
info.label = cInfo.label;
|
||||||
info.manufacturerID = cInfo.manufacturerID;
|
info.manufacturerID = cInfo.manufacturerID;
|
||||||
info.model = cInfo.model;
|
info.model = cInfo.model;
|
||||||
|
Reference in New Issue
Block a user