namespace com.hitrust.Security.Certificates { using System; using System.Threading; internal class CertificateVerificationResult : IAsyncResult { private object m_AsyncState; private AsyncCallback m_Callback; private CertificateChain m_Chain; private VerificationFlags m_Flags; private bool m_HasEnded; private bool m_IsCompleted; private string m_Server; private CertificateStatus m_Status; private Exception m_ThrowException; private AuthType m_Type; private ManualResetEvent m_WaitHandle; public CertificateVerificationResult(CertificateChain chain, string server, AuthType type, VerificationFlags flags, AsyncCallback callback, object asyncState) { this.m_Chain = chain; this.m_Server = server; this.m_Type = type; this.m_Flags = flags; this.m_AsyncState = asyncState; this.m_Callback = callback; this.m_WaitHandle = null; this.m_HasEnded = false; } internal void VerificationCompleted(Exception error, CertificateStatus status) { this.m_ThrowException = error; this.m_Status = status; this.m_IsCompleted = true; if (this.m_Callback != null) { this.m_Callback(this); } if (this.m_WaitHandle != null) { this.m_WaitHandle.Set(); } } public object AsyncState { get { return this.m_AsyncState; } } public WaitHandle AsyncWaitHandle { get { if (this.m_WaitHandle == null) { this.m_WaitHandle = new ManualResetEvent(false); } return this.m_WaitHandle; } } public CertificateChain Chain { get { return this.m_Chain; } } public bool CompletedSynchronously { get { return false; } } public VerificationFlags Flags { get { return this.m_Flags; } } public bool HasEnded { get { return this.m_HasEnded; } set { this.m_HasEnded = value; } } public bool IsCompleted { get { return this.m_IsCompleted; } } public string Server { get { return this.m_Server; } } public CertificateStatus Status { get { return this.m_Status; } } public Exception ThrowException { get { return this.m_ThrowException; } } public AuthType Type { get { return this.m_Type; } } } }