Qt 5.6 | Qt Network | C++ Classes | QSslSocket

Qt 5.6.2 Reference Documentation

# Obsolete Members for QSslSocket

The following members of class QSslSocket are obsolete. They are provided to keep old source code working. We strongly advise against using them in new code.

## Public Functions

`(obsolete)` QList<QSslCertificate> | caCertificates() const
`(obsolete)` QList<QSslCipher> | ciphers() const
`(obsolete)` void | setCaCertificates(const QList<QSslCertificate> &certificates)
`(obsolete)` void | setCiphers(const QList<QSslCipher> &ciphers)
`(obsolete)` void | setCiphers(const QString &ciphers)

## Static Public Members

`(obsolete)` QList<QSslCertificate> | defaultCaCertificates()
`(obsolete)` QList<QSslCipher> | defaultCiphers()
`(obsolete)` void | setDefaultCaCertificates(const QList<QSslCertificate> &certificates)
`(obsolete)` void | setDefaultCiphers(const QList<QSslCipher> &ciphers)
`(obsolete)` QList<QSslCipher> | supportedCiphers()
`(obsolete)` QList<QSslCertificate> | systemCaCertificates()

## Member Function Documentation

### QList<QSslCertificate> QSslSocket::caCertificates() const

Use QSslConfiguration::caCertificates() instead.

Returns this socket's CA certificate database. The CA certificate database is used by the socket during the handshake phase to validate the peer's certificate. It can be moodified prior to the handshake with addCaCertificate(), addCaCertificates(), and setCaCertificates().

Note: On Unix, this method may return an empty list if the root certificates are loaded on demand.

See also addCaCertificate(), addCaCertificates(), and setCaCertificates().

### QList<QSslCipher> QSslSocket::ciphers() const

Use QSslConfiguration::ciphers() instead.

Returns this socket's current cryptographic cipher suite. This list is used during the socket's handshake phase for choosing a session cipher. The returned list of ciphers is ordered by descending preference. (i.e., the first cipher in the list is the most preferred cipher). The session cipher will be the first one in the list that is also supported by the peer.

By default, the handshake phase can choose any of the ciphers supported by this system's SSL libraries, which may vary from system to system. The list of ciphers supported by this system's SSL libraries is returned by supportedCiphers(). You can restrict the list of ciphers used for choosing the session cipher for this socket by calling setCiphers() with a subset of the supported ciphers. You can revert to using the entire set by calling setCiphers() with the list returned by supportedCiphers().

You can restrict the list of ciphers used for choosing the session cipher for all sockets by calling setDefaultCiphers() with a subset of the supported ciphers. You can revert to using the entire set by calling setCiphers() with the list returned by supportedCiphers().

See also setCiphers(), defaultCiphers(), setDefaultCiphers(), and supportedCiphers().

### `[static]` QList<QSslCertificate> QSslSocket::defaultCaCertificates()

Use QSslConfiguration::caCertificates() on the default QSslConfiguration instead.

Returns the current default CA certificate database. This database is originally set to your system's default CA certificate database. If no system default database is found, an empty database will be returned. You can override the default CA certificate database with your own CA certificate database using setDefaultCaCertificates().

Each SSL socket's CA certificate database is initialized to the default CA certificate database.

Note: On Unix, this method may return an empty list if the root certificates are loaded on demand.

See also setDefaultCaCertificates() and caCertificates().

### `[static]` QList<QSslCipher> QSslSocket::defaultCiphers()

Use QSslConfiguration::ciphers() on the default QSslConfiguration instead.

Returns the default cryptographic cipher suite for all sockets in this application. This list is used during the socket's handshake phase when negotiating with the peer to choose a session cipher. The list is ordered by preference (i.e., the first cipher in the list is the most preferred cipher).

By default, the handshake phase can choose any of the ciphers supported by this system's SSL libraries, which may vary from system to system. The list of ciphers supported by this system's SSL libraries is returned by supportedCiphers().

See also setDefaultCiphers() and supportedCiphers().

### void QSslSocket::setCaCertificates(const QList<QSslCertificate> &certificates)

Use QSslConfiguration::setCaCertificates() instead.

Sets this socket's CA certificate database to be certificates. The certificate database must be set prior to the SSL handshake. The CA certificate database is used by the socket during the handshake phase to validate the peer's certificate.

The CA certificate database can be reset to the current default CA certificate database by calling this function with the list of CA certificates returned by defaultCaCertificates().

See also caCertificates() and defaultCaCertificates().

### void QSslSocket::setCiphers(const QList<QSslCipher> &ciphers)

USe QSslConfiguration::setCiphers() instead.

Sets the cryptographic cipher suite for this socket to ciphers, which must contain a subset of the ciphers in the list returned by supportedCiphers().

Restricting the cipher suite must be done before the handshake phase, where the session cipher is chosen.

See also ciphers(), setDefaultCiphers(), and supportedCiphers().

### void QSslSocket::setCiphers(const QString &ciphers)

Use QSslConfiguration::setCiphers() instead.

Sets the cryptographic cipher suite for this socket to ciphers, which is a colon-separated list of cipher suite names. The ciphers are listed in order of preference, starting with the most preferred cipher. For example:

      QSslSocket socket;
      socket.setCiphers("DHE-RSA-AES256-SHA:DHE-DSS-AES256-SHA:AES256-SHA");

Each cipher name in ciphers must be the name of a cipher in the list returned by supportedCiphers(). Restricting the cipher suite must be done before the handshake phase, where the session cipher is chosen.

See also ciphers(), setDefaultCiphers(), and supportedCiphers().

### `[static]` void QSslSocket::setDefaultCaCertificates(const QList<QSslCertificate> &certificates)

Use QSslConfiguration::setCaCertificates() on the default QSslConfiguration instead.

Sets the default CA certificate database to certificates. The default CA certificate database is originally set to your system's default CA certificate database. You can override the default CA certificate database with your own CA certificate database using this function.

Each SSL socket's CA certificate database is initialized to the default CA certificate database.

See also defaultCaCertificates() and addDefaultCaCertificate().

### `[static]` void QSslSocket::setDefaultCiphers(const QList<QSslCipher> &ciphers)

Use QSslConfiguration::setCiphers() on the default QSslConfiguration instead.

Sets the default cryptographic cipher suite for all sockets in this application to ciphers, which must contain a subset of the ciphers in the list returned by supportedCiphers().

Restricting the default cipher suite only affects SSL sockets that perform their handshake phase after the default cipher suite has been changed.

See also setCiphers(), defaultCiphers(), and supportedCiphers().

### `[static]` QList<QSslCipher> QSslSocket::supportedCiphers()

Use QSslConfiguration::supportedCiphers() instead.

Returns the list of cryptographic ciphers supported by this system. This list is set by the system's SSL libraries and may vary from system to system.

See also defaultCiphers(), ciphers(), and setCiphers().

### `[static]` QList<QSslCertificate> QSslSocket::systemCaCertificates()

Use QSslConfiguration::systemDefaultCaCertificates instead.

This function provides the CA certificate database provided by the operating system. The CA certificate database returned by this function is used to initialize the database returned by defaultCaCertificates(). You can replace that database with your own with setDefaultCaCertificates().

See also caCertificates(), defaultCaCertificates(), and setDefaultCaCertificates().