Пример #1
0
        protected override void Init()
        {
            base.Init();

            SBSSLServer = new SBSSLServer.TElSSLServer(null);

            //SBSSLServer.OnOpenConnection += new SBSSLCommon.TSBOpenConnectionEvent(OnSecureServerOpenConnection);
            //SBSSLServer.OnCloseConnection += new SBSSLServer.TSBCloseConnectionEvent(OnSecureServerCloseConnection);
            //SBSSLServer.OnData += new SBSSLCommon.TSBDataEvent(OnSecureServerOnData);
            //SBSSLServer.OnSend += new SBSSLCommon.TSBSendEvent(OnSecureServerSend);

            //SBSSLServer.OnReceive += new SBSSLCommon.TSBReceiveEvent(OnSecureServerReceive);
            //SBSSLServer.OnCertificateValidate += new SBSSLCommon.TSBCertificateValidateEvent(OnSecureServerCertificateValidate);
            //SBSSLServer.OnError += new SBSSLCommon.TSBErrorEvent(OnSecureServerError);
            //SBSSLServer.OnCiphersNegotiated += new SBUtils.TNotifyEvent(OnSecureServerCiphersNegotiated);

            //default initialization
            SBSSLServer.ClientAuthentication = false;
            SBSSLServer.Enabled = true;
            SBSSLServer.ForceCertificateChain = false;
            SBSSLServer.Versions = SBSSLConstants.Unit.sbTLS1 | SBSSLConstants.Unit.sbTLS11 | SBSSLConstants.Unit.sbTLS12;

            /*
             #if (CHROME_LIB && MONO)
             *          // bug in MONO-1.1.9.2 ?
             *          SBSSLServer.SetCipherSuite(SBSSLConstants.Unit.SB_SUITE_NULL_NULL_NULL, true);
             #else
             *          SBSSLServer.set_CipherSuites(SBSSLConstants.Unit.SB_SUITE_NULL_NULL_NULL, true);
             #endif
             * */// commented out by II 20110107
        }
Пример #2
0
        private void InitializeAcceptedSSLSocket(SBSSLServer.TElSSLServer sbListenServer)
        {
            errorOccured = false;
            isListener   = false;
            SBSSLServer.OnOpenConnection      += new SBSSLCommon.TSBOpenConnectionEvent(OnSecureServerOpenConnection);
            SBSSLServer.OnCloseConnection     += new SBSSLCommon.TSBCloseConnectionEvent(OnSecureServerCloseConnection);
            SBSSLServer.OnData                += new SBSSLCommon.TSBDataEvent(OnSecureServerOnData);
            SBSSLServer.OnSend                += new SBSSLCommon.TSBSendEvent(OnSecureServerSend);
            SBSSLServer.OnReceive             += new SBSSLCommon.TSBReceiveEvent(OnSecureServerReceive);
            SBSSLServer.OnCertificateValidate += new SBSSLCommon.TSBCertificateValidateEvent(OnSecureServerCertificateValidate);
            SBSSLServer.OnError               += new SBSSLCommon.TSBErrorEvent(OnSecureServerError);
            SBSSLServer.OnCiphersNegotiated   += new SBUtils.TNotifyEvent(OnSecureServerCiphersNegotiated);
            SBSSLServer.OnCertificateURLs     += new TSBCertificateURLsEvent(OnSecureServerCertificateURLs);
            SBSSLServer.OnExtensionsReceived  += new TSBExtensionsReceivedEvent(OnSecureServerExtensionsReceived);
            SBSSLServer.OnKeyNeeded           += new TSBServerKeyNeededEvent(OnSecureServerKeyNeeded);
            SBSSLServer.OnRenegotiationStart  += new TSBRenegotiationStartEvent(OnSecureServerRenegotiationStart);
            if (sbListenServer != null)
            {
                SBSSLServer.ClientAuthentication = sbListenServer.ClientAuthentication;
                SBSSLServer.Enabled = sbListenServer.Enabled;
                SBSSLServer.ForceCertificateChain = sbListenServer.ForceCertificateChain;
                SBSSLServer.Versions          = sbListenServer.Versions;
                SBSSLServer.CertStorage       = sbListenServer.CertStorage;
                SBSSLServer.ClientCertStorage = sbListenServer.CertStorage;
                SBSSLServer.Extensions.Assign(sbListenServer.Extensions);
                SBSSLServer.Options = sbListenServer.Options;
                SBSSLServer.RenegotiationAttackPreventionMode = sbListenServer.RenegotiationAttackPreventionMode;

                for (short i = SBSSLConstants.Unit.SB_SUITE_FIRST;
                     i < SBSSLConstants.Unit.SB_SUITE_LAST; i++)
#if (CHROME_LIB && MONO)
                {               // bug in MONO-1.1.9.2 ?
                    SBSSLServer.SetCipherSuite(i,
                                               sbListenServer.GetCipherSuite(i));
                }
#else
                { SBSSLServer.set_CipherSuites(i,
                                               sbListenServer.get_CipherSuites(i)); }
#endif
                for (short i = SBSSLConstants.Unit.SSL_CA_FIRST;
                     i < SBSSLConstants.Unit.SSL_CA_LAST; i++)
#if (CHROME_LIB && MONO)
                {               // bug in MONO-1.1.9.2 ?
                    SBSSLServer.SetCompressionAlgorithms(i,
                                                         sbListenServer.GetCompressionAlgorithms(i));
                }
#else
                { SBSSLServer.set_CompressionAlgorithms(i,
                                                        sbListenServer.get_CompressionAlgorithms(i)); }
#endif
            }
        }