complete login function and login window also add attached properties and helper classes for securestring

This commit is contained in:
Rene Schwarz
2021-04-03 23:52:00 +02:00
parent 077f622115
commit a42f756d78
32 changed files with 377 additions and 37 deletions

View File

@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Security;
using System.Text;
namespace Server_Dashboard {
public static class SecureStringHelpers {
public static string Unsecure(this SecureString secureString) {
if (secureString == null)
return string.Empty;
var unmanagedString = IntPtr.Zero;
try {
unmanagedString = Marshal.SecureStringToGlobalAllocUnicode(secureString);
return Marshal.PtrToStringUni(unmanagedString);
} finally {
Marshal.ZeroFreeGlobalAllocUnicode(unmanagedString);
}
}
}
}