Example #1
0
        private Task SetCryptoAlgs(Stream stream)
        {
            var cryptoInfo    = SerializerF.Deserialize <CryptoInfo>(stream, false);
            var resultOfCheck = CheckCryptoInfo(cryptoInfo);

            if (!resultOfCheck.OperationWasFinishedSuccessful)
            {
                return(ReturnResultToClientAsync(resultOfCheck, false));
            }

            ChoosenCrypto = cryptoInfo;
            var factory =
                Core.CryptoFactories.First(baseC => baseC.PossibleCryptoAlgs.Providers.Contains(cryptoInfo.Provider));

            //AsymmetricEncrypterF = factory.CreateAsymmetricAlgoritm(cryptoInfo.Provider, cryptoInfo.Asymmetric,
            //            factory.KeySizes[cryptoInfo.Asymmetric], factory);
            CryptoFactoryF = factory;
            //var encS = factory.CreateSymmetricAlgoritm(ChoosenCrypto.Provider, ChoosenCrypto.Symmetric);
            //EncrypterF = encS.Item1;
            //DecryptorF = encS.Item2;


            return(ReturnResultToClientAsync(new ResultOfOperation()
            {
                OperationWasFinishedSuccessful = true
            }, false));
        }
Example #2
0
        private static void main(string[] args)
        {
            var options = ProcessOptions(args);

            if (options == null)
            {
                return;
            }

            if (options.VerboseMode)
            {
                Log.VerboseMode = true;
            }

            var cryptoInfo = new CryptoInfo(options);

            if (cryptoInfo.expectedDemoHash != ParsedD20RulesEngine.DemoHashOct2010)
            {
                Solve2009Version(options, ref cryptoInfo);
            }
            options.Oct2010 = cryptoInfo.expectedDemoHash == ParsedD20RulesEngine.DemoHashOct2010;

            var fileManager = new PartManager(options, cryptoInfo);

            Thread programThread = null;

            if (options.SetFileAssociations)
            {
                Utils.UpdateRegistry();
            }
            var uc = new UpdateChecker(null, options.Redirects);

            fileManager.DoUpdates(options.ForceUpdate, false, true, uc);
            if (options.CheckForUpdates && options.UpdateFirst)
            {
                fileManager.DoUpdates(options.ForceUpdate, false, false, uc);
            }
            fileManager.MergeFiles();
            if (options.CreateUpdateIndexFiles)
            {
                fileManager.GenerateUpdateIndexes();
            }
            if (options.LaunchBuilder)
            {
                programThread = ProcessLauncher.StartProcess(options, options.ExecArgs.ToArray(),
                                                             fileManager.MergedPath, fileManager.ChangelogPath);
            }
            if (options.CheckForUpdates && !options.UpdateFirst)
            {
                fileManager.DoUpdates(options.ForceUpdate, true, false, uc);
            }
            if (!options.CheckForUpdates)
            {
                Log.Warn("Updates are currently disabled");
            }
            if (programThread != null)
            {
                programThread.Join();
            }
        }
 public SubscribedCryptoViewModel(Cryptocurrency crypto, CryptoInfo info)
 {
     Id        = crypto.Id;
     Name      = crypto.Name;
     Symbol    = crypto.Symbol;
     ToSymbol  = info.ToSymbol;
     UnitPrice = info.Price;
 }
Example #4
0
        public KeyStore <T> EncryptAndGenerateKeyStore(string password, byte[] privateKey, string address, T kdfParams)
        {
            if (password == null)
            {
                throw new ArgumentNullException(nameof(password));
            }
            if (privateKey == null)
            {
                throw new ArgumentNullException(nameof(privateKey));
            }
            if (address == null)
            {
                throw new ArgumentNullException(nameof(address));
            }
            if (kdfParams == null)
            {
                throw new ArgumentNullException(nameof(kdfParams));
            }

            if (privateKey.Length != 32)
            {
                //Validate length unsigned but store the parameter
                //if is less than 32 already will fail
                var keyValidation = BigIntegers.AsUnsignedByteArray(new BigInteger(privateKey));

                if (keyValidation.Length != 32)
                {
                    throw new ArgumentException("Private key should be 32 bytes", nameof(privateKey));
                }
            }

            var salt = RandomBytesGenerator.GenerateRandomSalt();

            var derivedKey = GenerateDerivedKey(password, salt, kdfParams);

            var cipherKey = KeyStoreCrypto.GenerateCipherKey(derivedKey);

            var iv = RandomBytesGenerator.GenerateRandomInitialisationVector();

            var cipherText = GenerateCipher(privateKey, iv, cipherKey);

            var mac = KeyStoreCrypto.GenerateMac(derivedKey, cipherText);

            var cryptoInfo = new CryptoInfo <T>(GetCipherType(), cipherText, iv, mac, salt, kdfParams, GetKdfType());

            var keyStore = new KeyStore <T>
            {
                Version = CurrentVersion,
                Address = address,
                Id      = Guid.NewGuid().ToString(),
                Crypto  = cryptoInfo
            };

            return(keyStore);
        }
