Skip to content

PythonQt.QtNetwork.QSslSocket · declarations 002

Back to PythonQt.QtNetwork.QSslSocket

hostFound

hostFound(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtNetwork.QSslSocket.hostFound; argument details are not documented.

ignoreSslErrors

ignoreSslErrors(errors: Any) -> None

X.ignoreSslErrors(errors)

Supplemental documentation: Qt 5 reference:

[slot] void QSslSocket::ignoreSslErrors()

This slot tells QSslSocket to ignore errors during QSslSocket's handshake phase and continue connecting. If you want to continue with the connection even if errors occur during the handshake phase, then you must call this slot, either from a slot connected to sslErrors(), or before the handshake phase. If you don't call this slot, either in response to errors or before the handshake, the connection will be dropped after the sslErrors() signal has been emitted.

If there are no errors during the SSL handshake phase (i.e., the identity of the peer is established with no problems), QSslSocket will not emit the sslErrors() signal, and it is unnecessary to call this function.

Warning: Be sure to always let the user inspect the errors reported by the sslErrors() signal, and only call this method upon confirmation from the user that proceeding is ok. If there are unexpected errors, the connection should be aborted. Calling this method without inspecting the actual errors will most likely pose a security risk for your application. Use it with great care!

See also sslErrors().

void QSslSocket::ignoreSslErrors(const QList\<QSslError> \&errors)

This is an overloaded function.

This method tells QSslSocket to ignore only the errors given in errors.

Note: Because most SSL errors are associated with a certificate, for most of them you must set the expected certificate this SSL error is related to. If, for instance, you want to connect to a server that uses a self-signed certificate, consider the following snippet:

QList<QSslCertificate> cert = QSslCertificate::fromPath(QLatin1String("server-certificate.pem"));
QSslError error(QSslError::SelfSignedCertificate, cert.at(0));
QList<QSslError> expectedSslErrors;
expectedSslErrors.append(error);

QSslSocket socket;
socket.ignoreSslErrors(expectedSslErrors);
socket.connectToHostEncrypted("server.tld", 443);

Multiple calls to this function will replace the list of errors that were passed in previous calls. You can clear the list of errors you want to ignore by calling this function with an empty list.

This function was introduced in Qt 4.6.

See also sslErrors() and sslHandshakeErrors().

Upstream PySide2 reference signatures (binding differences may apply):

ignoreSslErrors(self) -> None
ignoreSslErrors(self, errors: typing.Sequence[PySide2.QtNetwork.QSslError]) -> None

Source: https://doc.qt.io/archives/qt-5.15/qsslsocket.html#ignoreSslErrors

isEncrypted

isEncrypted() -> bool

X.isEncrypted() -> bool

Supplemental documentation: Qt 5 reference:

bool QSslSocket::isEncrypted() const

Returns true if the socket is encrypted; otherwise, false is returned.

An encrypted socket encrypts all data that is written by calling write() or putChar() before the data is written to the network, and decrypts all incoming data as the data is received from the network, before you call read(), readLine() or getChar().

QSslSocket emits encrypted() when it enters encrypted mode.

You can call sessionCipher() to find which cryptographic cipher is used to encrypt and decrypt your data.

See also mode().

Upstream PySide2 reference signatures (binding differences may apply):

isEncrypted(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qsslsocket.html#isEncrypted

isValid

isValid() -> bool

X.isValid() -> bool

localAddress

localAddress() -> Any

X.localAddress() -> PythonQt.QtNetwork.QHostAddress

localCertificate

localCertificate() -> Any

X.localCertificate() -> PythonQt.QtNetwork.QSslCertificate

Supplemental documentation: Qt 5 reference:

QSslCertificate QSslSocket::localCertificate() const

Returns the socket's local certificate, or an empty certificate if no local certificate has been assigned.

See also setLocalCertificate() and privateKey().

Upstream PySide2 reference signatures (binding differences may apply):

localCertificate(self) -> PySide2.QtNetwork.QSslCertificate

Source: https://doc.qt.io/archives/qt-5.15/qsslsocket.html#localCertificate

localCertificateChain

localCertificateChain() -> tuple

X.localCertificateChain() -> tuple

Supplemental documentation: Qt 5 reference:

QList\<QSslCertificate> QSslSocket::localCertificateChain() const

Returns the socket's local certificate chain, or an empty list if no local certificates have been assigned.

This function was introduced in Qt 5.1.

See also setLocalCertificateChain().

Upstream PySide2 reference signatures (binding differences may apply):

localCertificateChain(self) -> typing.List[PySide2.QtNetwork.QSslCertificate]

Source: https://doc.qt.io/archives/qt-5.15/qsslsocket.html#localCertificateChain

localPort

localPort() -> int

X.localPort() -> int

mode

mode() -> Any

X.mode()

Supplemental documentation: Qt 5 reference:

QSslSocket::SslMode QSslSocket::mode() const

Returns the current mode for the socket; either UnencryptedMode, where QSslSocket behaves identially to QTcpSocket, or one of SslClientMode or SslServerMode, where the client is either negotiating or in encrypted mode.

When the mode changes, QSslSocket emits modeChanged()

See also SslMode.

Upstream PySide2 reference signatures (binding differences may apply):

mode(self) -> PySide2.QtNetwork.QSslSocket.SslMode

Source: https://doc.qt.io/archives/qt-5.15/qsslsocket.html#mode

modeChanged

modeChanged(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtNetwork.QSslSocket.modeChanged; argument details are not documented.

Supplemental documentation: Qt 5 reference:

[signal] void QSslSocket::modeChanged(QSslSocket::SslMode mode)

This signal is emitted when QSslSocket changes from QSslSocket::UnencryptedMode to either QSslSocket::SslClientMode or QSslSocket::SslServerMode. mode is the new mode.

See also QSslSocket::mode().

Source: https://doc.qt.io/archives/qt-5.15/qsslsocket.html#modeChanged

newSessionTicketReceived

newSessionTicketReceived(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtNetwork.QSslSocket.newSessionTicketReceived; argument details are not documented.

Supplemental documentation: Qt 5 reference:

[signal] void QSslSocket::newSessionTicketReceived()

If TLS 1.3 protocol was negotiated during a handshake, QSslSocket emits this signal after receiving NewSessionTicket message. Session and session ticket's lifetime hint are updated in the socket's configuration. The session can be used for session resumption (and a shortened handshake) in future TLS connections.

Note: This functionality enabled only with OpenSSL backend and requires OpenSSL v 1.1.1 or above.

This function was introduced in Qt 5.15.

See also QSslSocket::sslConfiguration(), QSslConfiguration::sessionTicket(), and QSslConfiguration::sessionTicketLifeTimeHint().

Source: https://doc.qt.io/archives/qt-5.15/qsslsocket.html#newSessionTicketReceived

objectNameChanged

objectNameChanged(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtNetwork.QSslSocket.objectNameChanged; argument details are not documented.

pauseMode

pauseMode() -> Any

X.pauseMode()

peerAddress

peerAddress() -> Any

X.peerAddress() -> PythonQt.QtNetwork.QHostAddress

peerCertificate

peerCertificate() -> Any

X.peerCertificate() -> PythonQt.QtNetwork.QSslCertificate

Supplemental documentation: Qt 5 reference:

QSslCertificate QSslSocket::peerCertificate() const

Returns the peer's digital certificate (i.e., the immediate certificate of the host you are connected to), or a null certificate, if the peer has not assigned a certificate.

The peer certificate is checked automatically during the handshake phase, so this function is normally used to fetch the certificate for display or for connection diagnostic purposes. It contains information about the peer, including its host name, the certificate issuer, and the peer's public key.

Because the peer certificate is set during the handshake phase, it is safe to access the peer certificate from a slot connected to the sslErrors() signal or the encrypted() signal.

If a null certificate is returned, it can mean the SSL handshake failed, or it can mean the host you are connected to doesn't have a certificate, or it can mean there is no connection.

If you want to check the peer's complete chain of certificates, use peerCertificateChain() to get them all at once.

See also peerCertificateChain().

Upstream PySide2 reference signatures (binding differences may apply):

peerCertificate(self) -> PySide2.QtNetwork.QSslCertificate

Source: https://doc.qt.io/archives/qt-5.15/qsslsocket.html#peerCertificate

peerCertificateChain

peerCertificateChain() -> tuple

X.peerCertificateChain() -> tuple

Supplemental documentation: Qt 5 reference:

QList\<QSslCertificate> QSslSocket::peerCertificateChain() const

Returns the peer's chain of digital certificates, or an empty list of certificates.

Peer certificates are checked automatically during the handshake phase. This function is normally used to fetch certificates for display, or for performing connection diagnostics. Certificates contain information about the peer and the certificate issuers, including host name, issuer names, and issuer public keys.

The peer certificates are set in QSslSocket during the handshake phase, so it is safe to call this function from a slot connected to the sslErrors() signal or the encrypted() signal.

If an empty list is returned, it can mean the SSL handshake failed, or it can mean the host you are connected to doesn't have a certificate, or it can mean there is no connection.

If you want to get only the peer's immediate certificate, use peerCertificate().

See also peerCertificate().

Upstream PySide2 reference signatures (binding differences may apply):

peerCertificateChain(self) -> typing.List[PySide2.QtNetwork.QSslCertificate]

Source: https://doc.qt.io/archives/qt-5.15/qsslsocket.html#peerCertificateChain

peerName

peerName() -> str

X.peerName() -> str

peerPort

peerPort() -> int

X.peerPort() -> int

peerVerifyDepth

peerVerifyDepth() -> int

X.peerVerifyDepth() -> int

Supplemental documentation: Qt 5 reference:

int QSslSocket::peerVerifyDepth() const

Returns the maximum number of certificates in the peer's certificate chain to be checked during the SSL handshake phase, or 0 (the default) if no maximum depth has been set, indicating that the whole certificate chain should be checked.

The certificates are checked in issuing order, starting with the peer's own certificate, then its issuer's certificate, and so on.

This function was introduced in Qt 4.4.

See also setPeerVerifyDepth() and peerVerifyMode().

Upstream PySide2 reference signatures (binding differences may apply):

peerVerifyDepth(self) -> int

Source: https://doc.qt.io/archives/qt-5.15/qsslsocket.html#peerVerifyDepth

peerVerifyError

peerVerifyError(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtNetwork.QSslSocket.peerVerifyError; argument details are not documented.

Supplemental documentation: Qt 5 reference:

[signal] void QSslSocket::peerVerifyError(const QSslError \&error)

QSslSocket can emit this signal several times during the SSL handshake, before encryption has been established, to indicate that an error has occurred while establishing the identity of the peer. The error is usually an indication that QSslSocket is unable to securely identify the peer.

This signal provides you with an early indication when something's wrong. By connecting to this signal, you can manually choose to tear down the connection from inside the connected slot before the handshake has completed. If no action is taken, QSslSocket will proceed to emitting QSslSocket::sslErrors().

This function was introduced in Qt 4.4.

See also sslErrors().

Source: https://doc.qt.io/archives/qt-5.15/qsslsocket.html#peerVerifyError

peerVerifyMode

peerVerifyMode() -> Any

X.peerVerifyMode()

Supplemental documentation: Qt 5 reference:

QSslSocket::PeerVerifyMode QSslSocket::peerVerifyMode() const

Returns the socket's verify mode. This mode decides whether QSslSocket should request a certificate from the peer (i.e., the client requests a certificate from the server, or a server requesting a certificate from the client), and whether it should require that this certificate is valid.

The default mode is AutoVerifyPeer, which tells QSslSocket to use VerifyPeer for clients and QueryPeer for servers.

This function was introduced in Qt 4.4.

See also setPeerVerifyMode(), peerVerifyDepth(), and mode().

Upstream PySide2 reference signatures (binding differences may apply):

peerVerifyMode(self) -> PySide2.QtNetwork.QSslSocket.PeerVerifyMode

Source: https://doc.qt.io/archives/qt-5.15/qsslsocket.html#peerVerifyMode

peerVerifyName

peerVerifyName() -> str

X.peerVerifyName() -> str

Supplemental documentation: Qt 5 reference:

QString QSslSocket::peerVerifyName() const

Returns the different hostname for the certificate validation, as set by setPeerVerifyName or by connectToHostEncrypted.

This function was introduced in Qt 4.8.

See also setPeerVerifyName() and connectToHostEncrypted().

Upstream PySide2 reference signatures (binding differences may apply):

peerVerifyName(self) -> str

Source: https://doc.qt.io/archives/qt-5.15/qsslsocket.html#peerVerifyName

preSharedKeyAuthenticationRequired

preSharedKeyAuthenticationRequired(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtNetwork.QSslSocket.preSharedKeyAuthenticationRequired; argument details are not documented.

Supplemental documentation: Qt 5 reference:

[signal] void QSslSocket::preSharedKeyAuthenticationRequired(QSslPreSharedKeyAuthenticator *authenticator)

QSslSocket emits this signal when it negotiates a PSK ciphersuite, and therefore a PSK authentication is then required.

When using PSK, the client must send to the server a valid identity and a valid pre shared key, in order for the SSL handshake to continue. Applications can provide this information in a slot connected to this signal, by filling in the passed authenticator object according to their needs.

Note: Ignoring this signal, or failing to provide the required credentials, will cause the handshake to fail, and therefore the connection to be aborted.

Note: The authenticator object is owned by the socket and must not be deleted by the application.

This function was introduced in Qt 5.5.

See also QSslPreSharedKeyAuthenticator.

Source: https://doc.qt.io/archives/qt-5.15/qsslsocket.html#preSharedKeyAuthenticationRequired

privateKey

privateKey() -> Any

X.privateKey() -> PythonQt.QtNetwork.QSslKey

Supplemental documentation: Qt 5 reference:

QSslKey QSslSocket::privateKey() const

Returns this socket's private key.

See also setPrivateKey() and localCertificate().

Upstream PySide2 reference signatures (binding differences may apply):

privateKey(self) -> PySide2.QtNetwork.QSslKey

Source: https://doc.qt.io/archives/qt-5.15/qsslsocket.html#privateKey

protocol

protocol() -> Any

X.protocol()

Supplemental documentation: Qt 5 reference:

QSsl::SslProtocol QSslSocket::protocol() const

Returns the socket's SSL protocol. By default, QSsl::SecureProtocols is used.

See also setProtocol().

Upstream PySide2 reference signatures (binding differences may apply):

protocol(self) -> PySide2.QtNetwork.QSsl.SslProtocol

Source: https://doc.qt.io/archives/qt-5.15/qsslsocket.html#protocol

proxy

proxy() -> Any

X.proxy() -> PythonQt.QtNetwork.QNetworkProxy

proxyAuthenticationRequired

proxyAuthenticationRequired(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtNetwork.QSslSocket.proxyAuthenticationRequired; argument details are not documented.

readBufferSize

readBufferSize() -> int

X.readBufferSize() -> int

readChannelFinished

readChannelFinished(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtNetwork.QSslSocket.readChannelFinished; argument details are not documented.

readData

readData(data: str, maxlen: int) -> int

X.readData(data, maxlen) -> int

Supplemental documentation: Qt 5 reference:

[override virtual protected] qint64 QSslSocket::readData(char *data, qint64 maxlen)

Reimplements: QAbstractSocket::readData(char *data, qint64 maxSize).

Upstream PySide2 reference signatures (binding differences may apply):

readData(self, data: str, maxlen: int) -> int

Source: https://doc.qt.io/archives/qt-5.15/qsslsocket.html#readData

readyRead

readyRead(*args: Any, **kwargs: Any) -> Any

Native PythonQt.QtNetwork.QSslSocket.readyRead; argument details are not documented.

resume

resume() -> None

X.resume()

Supplemental documentation: Qt 5 reference:

[override virtual] void QSslSocket::resume()

Reimplements: QAbstractSocket::resume().

Continues data transfer on the socket after it has been paused. If "setPauseMode(QAbstractSocket::PauseOnSslErrors);" has been called on this socket and a sslErrors() signal is received, calling this method is necessary for the socket to continue.

This function was introduced in Qt 5.0.

See also QAbstractSocket::pauseMode() and QAbstractSocket::setPauseMode().

Upstream PySide2 reference signatures (binding differences may apply):

resume(self) -> None

Source: https://doc.qt.io/archives/qt-5.15/qsslsocket.html#resume

sessionCipher

sessionCipher() -> Any

X.sessionCipher() -> PythonQt.QtNetwork.QSslCipher

Supplemental documentation: Qt 5 reference:

QSslCipher QSslSocket::sessionCipher() const

Returns the socket's cryptographic cipher, or a null cipher if the connection isn't encrypted. The socket's cipher for the session is set during the handshake phase. The cipher is used to encrypt and decrypt data transmitted through the socket.

QSslSocket also provides functions for setting the ordered list of ciphers from which the handshake phase will eventually select the session cipher. This ordered list must be in place before the handshake phase begins.

See also QSslConfiguration::ciphers(), QSslConfiguration::setCiphers(), QSslConfiguration::setCiphers(), QSslConfiguration::ciphers(), and QSslConfiguration::supportedCiphers().

Upstream PySide2 reference signatures (binding differences may apply):

sessionCipher(self) -> PySide2.QtNetwork.QSslCipher

Source: https://doc.qt.io/archives/qt-5.15/qsslsocket.html#sessionCipher

sessionProtocol

sessionProtocol() -> Any

X.sessionProtocol()

Supplemental documentation: Qt 5 reference:

QSsl::SslProtocol QSslSocket::sessionProtocol() const

Returns the socket's SSL/TLS protocol or UnknownProtocol if the connection isn't encrypted. The socket's protocol for the session is set during the handshake phase.

This function was introduced in Qt 5.4.

See also protocol() and setProtocol().

Upstream PySide2 reference signatures (binding differences may apply):

sessionProtocol(self) -> PySide2.QtNetwork.QSsl.SslProtocol

Source: https://doc.qt.io/archives/qt-5.15/qsslsocket.html#sessionProtocol

setCaCertificates

setCaCertificates(certificates: Any) -> None

X.setCaCertificates(certificates)

Upstream PySide2 reference signatures (binding differences may apply):

setCaCertificates(self, certificates: typing.Sequence[PySide2.QtNetwork.QSslCertificate]) -> None

Source: https://doc.qt.io/archives/qt-5.15/qsslsocket.html#setCaCertificates

setCiphers

setCiphers(ciphers: Any) -> None

X.setCiphers(ciphers)

Upstream PySide2 reference signatures (binding differences may apply):

setCiphers(self, ciphers: typing.Sequence[PySide2.QtNetwork.QSslCipher]) -> None
setCiphers(self, ciphers: str) -> None

Source: https://doc.qt.io/archives/qt-5.15/qsslsocket.html#setCiphers

setDefaultCaCertificates

setDefaultCaCertificates(certificates: Any) -> None

X.setDefaultCaCertificates(certificates)

Upstream PySide2 reference signatures (binding differences may apply):

setDefaultCaCertificates(certificates: typing.Sequence[PySide2.QtNetwork.QSslCertificate]) -> None

Source: https://doc.qt.io/archives/qt-5.15/qsslsocket.html#setDefaultCaCertificates

setDefaultCiphers

setDefaultCiphers(ciphers: Any) -> None

X.setDefaultCiphers(ciphers)

Upstream PySide2 reference signatures (binding differences may apply):

setDefaultCiphers(ciphers: typing.Sequence[PySide2.QtNetwork.QSslCipher]) -> None

Source: https://doc.qt.io/archives/qt-5.15/qsslsocket.html#setDefaultCiphers

setLocalAddress

setLocalAddress(address: Any) -> Any

X.setLocalAddress(address)

setLocalCertificate

setLocalCertificate(fileName: Any, format: Any) -> None

X.setLocalCertificate(fileName, format)

Supplemental documentation: Qt 5 reference:

void QSslSocket::setLocalCertificate(const QSslCertificate \&certificate)

Sets the socket's local certificate to certificate. The local certificate is necessary if you need to confirm your identity to the peer. It is used together with the private key; if you set the local certificate, you must also set the private key.

The local certificate and private key are always necessary for server sockets, but are also rarely used by client sockets if the server requires the client to authenticate.

Note: Secure Transport SSL backend on macOS may update the default keychain (the default is probably your login keychain) by importing your local certificates and keys. This can also result in system dialogs showing up and asking for permission when your application is using these private keys. If such behavior is undesired, set the QT_SSL_USE_TEMPORARY_KEYCHAIN environment variable to a non-zero value; this will prompt QSslSocket to use its own temporary keychain.

See also localCertificate() and setPrivateKey().

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

This is an overloaded function.

Sets the socket's local certificate to the first one found in file path, which is parsed according to the specified format.

Upstream PySide2 reference signatures (binding differences may apply):

setLocalCertificate(self, certificate: PySide2.QtNetwork.QSslCertificate) -> None
setLocalCertificate(self, fileName: str, format: PySide2.QtNetwork.QSsl.EncodingFormat=...) -> None

Source: https://doc.qt.io/archives/qt-5.15/qsslsocket.html#setLocalCertificate