Example #1
0
 /// <summary>
 ///     Gets a <see cref="SafeCTLHandleContext" /> for the X509 certificate revocation list. The caller of this
 ///     method owns the returned safe handle, and should dispose of it when they no longer need it.
 ///     This handle can be used independently of the lifetime of the original X509 certificate revocation list.
 /// </summary>
 /// <returns>Safe handle to a current CTL instance.</returns>
 /// <permission cref="SecurityPermission">
 ///     The immediate caller must have SecurityPermission/UnmanagedCode to use this method
 /// </permission>
 public SafeCTLHandleContext GetSafeContext()
 {
     if (!Handle.Equals(IntPtr.Zero))
     {
         SafeCTLHandleContext safeContext = Crypt32.CertDuplicateCTLContext(Handle);
         GC.KeepAlive(this);
         return(safeContext);
     }
     throw new UninitializedObjectException();
 }