diff options
author | Alexander Köplinger <alex.koeplinger@outlook.com> | 2016-11-04 00:57:20 +0300 |
---|---|---|
committer | Alexander Köplinger <alex.koeplinger@outlook.com> | 2016-11-04 02:29:41 +0300 |
commit | 3d10e1c039817456f3b0e232e4f2bf86e96a3dfb (patch) | |
tree | a87e02b92b053302d729bce315764adcb759d017 /mcs/class/System/Test | |
parent | fe1f6c80bea4338a0f2d0b6974160194324b7d78 (diff) |
[System] Replace NetworkCredential with referencesource
Fixes an issue where the Mono implementation wasn't converting
between the SecureString and the plaintext version of the password.
Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=44109
Diffstat (limited to 'mcs/class/System/Test')
-rw-r--r-- | mcs/class/System/Test/System.Net/NetworkCredentialTest.cs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/mcs/class/System/Test/System.Net/NetworkCredentialTest.cs b/mcs/class/System/Test/System.Net/NetworkCredentialTest.cs index dbe3255cd68..e5c46f8f901 100644 --- a/mcs/class/System/Test/System.Net/NetworkCredentialTest.cs +++ b/mcs/class/System/Test/System.Net/NetworkCredentialTest.cs @@ -28,6 +28,7 @@ using System; using System.Net; +using System.Security; using NUnit.Framework; @@ -99,6 +100,21 @@ namespace MonoTests.System.Net { nc = new NetworkCredential ("user", "********", "dom"); CheckCustom (nc); } + + [Test] + public void DecipherSecureString () + { + // many code snippets suggest using the following to get the decrypted string from a SecureString + var ss = new SecureString (); + ss.AppendChar('h'); + ss.AppendChar('e'); + ss.AppendChar('l'); + ss.AppendChar('l'); + ss.AppendChar('o'); + + string plain = new NetworkCredential (string.Empty, ss).Password; + Assert.AreEqual ("hello", plain); + } } } |