33 lines
824 B
C#
33 lines
824 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Runtime.ConstrainedExecution;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace NSspi.Credentials
|
|
{
|
|
/// <summary>
|
|
/// Provides a managed handle to an SSPI credential.
|
|
/// </summary>
|
|
public class SafeCredentialHandle : SafeSspiHandle
|
|
{
|
|
public SafeCredentialHandle()
|
|
: base()
|
|
{ }
|
|
|
|
[ReliabilityContract( Consistency.WillNotCorruptState, Cer.Success )]
|
|
protected override bool ReleaseHandle()
|
|
{
|
|
SecurityStatus status = CredentialNativeMethods.FreeCredentialsHandle(
|
|
ref base.rawHandle
|
|
);
|
|
|
|
base.ReleaseHandle();
|
|
|
|
return status == SecurityStatus.OK;
|
|
}
|
|
}
|
|
|
|
}
|