Пример #1
0
 /// <summary>
 /// Establishes a connection with a broker using SSL
 ///
 /// </summary>
 /// <param name="host">Host name on which a broker is deployed</param>
 /// <param name="port">Broker port </param>
 /// <param name="virtualHost">virtual host name</param>
 /// <param name="username">User Name</param>
 /// <param name="password">Password</param>
 /// <param name="mechanism">SASL authentication mechanism, possible values: PLAIN, EXTERNAL, DIGEST-MD5, ANONYMOUS</param>
 /// <param name="serverName">Name of the SSL server</param>
 /// <param name="certPath">Path to the X509 certificate to be used for client authentication</param>
 /// <param name="certPass">Password to certificate file, pass null if no password is required</param>
 /// <param name="rejectUntrusted">If true connection will not be established if the broker is not trusted</param>
 public void ConnectSSL(String host, int port, String virtualHost, String username, String password, String mechanism, string serverName, string certPath, String certPass, bool rejectUntrusted)
 {
     _log.Debug(String.Format("Client Connecting to host {0}; port {1}; virtualHost {2}; username {3}; mechanism {4}",
                              host, port, virtualHost, username, mechanism));
     _log.Debug(String.Format("SSL parameters: serverName: {0}; certPath: {1}; rejectUntrusted: {2}", serverName, certPath, rejectUntrusted));
     _conn = IoSSLTransport.Connect(host, port, virtualHost, mechanism, serverName, certPath, certPass, rejectUntrusted, this);
 }
Пример #2
0
        /// <summary>
        /// Establishes a connection with a broker using SSL
        ///
        /// </summary>
        /// <param name="host">Host name on which a broker is deployed</param>
        /// <param name="port">Broker port </param>
        /// <param name="mechanism">SASL authentication mechanism, possible values: PLAIN, EXTERNAL, DIGEST-MD5, ANONYMOUS</param>
        /// <param name="certificate">X509 certificate to be used for client authentication</param>
        /// <param name="rejectUntrusted">If true connection will not be established if the broker is not trusted</param>
        public void ConnectSSL(String host, int port, String mechanism, X509Certificate certificate, bool rejectUntrusted)
        {
            _log.Debug(String.Format("Client Connecting to host {0}; port {1}; mechanism {2}",
                                     host, port, mechanism));
            _log.Debug(String.Format("SSL parameters: certSubject: {0}; rejectUntrusted: {1}",
                                     certificate.Subject, rejectUntrusted));

            _conn = IoSSLTransport.Connect(host, port, mechanism, certificate, rejectUntrusted, this);
        }