Files
NSspi/Contexts/Context.cs

58 lines
1.2 KiB
C#

using NSspi.Contexts;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NSspi
{
public class Context : IDisposable
{
private bool disposed;
public Context( Credential cred )
{
this.Credential = cred;
this.disposed = false;
}
~Context()
{
Dispose( false );
}
protected Credential Credential { get; private set; }
public long ContextHandle { get; protected set; }
public void Dispose()
{
Dispose( true );
GC.SuppressFinalize( this );
}
protected virtual void Dispose( bool disposing )
{
if( this.disposed ) { return; }
if( disposing )
{
this.Credential.Dispose();
}
long contextHandleCopy = this.ContextHandle;
ContextNativeMethods.DeleteSecurityContext( ref contextHandleCopy );
this.ContextHandle = 0;
this.disposed = true;
}
public byte[] Encrypt( byte[] input )
{
}
}
}