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;
|
||||
}
|
||||
|
||||
//! Read Slot Information
|
||||
SlotInfo slotinfo() {
|
||||
CRYPTOLOG("log");
|
||||
SlotInfo info;
|
||||
CK_SLOT_INFO cInfo;
|
||||
//! calls @c C_GetSlotInfo
|
||||
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.manufacturerID = cInfo.manufacturerID;
|
||||
info.flags = cInfo.flags;
|
||||
@@ -887,13 +894,19 @@ namespace cryptoki {
|
||||
return info;
|
||||
}
|
||||
|
||||
//! Read Token Information
|
||||
TokenInfo tokeninfo() {
|
||||
CRYPTOLOG("log");
|
||||
TokenInfo info;
|
||||
//! calls @c C_GetTokenInfo
|
||||
CK_TOKEN_INFO 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.manufacturerID = cInfo.manufacturerID;
|
||||
info.model = cInfo.model;
|
||||
|
Reference in New Issue
Block a user