Example #5
0
        public CryptoKey Generate(ReadOnlySpan <byte> password, CryptoInfo info)
        {
            var iv  = ScryptUtil.Scrypt(password, password, 256, 8, 16, info.IVSize);
            var key = ScryptUtil.Scrypt(password, iv, 512, 8, 16, info.KeySize);

            return(new CryptoKey()
            {
                Key = key,
                IV = iv
            });
        }
Example #6
0
 /// <summary>
 /// Create a instance use random key and iv
 /// </summary>
 public AesCryptor()
     : base()
 {
     this.Mode    = CipherMode.CBC;
     this.Padding = PaddingMode.PKCS7;
     this.KeySize = 256;
     this._info   = new CryptoInfo()
     {
         KeySize = 32, IVSize = 16
     };
 }
        public NewItemPage()
        {
            InitializeComponent();

            Item = new CryptoInfo
            {
                key  = "Key",
                name = "Name"
            };

            BindingContext = this;
        }
Example #8
0
 /// <summary>
 /// Use given key and IV to create a instance
 /// keysize depends on the length of key in bits
 /// </summary>
 /// <param name="key">Key</param>
 /// <param name="iv">IV</param>
 public AesCryptor(byte[] key, byte[] iv)
     : base()
 {
     this.Mode    = CipherMode.CBC;
     this.Padding = PaddingMode.PKCS7;
     this.Key     = key;
     this.IV      = iv;
     this._info   = new CryptoInfo()
     {
         KeySize = 32, IVSize = 16
     };
 }
Example #9
0
        public async Task <double> GetPrice(string currency)
        {
            using (HttpClient client = new HttpClient())
            {
                HttpResponseMessage response = await client.GetAsync("https://api.cryptonator.com/api/ticker/" + currency + "-usd");

                string jsonResponse = await response.Content.ReadAsStringAsync();

                CryptoInfo cryptoInfo = JsonConvert.DeserializeObject <CryptoInfo>(jsonResponse);
                client.Dispose();
                return(cryptoInfo.Ticker.Price);
            }
        }
Example #10
0
        public async Task <CryptoInfo> GetCryptoInfo(CryptoType cryptoType)
        {
            using (HttpClient client = new HttpClient())
            {
                HttpResponseMessage response = await client.GetAsync("https://api.cryptonator.com/api/ticker/" + GetUriSuffix(cryptoType) + "-usd");

                string jsonResponse = await response.Content.ReadAsStringAsync();

                CryptoInfo cryptoInfo = JsonConvert.DeserializeObject <CryptoInfo>(jsonResponse);
                cryptoInfo.Type = cryptoType;
                client.Dispose();
                return(cryptoInfo);
            }
        }
Example #11
0
        public KeyStore <T> EncryptAndGenerateKeyStore(string password, byte[] privateKey, string address, T kdfParams)
        {
            if (password == null)
            {
                throw new ArgumentNullException(nameof(password));
            }
            if (privateKey == null)
            {
                throw new ArgumentNullException(nameof(privateKey));
            }
            if (address == null)
            {
                throw new ArgumentNullException(nameof(address));
            }
            if (kdfParams == null)
            {
                throw new ArgumentNullException(nameof(kdfParams));
            }

            if (privateKey.Length != 32)
            {
                throw new ArgumentException("Private key should be 32 bytes", nameof(privateKey));
            }

            var salt = RandomBytesGenerator.GenerateRandomSalt();

            var derivedKey = GenerateDerivedKey(KeyStoreCrypto.GetPasswordAsBytes(password), salt, kdfParams);

            var cipherKey = KeyStoreCrypto.GenerateCipherKey(derivedKey);

            var iv = RandomBytesGenerator.GenerateRandomInitialisationVector();

            var cipherText = GenerateCipher(privateKey, iv, cipherKey);

            var mac = KeyStoreCrypto.GenerateMac(derivedKey, cipherText);

            var cryptoInfo = new CryptoInfo <T>(GetCipherType(), cipherText, iv, mac, salt, kdfParams, GetKdfType());

            var keyStore = new KeyStore <T>
            {
                Version = CurrentVersion,
                Address = address,
                Id      = Guid.NewGuid().ToString(),
                Crypto  = cryptoInfo
            };

            return(keyStore);
        }
