I would like to convert a SecureString to an IntPtr. Until now, in .net 4.7 I was using this way:
try
{
IntPtr bstr1 = IntPtr.Zero;
bstr1 = Marshal.SecureStringToBSTR(ss1);
}
finally
{
if (bstr2 != IntPtr.Zero) Marshal.ZeroFreeBSTR(bstr2);
if (bstr1 != IntPtr.Zero) Marshal.ZeroFreeBSTR(bstr1);
}
But I am trying to convert this project to .net standard 1.6, but the method is not available in Marshal type.
So I would like to know how to convert the SecureString to IntPtr in .net standard.
Thanks.