2016-09-16 35 views
0

我在谷歌和論壇搜索,但沒有發現任何關於我的奇怪問題。 SRY我的英語不好:)Edittext.Text顯示正確的值,但使用了錯誤

這真的很奇怪和困難,所以我想在EditText上儘可能簡單地

  1. 用戶輸入discribe它(類型:textPassword):1 - >已登錄 - >工作

    var loginResult = await connection.LoginAsync(this.Username.Text,this.Password.Text,WebLoginType.User);

  2. 密碼在 「2FYM9iWHHecf45vPjjZPfg ==」 加密它

    變種newLogin =新LoginData { 用戶名= this.Username.Text, 密碼= Encrypter.Encrypt(this.Password.Text) WebServiceAddress = this.WebServiceAddress.Text, IsOnline = true, IsActive = true, License = this._license };

  3. 現在註銷時,密碼再次以「1」解密,但在佈局中,我可以看到它在edittext中有多個字符。 this.Edittext.Text =「1」

    this.Password.SetText(Encrypter.Decrypt(setting.LastLoginPassword),TextView.BufferType.Normal);

  4. 如果我再次登錄我可以看到this.Edittext.Text爲「1」,但WebService的說,這是錯誤的密碼

現在,如果我的EditText刪除字符和手動寫「1 「 有用。 發生了什麼魔術?

+2

顯示相關代碼.... –

+0

從edittext中提取修剪值 string pass = trim(edittexName.getText()); – siddhesh

+0

*已添加相關代碼 – BananazZ

回答

0

解決Probem:加密器使用\ u0000填充剩餘的字節,直到它獲得其16個字節的大小。我不得不刪除這與

return Encoding.UTF8.GetString(result, 0, result.Length).TrimEnd('\u0000'); 

現在它的工作。

相關問題