Beispiel #1
0
 public void SetUp()
 {
     m_serFactory =
         new SerializerFactory();
     omg.org.IOP.CodecFactory codecFactory =
         new CodecFactoryImpl(m_serFactory);
     m_codec =
         codecFactory.create_codec(
             new omg.org.IOP.Encoding(omg.org.IOP.ENCODING_CDR_ENCAPS.ConstVal, 1, 2));
     m_iiopUrlUtil =
         IiopUrlUtil.Create(m_codec, new object[] {
         Services.CodeSetService.CreateDefaultCodesetComponent(m_codec)
     });
     m_serFactory.Initalize(new SerializerFactoryConfig(), m_iiopUrlUtil);
 }
Beispiel #2
0
        internal SslConnectionListener(SecurityAssociationOptions requiredOptions,
                                       SecurityAssociationOptions supportedOptions,
                                       IServerSideAuthentication serverAuth,
                                       omg.org.IOP.Codec codec)
        {
            m_codec = codec;

            if (((requiredOptions & SecurityAssociationOptions.NoProtection) > 0) &&
                (((supportedOptions & SecurityAssociationOptions.EstablishTrustInTarget) > 0) ||
                 ((supportedOptions & SecurityAssociationOptions.EstablishTrustInClient) > 0)))
            {
                throw new ArgumentException("unsupported options combination: required no protection and supported EstablishTrustInTarget/Client");
            }

            SecureProtocol protocol       = SecureProtocol.None;
            SslAlgorithms  allowedCiphers = SslAlgorithms.ALL;

            if (((supportedOptions & SecurityAssociationOptions.EstablishTrustInTarget) > 0) ||
                ((supportedOptions & SecurityAssociationOptions.EstablishTrustInClient) > 0))
            {
                protocol       = SecureProtocol.Tls1 | SecureProtocol.Ssl3;
                allowedCiphers = SslAlgorithms.SECURE_CIPHERS;
                m_isSecured    = true;
            }

            CredentialVerification clientVerification = CredentialVerification.None;
            CertVerifyEventHandler verifyClient       = null;
            SecurityFlags          authFlags          = SecurityFlags.Default;

            if (((supportedOptions & SecurityAssociationOptions.EstablishTrustInClient) > 0) ||
                ((requiredOptions & SecurityAssociationOptions.EstablishTrustInClient) > 0))
            {
                clientVerification = CredentialVerification.Manual;
                verifyClient       = new CertVerifyEventHandler(this.CheckClientCertAtServer);
            }
            if ((requiredOptions & SecurityAssociationOptions.EstablishTrustInClient) > 0)
            {
                authFlags = SecurityFlags.MutualAuthentication;
            }

            m_sslOpts = new SecurityOptions(protocol, serverAuth.GetServerCertificate(), ConnectionEnd.Server,
                                            clientVerification, verifyClient,
                                            null, authFlags, allowedCiphers, null);
            m_serverAuth       = serverAuth;
            m_supportedOptions = supportedOptions;
            m_requiredOptions  = requiredOptions;
        }
