Exemplo n.º 1
0
        public override bool ValidateCertificate(_SwigCallbackArgs args)
        {
            try
            {
                // Downcast the certificate.
                Certificate cert   = args.mCertificatePtr;
                HandleRef   handle = Certificate.getCPtr(cert);
                IntPtr      ptr    = (IntPtr)handle;

                switch (cert._getType())
                {
                case CertificateImplementationType.Win32:
                    cert = new Win32Certificate(ptr, false);
                    break;

                case CertificateImplementationType.X509:
                    cert = new X509Certificate(ptr, false);
                    break;

                default:
                    cert = new Certificate(ptr, false);
                    break;
                }
                return(mCertValidator(cert));
            }
            catch (Exception e)
            {
                args.mErrorString = e.Message;
            }
            return(false);
        }
Exemplo n.º 2
0
        internal Win32Certificate _downcastToWin32Certificate(Certificate certPtr)
        {
            IntPtr           cPtr = RCFProtoPINVOKE.Certificate__downcastToWin32Certificate(swigCPtr, Certificate.getCPtr(certPtr));
            Win32Certificate ret  = (cPtr == IntPtr.Zero) ? null : new Win32Certificate(cPtr, true);

            if (RCFProtoPINVOKE.SWIGPendingException.Pending)
            {
                throw RCFProtoPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Attempts to locate a root certificate for this certificate, in the given certificate store. Returns the root certificate if found, and otherwise null.
        /// </summary>
        public Win32Certificate FindRootCertificate(Win32CertificateLocation certStoreLocation, Win32CertificateStore certStore)
        {
            IntPtr           cPtr = RCFProtoPINVOKE.Win32Certificate_findRootCertificate(swigCPtr, (int)certStoreLocation, (int)certStore);
            Win32Certificate ret  = (cPtr == IntPtr.Zero) ? null : new Win32Certificate(cPtr, true);

            if (RCFProtoPINVOKE.SWIGPendingException.Pending)
            {
                throw RCFProtoPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Returns the current certificate.
        /// </summary>
        public Win32Certificate Current()
        {
            IntPtr           cPtr = RCFProtoPINVOKE.StoreCertificateIterator_current(swigCPtr);
            Win32Certificate ret  = (cPtr == IntPtr.Zero) ? null : new Win32Certificate(cPtr, true);

            if (RCFProtoPINVOKE.SWIGPendingException.Pending)
            {
                throw RCFProtoPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Exemplo n.º 5
0
 internal static HandleRef getCPtr(Win32Certificate obj)
 {
     return((obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr);
 }