/// <summary>
/// Dispose the instance
/// </summary>
/// <param name="bIsDisposing"></param>
protected void Dispose(bool bIsDisposing)
{
// Check if we have an inbound credential
if (_inboundCredential.IsValid())
{
// Call into security API to release the credentials
if (SecurityWrapper.FreeCredentialsHandle(ref _inboundCredential) != (int)SecResult.Ok)
{
// Throw an exception
throw new Exception("Failed to release inbound credentials handle");
}
// Reset inbound credential
_inboundCredential = new SecurityHandle();
}
// Check if we have an outbound credential
if (_outboundCredential.IsValid())
{
// Call into security API to release the credentials
if (SecurityWrapper.FreeCredentialsHandle(ref _outboundCredential) != (int)SecResult.Ok)
{
// Throw an exception
throw new Exception("Failed to release outbound credentials handle");
}
// Reset inbound credential
_outboundCredential = new SecurityHandle();
}
}