Example #12
0
        private static void main(string[] args)
        {
            var options = processOptions(args);

            if (options == null)
            {
                return;
            }

            if (options.VerboseMode)
            {
                Log.VerboseMode = true;
            }

            var cryptoInfo  = new CryptoInfo(options);
            var fileManager = new PartManager(options, cryptoInfo);

            Thread programThread = null;

            if (options.SetFileAssociations)
            {
                Utils.UpdateRegistry();
            }
            if (options.CheckForUpdates && options.UpdateFirst)
            {
                fileManager.DoUpdates(options.ForceUpdate, false);
            }
            fileManager.MergeFiles(options.ForceRemerge);
            if (options.CreateUpdateIndexFiles)
            {
                fileManager.GenerateUpdateIndexes();
            }
            if (options.LaunchBuilder)
            {
                programThread = ProcessLauncher.StartProcess(options, options.ExecArgs.ToArray(),
                                                             fileManager.MergedPath, fileManager.ChangelogPath);
            }
            if (options.CheckForUpdates && !options.UpdateFirst)
            {
                fileManager.DoUpdates(options.ForceUpdate, true);
            }
            if (programThread != null)
            {
                programThread.Join();
            }
        }
Example #13
0
        private async void GetInfo(object state)
        {
            List <CryptoCurrency> cryptoCurrencies = (List <CryptoCurrency>) await _cryptoCurrencyService.GetAll();

            List <CryptoWidget> widgets = new();

            foreach (var crypto in cryptoCurrencies)
            {
                CryptoInfo info = await _cryptoInfoService.GetCryptoInfo((CryptoType)crypto.Id - 1);

                CryptoWidget widget = new(info.Ticker.Base);
                widget.Name   = info.Ticker.Base;
                widget.Price  = info.Ticker.Price;
                widget.Change = Math.Round((info.Ticker.Price - crypto.CurrentPrice), 2);
                if (widget.Change > 0)
                {
                    widget.Color = "Green";
                }
                else if (widget.Change < 0)
                {
                    widget.Color = "Red";
                }
                else
                {
                    widget.Color = "#faff78";
                }

                widgets.Add(widget);
                crypto.CurrentPrice = info.Ticker.Price;
                await _cryptoCurrencyService.Update(crypto.Id, crypto);
            }

            Dispatcher.CurrentDispatcher.Invoke(() =>
            {
                for (int i = 0; i < 10; i++)
                {
                    var widget    = Labels[i];
                    var update    = widgets[i];
                    widget.Name   = update.Name;
                    widget.Price  = update.Price;
                    widget.Change = update.Change;
                    widget.Color  = update.Color;
                }
            });
        }
