Flags indicating capabilities and status of the device
예제 #1
0
        /// <summary>
        /// Converts low level CK_TOKEN_INFO structure to high level TokenInfo class
        /// </summary>
        /// <param name="slotId">PKCS#11 handle of slot</param>
        /// <param name="ck_token_info">Low level CK_TOKEN_INFO structure</param>
        protected internal TokenInfo(NativeULong slotId, CK_TOKEN_INFO ck_token_info)
        {
            _slotId             = slotId;
            _label              = ConvertUtils.BytesToUtf8String(ck_token_info.Label, true);
            _manufacturerId     = ConvertUtils.BytesToUtf8String(ck_token_info.ManufacturerId, true);
            _model              = ConvertUtils.BytesToUtf8String(ck_token_info.Model, true);
            _serialNumber       = ConvertUtils.BytesToUtf8String(ck_token_info.SerialNumber, true);
            _tokenFlags         = new TokenFlags(ck_token_info.Flags);
            _maxSessionCount    = ck_token_info.MaxSessionCount;
            _sessionCount       = ck_token_info.SessionCount;
            _maxRwSessionCount  = ck_token_info.MaxRwSessionCount;
            _rwSessionCount     = ck_token_info.RwSessionCount;
            _maxPinLen          = ck_token_info.MaxPinLen;
            _minPinLen          = ck_token_info.MinPinLen;
            _totalPublicMemory  = ck_token_info.TotalPublicMemory;
            _freePublicMemory   = ck_token_info.FreePublicMemory;
            _totalPrivateMemory = ck_token_info.TotalPrivateMemory;
            _freePrivateMemory  = ck_token_info.FreePrivateMemory;
            _hardwareVersion    = ck_token_info.HardwareVersion.ToString();
            _firmwareVersion    = ck_token_info.FirmwareVersion.ToString();
            _utcTimeString      = ConvertUtils.BytesToUtf8String(ck_token_info.UtcTime, true);

            try
            {
                _utcTime = ConvertUtils.UtcTimeStringToDateTime(_utcTimeString);
            }
            catch
            {
                _utcTime = null;
            }
        }
예제 #2
0
        /// <summary>
        /// Converts low level CK_TOKEN_INFO structure to high level TokenInfo class
        /// </summary>
        /// <param name="slotId">PKCS#11 handle of slot</param>
        /// <param name="ck_token_info">Low level CK_TOKEN_INFO structure</param>
        internal TokenInfo(ulong slotId, CK_TOKEN_INFO ck_token_info)
        {
            _slotId = slotId;
            _label = ConvertUtils.BytesToUtf8String(ck_token_info.Label, true);
            _manufacturerId = ConvertUtils.BytesToUtf8String(ck_token_info.ManufacturerId, true);
            _model = ConvertUtils.BytesToUtf8String(ck_token_info.Model, true);
            _serialNumber = ConvertUtils.BytesToUtf8String(ck_token_info.SerialNumber, true);
            _tokenFlags = new TokenFlags(ck_token_info.Flags);
            _maxSessionCount = ck_token_info.MaxSessionCount;
            _sessionCount = ck_token_info.SessionCount;
            _maxRwSessionCount = ck_token_info.MaxRwSessionCount;
            _rwSessionCount = ck_token_info.RwSessionCount;
            _maxPinLen = ck_token_info.MaxPinLen;
            _minPinLen = ck_token_info.MinPinLen;
            _totalPublicMemory = ck_token_info.TotalPublicMemory;
            _freePublicMemory = ck_token_info.FreePublicMemory;
            _totalPrivateMemory = ck_token_info.TotalPrivateMemory;
            _freePrivateMemory = ck_token_info.FreePrivateMemory;
            _hardwareVersion = ck_token_info.HardwareVersion.ToString();
            _firmwareVersion = ck_token_info.FirmwareVersion.ToString();
            _utcTimeString = ConvertUtils.BytesToUtf8String(ck_token_info.UtcTime, true);

            try
            {
                _utcTime = ConvertUtils.UtcTimeStringToDateTime(_utcTimeString);
            }
            catch
            {
                _utcTime = null;
            }
        }