/// <summary> Сохранить ключ шифрования в локальном хранилище </summary>
        public bool LocalSavePublicKey()
        {
            var modelLogin = DataSourceLogin.GetLastModelLogin();
            var login      = modelLogin.Login;
            var serverArea = modelLogin.ServerAreaCode;
            var secretKey  = DataSourceSecurity.GetUserSecretKey();
            var saveResult = UtilitySecurity.SavePrivateCryptKeyToIsolatedStorage(secretKey, login, serverArea.ToString());

            return(saveResult);
        }
Ejemplo n.º 2
0
        /// <summary> Обработчик генерации секретного ключа внутри логики C++ </summary>
        private void LogicSecretKeyGeneratedHandler()
        {
            var modelLogin = DataSourceLogin.GetLastModelLogin();
            var login      = modelLogin.Login;
            var serverArea = modelLogin.ServerAreaCode;

            var secretKey = DataSourceSecurity.GetUserSecretKey();

            OnSecretKeyGenerated(login, serverArea, secretKey);
        }
Ejemplo n.º 3
0
        public AlignedSecurity(ISecurity security, TimeSpan timeFrame)
        {
            if (timeFrame <= TimeSpan.Zero)
            {
                throw new ArgumentOutOfRangeException(nameof(timeFrame));
            }

            m_security          = security ?? throw new ArgumentNullException(nameof(security));
            m_timeFrame         = timeFrame;
            SecurityDescription = new DataSourceSecurity(security.SecurityDescription);
        }
        /// <summary> Импортировать приватный ключ шифрования </summary>
        public bool ImportAndSaveCryptKey()
        {
            var result = DataSourceSecurity.ImportUserPrivateKey(UtilitySecurity.ToSecureString(CryptKeyForImport));

            if (result)
            {
                CryptKeyForImport = String.Empty;

                var saveResult = LocalSavePublicKey();

                ShowImportPanel = false;
                ExportAviable   = true;
            }

            return(result);
        }
 /// <summary> Перегенерировать ключ шифрования</summary>
 public bool RegenerateKeyPair()
 {
     return(DataSourceSecurity.RegenerateKeyPair());
 }
 /// <summary> Проверка возможности Экспорта ключа из БЛ</summary>
 public bool CheckEncryptionkey()
 {
     return(!String.IsNullOrEmpty(UtilitySecurity.ConvertToString(DataSourceSecurity.GetUserPrivateKey())));
 }
 /// <summary> Возвращает ключ шифрования залогиненого пользователя для экспорта </summary>
 public string GetUserPrivateKey()
 {
     return(UtilitySecurity.ConvertToString(DataSourceSecurity.GetUserPrivateKey()));
 }
Ejemplo n.º 8
0
 /// <summary> Проверка пароля </summary>
 public void CheckPassword()
 {
     OnEventViewModel("CheckPassword", DataSourceSecurity.CheckPassword(_password));
 }