Example #14
0
        private static string Patch(string cBPath, string updatePath)
        {
            var tmp = Path.Combine(Path.GetTempPath(), nameof(CBLoader));

            Directory.CreateDirectory(tmp);

            Utils.CopyAll(cBPath, tmp, true);
            Utils.CopyAll(updatePath, tmp, true);
            var probe = new CryptoInfo(new LoaderOptions {
                CBPath = tmp
            });

            if (probe.expectedDemoHash == ParsedD20RulesEngine.DemoHashOct2010)
            {
                return(tmp);
            }
            return(null);
        }
        public async Task <string> GetCryptoInfoAsync()
        {
            CancellationTokenSource source = new CancellationTokenSource();
            CancellationToken       token  = source.Token;

            var newCrypto = await GetEtherGas(ConfigurationManager.AppSettings["etherScanApi"]);

            var             result           = "Текущийкурс Ether: " + newCrypto.EthUsd + "$" + Environment.NewLine;
            var             lastCryptoDataDb = _dbContext.CryptoInfo.AsQueryable().OrderByDescending(x => x.Id).FirstOrDefault();
            EtherGasBotData lastCryptoData   = null;

            if (lastCryptoDataDb != null)
            {
                lastCryptoData = new EtherGasBotData()
                {
                    EthUsdTime = lastCryptoDataDb.EthUsdTime,
                    EthBtc     = lastCryptoDataDb.EthBtc.ToString(CultureInfo.InvariantCulture),
                    EthBtcTime = lastCryptoDataDb.EthBtcTime,
                    EthUsd     = lastCryptoDataDb.EthUsd.ToString(CultureInfo.InvariantCulture)
                };
            }
            CryptoInfo cryptoInfoNew = new CryptoInfo()
            {
                EthBtc     = Convert.ToDouble(newCrypto.EthBtc, CultureInfo.InvariantCulture),
                EthBtcTime = newCrypto.EthBtcTime,
                EthUsd     = Convert.ToDouble(newCrypto.EthUsd, CultureInfo.InvariantCulture),
                EthUsdTime = newCrypto.EthUsdTime,
                GasAvarage = Convert.ToInt32(newCrypto.GasAvarage)
            };

            _dbContext.CryptoInfo.Add(cryptoInfoNew);
            await _dbContext.SaveChangesAsync(token);

            if (lastCryptoData != null)
            {
                double   procent        = ((Convert.ToDouble(newCrypto.EthUsd, CultureInfo.InvariantCulture) / Convert.ToDouble(lastCryptoData.EthUsd, CultureInfo.InvariantCulture) - 1) * 100);
                long     timePassed     = long.Parse(newCrypto.EthUsdTime) - long.Parse(lastCryptoData.EthUsdTime);
                TimeSpan timePassedTime = new TimeSpan(0, 0, (int)timePassed);
                result += "Разница между сессиями: " + Math.Round(procent, 2) + "% за " + timePassedTime.ToString(@"dd\ hh\:mm\:ss") + Environment.NewLine;
            }
            result += "Газ: " + newCrypto.GasAvarage + " gwei";
            return(result);
        }
 public ItemDetailViewModel(CryptoInfo item)
 {
     Title        = item?.name;
     SocketCrypto = new SocketCrypto
     {
         stream        = item.name,
         id            = item.id,
         last          = item.last,
         lowestAsk     = item.lowestAsk,
         highestBid    = item.highestBid,
         percentChange = item.percentChange,
         baseVolume    = item.baseVolume,
         quoteVolume   = item.quoteVolume,
         isFrozen      = item.isFrozen,
         high24hr      = item.high24hr,
         low24hr       = item.low24hr
     };
     StartLoadingData("market.ticker." + item.key.ToLower());
 }
Example #17
0
        private static bool Solve2009Version(LoaderOptions options, ref CryptoInfo cryptoInfo)
        {
            Log.Trace("Trying to solve outdated version.");
            var destDirName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Character Builder");

            if (Directory.Exists(destDirName))
            {
                options.CBPath = destDirName;
                cryptoInfo     = new CryptoInfo(options);
                Log.Trace($"Using pre-patched {destDirName}");
                return(true);
            }

            var defaultPath = @"C:\Program Files\Wizards of the Coast\Character Builder".Replace('\\', Path.DirectorySeparatorChar);

            Log.Trace($"  - Looking in {defaultPath}");
            if (Directory.Exists(defaultPath))
            {
                Log.Trace($"  - Applying patch");
                var path = Patch(options.CBPath, defaultPath);
                if (!string.IsNullOrEmpty(path))
                {
                    Log.Trace($"  - Patch works. Moving to {destDirName}");
                    Utils.CopyAll(path, destDirName);
                    new DirectoryInfo(path).Delete(true);
                    options.CBPath = destDirName;
                    cryptoInfo     = new CryptoInfo(options);
                    Log.Trace($"Patch successful");
                    var baseconfigpath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "default.cbconfig");
                    if (File.Exists(baseconfigpath)) // Point the config file at this for future launches
                    {
                        var doc = System.Xml.Linq.XDocument.Load(baseconfigpath);
                        doc.Root.Add(new System.Xml.Linq.XElement("CharacterBuilderPath", options.CBPath));
                        doc.Save(baseconfigpath);
                    }
                    Log.Warn("CBLoader has manually reapplied a failed April2010 patch install.");
                    return(true);
                }
            }

            return(false);
        }
