コード例 #1
0
        void CheckValidationResult(
            ICertificateValidator validator, string targetHost, bool serverMode,
            X509CertificateCollection certificates, bool wantsChain,
            X509Chain chain, MonoBtlsX509StoreCtx storeCtx,
            bool success, ref MonoSslPolicyErrors errors, ref int status11)
        {
            status11 = unchecked ((int)0);
            if (success)
            {
                return;
            }
            errors = MonoSslPolicyErrors.RemoteCertificateChainErrors;
            if (!wantsChain || storeCtx == null || chain == null)
            {
                status11 = unchecked ((int)0x800B010B);
                return;
            }
            var error = storeCtx.GetError();

            if (error != Mono.Btls.MonoBtlsX509Error.OK &
                error != Mono.Btls.MonoBtlsX509Error.CRL_NOT_YET_VALID)
            {
                chain.Impl.AddStatus(MapVerifyErrorToChainStatus(error));
                status11 = unchecked ((int)0x800B010B);
            }
        }
コード例 #2
0
ファイル: MonoBtlsProvider.cs プロジェクト: marcinm100/mono
        void CheckValidationResult(
            ICertificateValidator validator, string targetHost, bool serverMode,
            X509CertificateCollection certificates, bool wantsChain,
            X509Chain chain, MonoBtlsX509StoreCtx storeCtx,
            bool success, ref MonoSslPolicyErrors errors, ref int status11)
        {
            status11 = unchecked ((int)0);
            if (success)
            {
                return;
            }
            errors = MonoSslPolicyErrors.RemoteCertificateChainErrors;
            if (!wantsChain || storeCtx == null || chain == null)
            {
                status11 = unchecked ((int)0x800B010B);
                return;
            }
            var error = storeCtx.GetError();

            switch (error)
            {
            case Mono.Btls.MonoBtlsX509Error.OK:
                errors = MonoSslPolicyErrors.None;
                break;

            case Mono.Btls.MonoBtlsX509Error.CRL_NOT_YET_VALID:
                break;

            case MonoBtlsX509Error.HOSTNAME_MISMATCH:
                errors = MonoSslPolicyErrors.RemoteCertificateNameMismatch;
                chain.Impl.AddStatus(X509ChainStatusFlags.UntrustedRoot);
                status11 = unchecked ((int)0x800B010B);
                break;

            default:
                chain.Impl.AddStatus(MapVerifyErrorToChainStatus(error));
                status11 = unchecked ((int)0x800B010B);
                break;
            }
        }