Ejemplo n.º 1
0
        private async Task <DoLoginResource> DoLogin(GetRsaKeyResource getRsaKeyResource, string password, string username, string twoFactorCode)
        {
            var encryptedPassword = Encrypter.Create(getRsaKeyResource, password);

            var content = PostDataFactory.CreateDoLoginData(username, encryptedPassword, getRsaKeyResource.Timestamp, twoFactorCode);

            var requestMessage  = new RequestMessage(HttpMethod.Post, _baseUrl + "login/dologin", body: content);
            var doLoginResource = await _jsonRequestParser.ExecuteAsType <DoLoginResource>(requestMessage);

            return(doLoginResource);
        }
Ejemplo n.º 2
0
        internal static string Create(GetRsaKeyResource getRsaKeyResponse, string password)
        {
            var encrypterModel = new EncrypterModel
            {
                PublicKeyExp = getRsaKeyResponse.PublicKeyExp,
                PublicKeyMod = getRsaKeyResponse.PublicKeyMod,
                Password     = password
            };
            var encrypted = string.Empty;

            while (encrypted.Length < 2 || encrypted.Substring(encrypted.Length - 2) != "==")
            {
                encrypted = EncryptPassword(encrypterModel);
            }

            return(encrypted);
        }