Home · Modules · Classes · Namespaces · Functions

QxtSslServer Class Reference
[QxtNetwork module]

The QxtSslServer class provides a simple SSL server. More...

    #include <QxtSslServer>

Inherits QTcpServer.

Public Functions

Additional Inherited Members


Detailed Description

The QxtSslServer class provides a simple SSL server.

QxtSslServer is a simple SSL server. As a QTcpServer subclass it shares all of the same behaviors as its parent class, except that new connections are created as QSslSocket objects instead of QTcpSocket objects.

Before QxtSslServer can accept any encrypted connections, the local certificate (see setLocalCertificate) and private key (see setPrivateKey) must be set. Failure to set these properties before accepting connections will cause all incoming connections to generate sslError signals when negotiating encryption. If autoEncrypt is disabled, the local certificate and private key can be set on the individual socket objects before starting encryption; this behavior is generally not necessary unless you wish to serve up a different certificate based on some property of the connection or some data negotiated before beginning encryption.

QxtSslServer is only available if Qt was compiled with OpenSSL support.


Member Function Documentation

QxtSslServer::QxtSslServer ( QObject * parent = 0 )

Constructs a new QxtSslServer object with the specified parent.

bool QxtSslServer::autoEncrypt () const

Returns true if incoming connections will automatically be encrypted, or false otherwise.

See also setAutoEncrypt.

QSslCertificate QxtSslServer::localCertificate () const

Returns the local certificate used to identify the server, or an empty certificate if none has been set.

See also setLocalCertificate.

QSslKey QxtSslServer::privateKey () const

Returns the private key used to encrypt communication, or an empty key if none has been set.

See also setPrivateKey.

void QxtSslServer::setAutoEncrypt ( bool on )

Enables or disables automatically starting encryption on new connections.

Set this property to false if you wish to enable encryption on incoming connections at a later time. The default value is true.

See also autoEncrypt.

void QxtSslServer::setLocalCertificate ( const QSslCertificate & cert )

Sets the certificate to be presented to clients during the SSL handshake.

Setting the certificate only affects new connections established after the certificate has been set.

A certificate is the means of identification used in the SSL process. The local certificate is used by the remote end to verify the local user's identity against its list of Certification Authorities.

See also localCertificate and setPrivateKey.

void QxtSslServer::setLocalCertificate ( const QString & path, QSsl::EncodingFormat format = QSsl::Pem )

This is an overloaded function, provided for convenience.

Sets the certificate to be presented to clients during the SSL handshake to the first certificate contained in the file specified by path.

See also localCertificate.

void QxtSslServer::setPrivateKey ( const QSslKey & key )

Sets the private key used for encryption.

Setting the private key only affects new connections established after the key has been set.

See also privateKey.

void QxtSslServer::setPrivateKey ( const QString & path, QSsl::KeyAlgorithm algo = QSsl::Rsa, QSsl::EncodingFormat format = QSsl::Pem, const QByteArray & passPhrase = QByteArray() )

This is an overloaded function, provided for convenience.

Sets the private key used for encryption to the key contained in the file specified by path. The specified algorithm, format, and pass phrase are used to decrypt the key.

See also privateKey.


Copyright © 2007-2010 Qxt Foundation
Qxt 0.7.0