Beispiel #1
0
 /// <summary>
 /// Converts low level CK_SLOT_INFO structure to high level SlotInfo class
 /// </summary>
 /// <param name="slotId">PKCS#11 handle of slot</param>
 /// <param name="ck_slot_info">Low level CK_SLOT_INFO structure</param>
 internal SlotInfo(uint slotId, LowLevelAPI.CK_SLOT_INFO ck_slot_info)
 {
     _slotId          = slotId;
     _slotDescription = ConvertUtils.BytesToUtf8String(ck_slot_info.SlotDescription, true);
     _manufacturerId  = ConvertUtils.BytesToUtf8String(ck_slot_info.ManufacturerId, true);
     _slotFlags       = new SlotFlags(ck_slot_info.Flags);
     _hardwareVersion = ConvertUtils.CkVersionToString(ck_slot_info.HardwareVersion);
     _firmwareVersion = ConvertUtils.CkVersionToString(ck_slot_info.FirmwareVersion);
 }
Beispiel #2
0
        /// <summary>
        /// Obtains information about a particular slot in the system
        /// </summary>
        /// <returns>Slot information</returns>
        public SlotInfo GetSlotInfo()
        {
            LowLevelAPI.CK_SLOT_INFO slotInfo = new LowLevelAPI.CK_SLOT_INFO();
            CKR rv = _p11.C_GetSlotInfo(_slotId, ref slotInfo);

            if (rv != CKR.CKR_OK)
            {
                throw new Pkcs11Exception("C_GetSlotInfo", rv);
            }

            return(new SlotInfo(_slotId, slotInfo));
        }