コード例 #1
0
 static XLocalCertificateSelectionCallback ConvertCallback(MonoLocalCertificateSelectionCallback callback)
 {
     if (callback == null)
     {
         return(null);
     }
     return((s, t, lc, rc, ai) => callback(t, lc, rc, ai));
 }
コード例 #2
0
#pragma warning restore 618

        public override MonoSslStream CreateSslStream(
            Stream innerStream, bool leaveInnerStreamOpen,
            MonoRemoteCertificateValidationCallback userCertificateValidationCallback,
            MonoLocalCertificateSelectionCallback userCertificateSelectionCallback,
            MonoTlsSettings settings = null)
        {
            throw new NotImplementedException();
        }
コード例 #3
0
        public override IMonoTlsContext CreateTlsContext(
            string hostname, bool serverMode, TlsProtocols protocolFlags,
            SSCX.X509Certificate serverCertificate, PSSCX.X509CertificateCollection clientCertificates,
            bool remoteCertRequired, bool checkCertName, bool checkCertRevocationStatus,
            MonoEncryptionPolicy encryptionPolicy,
            MonoRemoteCertificateValidationCallback userCertificateValidationCallback,
            MonoLocalCertificateSelectionCallback userCertificateSelectionCallback,
            MonoTlsSettings settings)
        {
            TlsConfiguration config;

            if (serverMode)
            {
                var cert     = (PSSCX.X509Certificate2)serverCertificate;
                var monoCert = new MX.X509Certificate(cert.RawData);
                config = new TlsConfiguration((TlsProtocols)protocolFlags, (TlsSettings)settings, monoCert, cert.PrivateKey);
            }
            else
            {
                config = new TlsConfiguration((TlsProtocols)protocolFlags, (TlsSettings)settings, hostname);
                                #if FIXME
                if (certSelectionDelegate != null)
                {
                    config.Client.LocalCertSelectionCallback = (t, l, r, a) => certSelectionDelegate(t, l, r, a);
                }
                                #endif
                if (userCertificateValidationCallback != null)
                {
                    config.RemoteCertValidationCallback = (h, c, ch, p) => {
                        var ssc = new SSCX.X509Certificate(c.RawData);
                        return(userCertificateValidationCallback(h, ssc, null, (MonoSslPolicyErrors)p));
                    };
                }
            }

            return(new TlsContextWrapper(config));
        }
コード例 #4
0
ファイル: DotNetTlsProvider.cs プロジェクト: JokerGITHUB/mono
		internal static LocalCertificateSelectionCallback ConvertCallback (MonoLocalCertificateSelectionCallback callback)
		{
			if (callback == null)
				return null;

			return (s, t, lc, rc, ai) => callback (t, lc, rc, ai);
		}