Beispiel #3
0
 internal SslConnectionListener(SecurityAssociationOptions requiredOptions,
                                SecurityAssociationOptions supportedOptions,
                                IServerSideAuthentication serverAuth,
                                omg.org.IOP.Codec codec) {
     m_codec = codec;
     
     if (((requiredOptions & SecurityAssociationOptions.NoProtection) > 0) &&
         (((supportedOptions & SecurityAssociationOptions.EstablishTrustInTarget) > 0) ||
          ((supportedOptions & SecurityAssociationOptions.EstablishTrustInClient) > 0))) {
         throw new ArgumentException("unsupported options combination: required no protection and supported EstablishTrustInTarget/Client");
     }
     
     SecureProtocol protocol = SecureProtocol.None;
     SslAlgorithms allowedCiphers = SslAlgorithms.ALL;
     if (((supportedOptions & SecurityAssociationOptions.EstablishTrustInTarget) > 0) ||
         ((supportedOptions & SecurityAssociationOptions.EstablishTrustInClient) > 0)) {
         protocol = SecureProtocol.Tls1 | SecureProtocol.Ssl3;
         allowedCiphers = SslAlgorithms.SECURE_CIPHERS;
         m_isSecured = true;
     }
     
     CredentialVerification clientVerification = CredentialVerification.None;
     CertVerifyEventHandler verifyClient = null;
     SecurityFlags authFlags = SecurityFlags.Default;
     if (((supportedOptions & SecurityAssociationOptions.EstablishTrustInClient) > 0) ||
         ((requiredOptions & SecurityAssociationOptions.EstablishTrustInClient) > 0)) {
         clientVerification = CredentialVerification.Manual;
         verifyClient = new CertVerifyEventHandler(this.CheckClientCertAtServer);
     }
     if ((requiredOptions & SecurityAssociationOptions.EstablishTrustInClient) > 0) {
         authFlags = SecurityFlags.MutualAuthentication;
     }
                                                                                           
     m_sslOpts = new SecurityOptions(protocol, serverAuth.GetServerCertificate(), ConnectionEnd.Server,
                                     clientVerification, verifyClient,
                                     null, authFlags, allowedCiphers, null);
     m_serverAuth = serverAuth;
     m_supportedOptions = supportedOptions;
     m_requiredOptions = requiredOptions;
 }
 public void SetUp()
 {
     m_serFactory =
         new SerializerFactory();
     omg.org.IOP.CodecFactory codecFactory =
         new CodecFactoryImpl(m_serFactory);
     m_codec =
         codecFactory.create_codec(
             new omg.org.IOP.Encoding(omg.org.IOP.ENCODING_CDR_ENCAPS.ConstVal, 1, 2));
     m_iiopUrlUtil =
         IiopUrlUtil.Create(m_codec, new object[] { 
             Services.CodeSetService.CreateDefaultCodesetComponent(m_codec)});
     m_serFactory.Initalize(new SerializerFactoryConfig(), m_iiopUrlUtil);
 }
        /// <summary>initalize the channel</summary>
        private void InitChannel()
        {
            if (m_port < 0)
            {
                throw new ArgumentException("illegal port to listen on: " + m_port);
            }
            Ch.Elca.Iiop.Marshalling.ArgumentsSerializerFactory argumentSerializerFactory =
                omg.org.CORBA.OrbServices.GetSingleton().ArgumentsSerializerFactory;
            CodecFactory codecFactory =
                omg.org.CORBA.OrbServices.GetSingleton().CodecFactory;
            m_codec = codecFactory.create_codec(
                    new omg.org.IOP.Encoding(omg.org.IOP.ENCODING_CDR_ENCAPS.ConstVal,
                                             1, 2));
            m_transportFactory.Codec = m_codec;
            m_iiopUrlUtil = omg.org.CORBA.OrbServices.GetSingleton().IiopUrlUtil;
            m_hostNameToUse = DetermineMachineNameToUse();
            SetupChannelData(m_hostNameToUse, m_port, m_codec, null);
            m_connectionListener =
                m_transportFactory.CreateConnectionListener(new ClientAccepted(this.ProcessClientMessages));

            // create the default provider chain, if no chain specified
            if (m_providerChain == null)
            {
                m_providerChain = new IiopServerFormatterSinkProvider();
            }
            GiopMessageHandler messageHandler =
                new GiopMessageHandler(argumentSerializerFactory,
                                       m_headerFlags, m_interceptionOptions);
            ConfigureSinkProviderChain(messageHandler);

            IServerChannelSink sinkChain = ChannelServices.CreateServerChannelSinkChain(m_providerChain, this);
            m_transportSink = new IiopServerTransportSink(sinkChain);

            if (m_bidirConnectionManager != null)
            {
                // bidirectional entry point into server channel sink chain.
                m_bidirConnectionManager.RegisterMessageReceptionHandler(m_transportSink,
                                                                         m_serverThreadsMaxPerConnection);
            }

            // ready to wait for messages
            StartListening(null);
            // publish init-service
            Services.CORBAInitServiceImpl.Publish();
            // public the handler for generic corba operations
            StandardCorbaOps.SetUpHandler();
        }