Ejemplo n.º 1
0
            internal int OnVerifyCertThunk(int ok, IntPtr store_ctx)
            {
                X509StoreContext ctx  = new X509StoreContext(store_ctx, false);
                X509Certificate  cert = ctx.CurrentCert;
                int          depth    = ctx.ErrorDepth;
                VerifyResult result   = (VerifyResult)ctx.Error;
                // build the X509Chain from the store
                X509Store store = ctx.Store;

                Core.Stack <X509Object> objStack = store.Objects;
                X509Chain chain = new X509Chain();

                foreach (X509Object obj in objStack)
                {
                    X509Certificate objCert = obj.Certificate;
                    if (objCert != null)
                    {
                        chain.Add(objCert);
                    }
                }
                // Call the managed delegate
                if (OnVerifyCert(this, cert, chain, depth, result))
                {
                    return(1);
                }
                else
                {
                    return(0);
                }
            }
Ejemplo n.º 2
0
        private int OnVerifyCertThunk(int ok, IntPtr store)
        {
            var ctx = new X509StoreContext(store, false);

            // build the X509Chain from the store
            using (var chain = new X509Chain())
            {
                foreach (var obj in ctx.Store.Objects)
                {
                    var cert = obj.Certificate;
                    if (cert != null)
                    {
                        chain.Add(cert);
                    }
                }

                // Call the managed delegate
                return(OnVerifyCert(
                           this,
                           ctx.CurrentCert,
                           chain,
                           ctx.ErrorDepth,
                           (VerifyResult)ctx.Error
                           ) ? 1 : 0);
            }
        }
Ejemplo n.º 3
0
            internal int OnVerifyCertThunk(int ok, IntPtr store_ctx)
            {
                var             ctx    = new X509StoreContext(store_ctx, false);
                X509Certificate cert   = ctx.CurrentCert;
                int             depth  = ctx.ErrorDepth;
                var             result = (VerifyResult)ctx.Error;
                // build the X509Chain from the store
                var store    = ctx.Store;
                var objStack = store.Objects;
                var chain    = new X509Chain();

                foreach (var objCert in objStack.Select(obj => obj.Certificate).Where(objCert => objCert != null))
                {
                    chain.Add(objCert);
                }
                // Call the managed delegate
                return(OnVerifyCert(this, cert, chain, depth, result) ? 1 : 0);
            }