add methods to convert slot and token info from C-structure; refs #28

master
Marc Wäckerlin 11 years ago
parent 41d8c55db6
commit a9b5d10870
  1. 23
      src/cryptoki.hxx

@ -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;
@ -886,14 +893,20 @@ namespace cryptoki {
info.firmwareVersion = cInfo.firmwareVersion;
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;

Loading…
Cancel
Save