Example #18
0
 private protected Task <String> FormatCryptoInfo(CryptoInfo cryptoInfo)
 {
     try
     {
         // Use a new string writer to hold the xml from the serializer
         using (var sw = new StringWriter())
         {
             // Create a new serializer with the type of CryptoInfo
             XmlSerializer ser = new XmlSerializer(typeof(CryptoInfo));
             // Serialize the object as xml to the string writer
             ser.Serialize(sw, cryptoInfo);
             // Return the string held in string writer
             return(Task.FromResult(sw.ToString()));
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Example #19
0
        private ResultOfOperation CheckCryptoInfo(CryptoInfo cryptoInfo)
        {
            var CryptoPossible = Core.PossibleCryptoInfo;
            var messError      = "";

            if (!CryptoPossible.Asymmetric.Contains(cryptoInfo.Asymmetric))
            {
                messError = $"Не был найден ассиметричный алгоритм с таким названием {cryptoInfo.Asymmetric}.";
            }
            if (!CryptoPossible.Hash.Contains(cryptoInfo.Hash))
            {
                messError = $"Не был найден алгоритм хеширования с таким названием {cryptoInfo.Hash}.";
            }
            if (!CryptoPossible.Providers.Contains(cryptoInfo.Provider))
            {
                messError = $"Не был найден крипто провайдер с таким названием {cryptoInfo.Provider}.";
            }
            if (!CryptoPossible.Sign.Contains(cryptoInfo.Sign))
            {
                messError = $"Не был найден алгоритм цифровой подписи с таким названием {cryptoInfo.Sign}.";
            }
            if (!CryptoPossible.Symmetric.Contains(cryptoInfo.Symmetric))
            {
                messError = $"Не был найден симметричный алгоритм с таким названием {cryptoInfo.Symmetric}.";
            }

            var result = new ResultOfOperation();

            if (messError != "")
            {
                result.ErrorMessage = messError;
            }
            else
            {
                result.OperationWasFinishedSuccessful = true;
            }
            return(result);
        }
        //public override UserForm GetPublicKey()
        //{
        //    var formNew = new UserForm();
        //    if (CryptoProvider == CryptoProvider.CngMicrosoft)
        //    {
        //        if (AsymmetricAlgorithm is RSACng)
        //        {
        //            var rsa = (RSACng) AsymmetricAlgorithm;
        //            //var cngKeyBlob = rsa.Key.Export(CngKeyBlobFormat.GenericPublicBlob);
        //            var key = rsa.ExportParameters(false);
        //            var cngKeyBlob = Serializer.Serialize(key, false);
        //            formNew = new UserForm()
        //            {
        //                CryptoProvider = CryptoProvider.CngMicrosoft,
        //                PublicKeyParamsBlob = cngKeyBlob
        //            };
        //        }
        //    }
        //    return formNew;

        //}
        ///// <exception cref="ArgumentNullException">form == null. -или- resultOfOperation == null.</exception>
        //public override UserForm AuthenticateUser(UserForm form, out IEnumerable<byte[]> messages,
        //    ResultOfOperation resultOfOperation)
        //{
        //    if (form == null)
        //        throw new ArgumentNullException(nameof(form)) { Source = GetType().AssemblyQualifiedName };
        //    if (resultOfOperation == null)
        //        throw new ArgumentNullException(nameof(resultOfOperation)) { Source = GetType().AssemblyQualifiedName };

        //    messages = new byte[0][];
        //    var formWasFinded = UsersF.FirstOrDefault((registrationForm => registrationForm.Login.Equals(form.Login)));
        //    var KeyBlob = formWasFinded.SignPublicKeyBlob;
        //    if (KeyBlob == null)
        //    {
        //        resultOfOperation.ErrorMessage = "Пользователь не зарегистрирован.";
        //        resultOfOperation.OperationWasFinishedSuccessful = false;
        //        return null;
        //    }
        //    form.SignPublicKeyBlob = KeyBlob;

        //    if (!form.ValidateSign(false, resultOfOperation))
        //        return null;

        //    if (OfflineMessagesF.ContainsKey(form.Login))
        //        messages = OfflineMessagesF[form.Login].MessagesAsBytes.ToArray();

        //    return form;
        //}
        /// <exception cref="ArgumentNullException">form == null. -или- resultOfOperation == null.</exception>
        public override async Task <Tuple <UserFormSurrogate, OfflineMessagesConcurent> > AuthenticateUserAsync(IAuthenticationForm formAuth,
                                                                                                                CryptoFactoryBase cryptoFactory, CryptoInfo choosenCrypto, ResultOfOperation resultOfOperation)
        {
            if (formAuth == null)
            {
                throw new ArgumentNullException(nameof(formAuth))
                      {
                          Source = GetType().AssemblyQualifiedName
                      }
            }
            ;
            if (resultOfOperation == null)
            {
                throw new ArgumentNullException(nameof(resultOfOperation))
                      {
                          Source = GetType().AssemblyQualifiedName
                      }
            }
            ;

            //messages = null;
            try
            {
                //var formWasFinded = UsersF.First(registrationForm => registrationForm.Login.Equals(formAuth.Login));
                var formWasFinded =
                    await
                    UsersF.Users.FirstAsync(registrationForm => registrationForm.Login == formAuth.Login)
                    .ConfigureAwait(false);

                switch (formAuth.AuthenticationMethod)
                {
                case AuthenticationMethod.Classic:
                    var formClassicAuth = formAuth as IAuthenticationFormClassic;
                    if (formClassicAuth == null)
                    {
                        throw new InvalidCastException("Преобразование из типа IAuthenticationForm в тип " +
                                                       "IAuthenticationFormClassic завершилось с ошибкой.")
                              {
                                  Source = GetType().AssemblyQualifiedName
                              }
                    }
                    ;
                    var hashAlg        = cryptoFactory.CreateHashAlgorithm(choosenCrypto.Provider, formClassicAuth.HashAlgotitm);
                    var hashOfTruePass = hashAlg.ComputeHash(Encoding.UTF8.GetBytes(formWasFinded.Password));
                    if (hashOfTruePass.SequenceEqual(formClassicAuth.HashOfPassword))
                    {
                        resultOfOperation.OperationWasFinishedSuccessful = true;
                    }
                    else
                    {
                        resultOfOperation.ErrorMessage = "Правильность пароля под сомнением?";
                        resultOfOperation.OperationWasFinishedSuccessful = false;
                    }
                    break;

                case AuthenticationMethod.Sign:
                    var formSignAuth = formAuth as IAuthenticationFormSign;
                    if (formSignAuth == null)
                    {
                        throw new InvalidCastException("Преобразование из типа IAuthenticationForm в тип " +
                                                       "IAuthenticationFormSign завершилось с ошибкой.")
                              {
                                  Source = GetType().AssemblyQualifiedName
                              }
                    }
                    ;
                    var signAlg = cryptoFactory.CreateSignAlgoritm(formSignAuth.CryptoProvider, formSignAuth.SignantureAlgoritmName);
                    //var signAlg = cryptoFactory.CreateSignAlgoritm(choosenCrypto.Provider, formSignAuth.SignantureAlgoritmName);
                    signAlg.Import(formWasFinded.KeyParametrsBlob.Key);
                    if (signAlg.VerifySign(formSignAuth.Hash, formSignAuth.Sign))
                    {
                        resultOfOperation.OperationWasFinishedSuccessful = true;
                    }
                    else
                    {
                        resultOfOperation.ErrorMessage = "Достоверность цифровой подписи под сомнением?";
                        resultOfOperation.OperationWasFinishedSuccessful = false;
                    }
                    break;
                }
                OfflineMessagesConcurent messages;
                OfflineMessagesF.TryRemove(formWasFinded.Login, out messages);
                if (messages == null)
                {
                    messages = new OfflineMessagesConcurent(formWasFinded.Login);
                }
                return(new Tuple <UserFormSurrogate, OfflineMessagesConcurent>(formWasFinded, messages));
            }
            catch (InvalidOperationException ex)
            {
                CreateResultWithError(3, resultOfOperation, formAuth.Login);
                return(null);
            }
        }
 //public abstract UserForm GetPublicKey();
 /// <exception cref="ArgumentNullException">form == null. -или- resultOfOperation == null.</exception>
 public abstract Task <Tuple <UserFormSurrogate, OfflineMessagesConcurent> > AuthenticateUserAsync(
     IAuthenticationForm formAuth,
     CryptoFactoryBase cryptoFactory, CryptoInfo choosenCrypto, ResultOfOperation resultOfOperation);