Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
GitHub or Developer Community with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
In this file on GitHub https://github.com/mono/mono/blob/master/mcs/class/System/System.Net/NetworkCredential.cs
the implementation does not convert the SecureString password to the decrypted Password.
Many code snippets suggest using the following to get the decrypted string from a SecureString `encrypted`:
string decrypted = new System.Net.NetworkCredential(string.Empty, encrypted).Password;
As can be seen in the code above, this would not do anything in the Mono implementation of NetworkCredential.
Fortunately, the following works on Mono:
IntPtr unmanagedString = IntPtr.Zero;
unmanagedString = Marshal.SecureStringToGlobalAllocUnicode(encrypted);
decrypted = Marshal.PtrToStringUni(unmanagedString);
It might be nice to implement this in NetworkCredential as well.
Another related issue https://github.com/NuGet/Home/issues/3763
Fixed in Mono master/c3b6638688417bc385da743ab965f5dd6d2ed592 and mono-4.8.0-branch/f4b4f97fc8353cae364711f56ad50d11ab467049