Messing around with verification and impersonation with WindowsIdentity.

This commit is contained in:
antiduh
2014-06-19 21:52:10 +00:00
parent d7d552ad58
commit cca5cf8486

View File

@@ -1,14 +1,41 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq; using System.Linq;
using System.Runtime.Serialization;
using System.Security.Principal;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Xml.Serialization;
namespace NSspi namespace NSspi
{ {
public class Program public class Program
{ {
public static void Main( string[] args ) public static void Main( string[] args )
{
IdentTest();
}
private static void IdentTest()
{
WindowsIdentity current = WindowsIdentity.GetCurrent( TokenAccessLevels.MaximumAllowed );
Stream stream = new MemoryStream();
StringWriter writer = new StringWriter();
ISerializable serializable = current;
SerializationInfo info = new SerializationInfo( current.GetType(), new FormatterConverter() );
StreamingContext streamingContext = new StreamingContext();
serializable.GetObjectData( info, streamingContext );
WindowsIdentity newId = new WindowsIdentity( info, streamingContext );
}
private static void CredTest()
{ {
Credential cred = null; Credential cred = null;
try try