问题
I am working on a Windows 10 Universal App(HTML+WinJS). I need to do Sharepoint authentication in the same. I have created a Windows runtime component to write C# code for authentication. I refered below link: https://coderwall.com/p/ho2uwq/authentication-in-sharepoint-2013-using-c-csom-client
Now my problem is that When we use this C# code in ‘Windows Runtime component’ it does not recognize SecureString class which is included in ‘System.Security.Cryptography’ namespace used for creating secure password and pass it to the SharePointOnlineCredentials’ authentication service. Because System.Security.Cryptography is included in the full .NET (desktop .NET), and the .NET for UWP does not have it.
How to proceed now?
回答1:
There is no SecureString
equivalent in the Universal Windows Platform at this point in time. It would need to be exposed as a WinRT API, not a .NET API, so that you could use it for input controls in XAML etc.
If you just want to encrypt the value, there are options with the Windows.Security.Cryptography
namespace, but the plaintext would still be available in the memory space of the app (eg, by having it exist in the page file or a crash dump).
回答2:
Probably now we have a nuget package which you can refer and SecureString will be available in UWP app. https://www.nuget.org/packages/System.Security.SecureString
来源:https://stackoverflow.com/questions/32647296/windows-runtime-component-system-security-cryptography