QSslSocket Class Reference

#include <qsslsocket.h>

Class Description

Definition at line 67 of file qsslsocket.h.

+ Inheritance diagram for QSslSocket:

Public Types

enum  SslMode { UnencryptedMode, SslClientMode, SslServerMode }
 
enum  PeerVerifyMode { VerifyNone, QueryPeer, VerifyPeer, AutoVerifyPeer }
 
- Public Types inherited from QAbstractSocket
enum  SocketType { TcpSocket, UdpSocket, UnknownSocketType = -1 }
 
enum  NetworkLayerProtocol { IPv4Protocol, IPv6Protocol, UnknownNetworkLayerProtocol = -1 }
 
enum  SocketError {
  ConnectionRefusedError, RemoteHostClosedError, HostNotFoundError, SocketAccessError,
  SocketResourceError, SocketTimeoutError, DatagramTooLargeError, NetworkError,
  AddressInUseError, SocketAddressNotAvailableError, UnsupportedSocketOperationError, UnfinishedSocketOperationError,
  ProxyAuthenticationRequiredError, SslHandshakeFailedError, ProxyConnectionRefusedError, ProxyConnectionClosedError,
  ProxyConnectionTimeoutError, ProxyNotFoundError, ProxyProtocolError, UnknownSocketError = -1
}
 
enum  SocketState {
  UnconnectedState, HostLookupState, ConnectingState, ConnectedState,
  BoundState, ListeningState, ClosingState
}
 
enum  SocketOption { LowDelayOption, KeepAliveOption, MulticastTtlOption, MulticastLoopbackOption }
 
- Public Types inherited from QIODevice
enum  OpenModeFlag {
  NotOpen = 0x0000, ReadOnly = 0x0001, WriteOnly = 0x0002, ReadWrite = ReadOnly | WriteOnly,
  Append = 0x0004, Truncate = 0x0008, Text = 0x0010, Unbuffered = 0x0020
}
 

Public Slots

void startClientEncryption ()
 
void startServerEncryption ()
 
void ignoreSslErrors ()
 
- Public Slots inherited from QObject
void deleteLater ()
 

Signals

void encrypted ()
 
void peerVerifyError (const QSslError &error)
 
void sslErrors (const QList< QSslError > &errors)
 
void modeChanged (QSslSocket::SslMode newMode)
 
void encryptedBytesWritten (qint64 totalBytes)
 
- Signals inherited from QAbstractSocket
void hostFound ()
 
void connected ()
 
void disconnected ()
 
void stateChanged (QAbstractSocket::SocketState)
 
void error (QAbstractSocket::SocketError)
 
void proxyAuthenticationRequired (const QNetworkProxy &proxy, QAuthenticator *authenticator)
 
- Signals inherited from QIODevice
void readyRead ()
 
void bytesWritten (qint64 bytes)
 
void aboutToClose ()
 
void readChannelFinished ()
 
- Signals inherited from QObject
void destroyed (QObject *=0)
 

Public Member Functions

 QSslSocket (QObject *parent=0)
 
 ~QSslSocket ()
 
void connectToHostEncrypted (const QString &hostName, quint16 port, OpenMode mode=ReadWrite)
 
void connectToHostEncrypted (const QString &hostName, quint16 port, const QString &sslPeerName, OpenMode mode=ReadWrite)
 
bool setSocketDescriptor (int socketDescriptor, SocketState state=ConnectedState, OpenMode openMode=ReadWrite)
 
void setSocketOption (QAbstractSocket::SocketOption option, const QVariant &value)
 
QVariant socketOption (QAbstractSocket::SocketOption option)
 
SslMode mode () const
 
bool isEncrypted () const
 
QSsl::SslProtocol protocol () const
 
void setProtocol (QSsl::SslProtocol protocol)
 
QSslSocket::PeerVerifyMode peerVerifyMode () const
 
void setPeerVerifyMode (QSslSocket::PeerVerifyMode mode)
 
int peerVerifyDepth () const
 
void setPeerVerifyDepth (int depth)
 
QString peerVerifyName () const
 
void setPeerVerifyName (const QString &hostName)
 
qint64 bytesAvailable () const
 
qint64 bytesToWrite () const
 
bool canReadLine () const
 
void close ()
 
bool atEnd () const
 
bool flush ()
 
void abort ()
 
void setReadBufferSize (qint64 size)
 
qint64 encryptedBytesAvailable () const
 
qint64 encryptedBytesToWrite () const
 
QSslConfiguration sslConfiguration () const
 
void setSslConfiguration (const QSslConfiguration &config)
 
void setLocalCertificate (const QSslCertificate &certificate)
 
void setLocalCertificate (const QString &fileName, QSsl::EncodingFormat format=QSsl::Pem)
 
QSslCertificate localCertificate () const
 
QSslCertificate peerCertificate () const
 
QList< QSslCertificatepeerCertificateChain () const
 
QSslCipher sessionCipher () const
 
void setPrivateKey (const QSslKey &key)
 
void setPrivateKey (const QString &fileName, QSsl::KeyAlgorithm algorithm=QSsl::Rsa, QSsl::EncodingFormat format=QSsl::Pem, const QByteArray &passPhrase=QByteArray())
 
QSslKey privateKey () const
 
QList< QSslCipherciphers () const
 
void setCiphers (const QList< QSslCipher > &ciphers)
 
void setCiphers (const QString &ciphers)
 
bool addCaCertificates (const QString &path, QSsl::EncodingFormat format=QSsl::Pem, QRegExp::PatternSyntax syntax=QRegExp::FixedString)
 
void addCaCertificate (const QSslCertificate &certificate)
 
void addCaCertificates (const QList< QSslCertificate > &certificates)
 
void setCaCertificates (const QList< QSslCertificate > &certificates)
 
QList< QSslCertificatecaCertificates () const
 
bool waitForConnected (int msecs=30000)
 
bool waitForEncrypted (int msecs=30000)
 
bool waitForReadyRead (int msecs=30000)
 
bool waitForBytesWritten (int msecs=30000)
 
bool waitForDisconnected (int msecs=30000)
 
QList< QSslErrorsslErrors () const
 
void ignoreSslErrors (const QList< QSslError > &errors)
 
- Public Member Functions inherited from QTcpSocket
 QTcpSocket (QObject *parent=0)
 
virtual ~QTcpSocket ()
 
- Public Member Functions inherited from QAbstractSocket
 QAbstractSocket (SocketType socketType, QObject *parent)
 
virtual ~QAbstractSocket ()
 
void connectToHost (const QString &hostName, quint16 port, OpenMode mode=ReadWrite)
 
void connectToHost (const QHostAddress &address, quint16 port, OpenMode mode=ReadWrite)
 
void disconnectFromHost ()
 
bool isValid () const
 
quint16 localPort () const
 
QHostAddress localAddress () const
 
quint16 peerPort () const
 
QHostAddress peerAddress () const
 
QString peerName () const
 
qint64 readBufferSize () const
 
void setReadBufferSize (qint64 size)
 
void abort ()
 
int socketDescriptor () const
 
bool setSocketDescriptor (int socketDescriptor, SocketState state=ConnectedState, OpenMode openMode=ReadWrite)
 
void setSocketOption (QAbstractSocket::SocketOption option, const QVariant &value)
 
QVariant socketOption (QAbstractSocket::SocketOption option)
 
SocketType socketType () const
 
SocketState state () const
 
SocketError error () const
 
bool isSequential () const
 
bool flush ()
 
bool waitForConnected (int msecs=30000)
 
bool waitForDisconnected (int msecs=30000)
 
void setProxy (const QNetworkProxy &networkProxy)
 
QNetworkProxy proxy () const
 
- Public Member Functions inherited from QIODevice
 QIODevice ()
 
 QIODevice (QObject *parent)
 
virtual ~QIODevice ()
 
OpenMode openMode () const
 
void setTextModeEnabled (bool enabled)
 
bool isTextModeEnabled () const
 
bool isOpen () const
 
bool isReadable () const
 
bool isWritable () const
 
virtual bool open (OpenMode mode)
 
virtual qint64 pos () const
 
virtual qint64 size () const
 
virtual bool seek (qint64 pos)
 
virtual bool reset ()
 
qint64 read (char *data, qint64 maxlen)
 
QByteArray read (qint64 maxlen)
 
QByteArray readAll ()
 
qint64 readLine (char *data, qint64 maxlen)
 
QByteArray readLine (qint64 maxlen=0)
 
qint64 write (const char *data, qint64 len)
 
qint64 write (const char *data)
 
qint64 write (const QByteArray &data)
 
qint64 peek (char *data, qint64 maxlen)
 
QByteArray peek (qint64 maxlen)
 
void ungetChar (char c)
 
bool putChar (char c)
 
bool getChar (char *c)
 
QString errorString () const
 
- Public Member Functions inherited from QObject
Q_INVOKABLE QObject (QObject *parent=0)
 
virtual ~QObject ()
 
virtual bool event (QEvent *)
 
virtual bool eventFilter (QObject *, QEvent *)
 
QString objectName () const
 
void setObjectName (const QString &name)
 
bool isWidgetType () const
 
bool signalsBlocked () const
 
bool blockSignals (bool b)
 
QThreadthread () const
 
void moveToThread (QThread *thread)
 
int startTimer (int interval)
 
void killTimer (int id)
 
template<typename T >
findChild (const QString &aName=QString()) const
 
template<typename T >
QList< T > findChildren (const QString &aName=QString()) const
 
template<typename T >
QList< T > findChildren (const QRegExp &re) const
 
const QObjectListchildren () const
 
void setParent (QObject *)
 
void installEventFilter (QObject *)
 
void removeEventFilter (QObject *)
 
bool connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const
 
bool disconnect (const char *signal=0, const QObject *receiver=0, const char *member=0)
 
bool disconnect (const QObject *receiver, const char *member=0)
 
void dumpObjectTree ()
 
void dumpObjectInfo ()
 
bool setProperty (const char *name, const QVariant &value)
 
QVariant property (const char *name) const
 
QList< QByteArraydynamicPropertyNames () const
 
void setUserData (uint id, QObjectUserData *data)
 
QObjectUserDatauserData (uint id) const
 
QObjectparent () const
 
bool inherits (const char *classname) const
 

Static Public Member Functions

static void setDefaultCiphers (const QList< QSslCipher > &ciphers)
 
static QList< QSslCipherdefaultCiphers ()
 
static QList< QSslCiphersupportedCiphers ()
 
static bool addDefaultCaCertificates (const QString &path, QSsl::EncodingFormat format=QSsl::Pem, QRegExp::PatternSyntax syntax=QRegExp::FixedString)
 
static void addDefaultCaCertificate (const QSslCertificate &certificate)
 
static void addDefaultCaCertificates (const QList< QSslCertificate > &certificates)
 
static void setDefaultCaCertificates (const QList< QSslCertificate > &certificates)
 
static QList< QSslCertificatedefaultCaCertificates ()
 
static QList< QSslCertificatesystemCaCertificates ()
 
static bool supportsSsl ()
 
- Static Public Member Functions inherited from QObject
static bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
 
static bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
 
static bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member)
 
static uint registerUserData ()
 

Protected Slots

void connectToHostImplementation (const QString &hostName, quint16 port, OpenMode openMode)
 
void disconnectFromHostImplementation ()
 
- Protected Slots inherited from QAbstractSocket
void connectToHostImplementation (const QString &hostName, quint16 port, OpenMode mode=ReadWrite)
 
void disconnectFromHostImplementation ()
 

Protected Member Functions

qint64 readData (char *data, qint64 maxlen)
 
qint64 writeData (const char *data, qint64 len)
 
- Protected Member Functions inherited from QTcpSocket
 QTcpSocket (QTcpSocketPrivate &dd, QObject *parent=0)
 
- Protected Member Functions inherited from QAbstractSocket
qint64 readLineData (char *data, qint64 maxlen)
 
void setSocketState (SocketState state)
 
void setSocketError (SocketError socketError)
 
void setLocalPort (quint16 port)
 
void setLocalAddress (const QHostAddress &address)
 
void setPeerPort (quint16 port)
 
void setPeerAddress (const QHostAddress &address)
 
void setPeerName (const QString &name)
 
 QAbstractSocket (SocketType socketType, QAbstractSocketPrivate &dd, QObject *parent=0)
 
- Protected Member Functions inherited from QIODevice
 QIODevice (QIODevicePrivate &dd, QObject *parent=0)
 
void setOpenMode (OpenMode openMode)
 
void setErrorString (const QString &errorString)
 
- Protected Member Functions inherited from QObject
QObjectsender () const
 
int senderSignalIndex () const
 
int receivers (const char *signal) const
 
virtual void timerEvent (QTimerEvent *)
 
virtual void childEvent (QChildEvent *)
 
virtual void customEvent (QEvent *)
 
virtual void connectNotify (const char *signal)
 
virtual void disconnectNotify (const char *signal)
 
 QObject (QObjectPrivate &dd, QObject *parent=0)
 

Additional Inherited Members

- Protected Attributes inherited from QObject
QScopedPointer< QObjectDatad_ptr
 
- Static Protected Attributes inherited from QObject
static const QMetaObject staticQtMetaObject
 
- Properties inherited from QObject
QString objectName
 

Member Enumeration Documentation

enum SslMode
Enumerator
UnencryptedMode 
SslClientMode 
SslServerMode 

Definition at line 71 of file qsslsocket.h.

Enumerator
VerifyNone 
QueryPeer 
VerifyPeer 
AutoVerifyPeer 

Definition at line 77 of file qsslsocket.h.

Constructor & Destructor Documentation

QSslSocket ( QObject parent = 0)
~QSslSocket ( )

Member Function Documentation

void connectToHostEncrypted ( const QString hostName,
quint16  port,
OpenMode  mode = ReadWrite 
)
void connectToHostEncrypted ( const QString hostName,
quint16  port,
const QString sslPeerName,
OpenMode  mode = ReadWrite 
)
bool setSocketDescriptor ( int  socketDescriptor,
SocketState  state = ConnectedState,
OpenMode  openMode = ReadWrite 
)
void setSocketOption ( QAbstractSocket::SocketOption  option,
const QVariant value 
)
QVariant socketOption ( QAbstractSocket::SocketOption  option)
SslMode mode ( ) const
bool isEncrypted ( ) const
QSsl::SslProtocol protocol ( ) const
void setProtocol ( QSsl::SslProtocol  protocol)
QSslSocket::PeerVerifyMode peerVerifyMode ( ) const
void setPeerVerifyMode ( QSslSocket::PeerVerifyMode  mode)
int peerVerifyDepth ( ) const
void setPeerVerifyDepth ( int  depth)
QString peerVerifyName ( ) const
void setPeerVerifyName ( const QString hostName)
qint64 bytesAvailable ( ) const
virtual

Reimplemented from QAbstractSocket.

qint64 bytesToWrite ( ) const
virtual

Reimplemented from QAbstractSocket.

bool canReadLine ( ) const
virtual

Reimplemented from QAbstractSocket.

void close ( )
virtual

Reimplemented from QAbstractSocket.

bool atEnd ( ) const
virtual

Reimplemented from QAbstractSocket.

bool flush ( )
void abort ( )
void setReadBufferSize ( qint64  size)
qint64 encryptedBytesAvailable ( ) const
qint64 encryptedBytesToWrite ( ) const
QSslConfiguration sslConfiguration ( ) const
void setSslConfiguration ( const QSslConfiguration config)
void setLocalCertificate ( const QSslCertificate certificate)
void setLocalCertificate ( const QString fileName,
QSsl::EncodingFormat  format = QSsl::Pem 
)
QSslCertificate localCertificate ( ) const
QSslCertificate peerCertificate ( ) const
QList<QSslCertificate> peerCertificateChain ( ) const
QSslCipher sessionCipher ( ) const
void setPrivateKey ( const QSslKey key)
void setPrivateKey ( const QString fileName,
QSsl::KeyAlgorithm  algorithm = QSsl::Rsa,
QSsl::EncodingFormat  format = QSsl::Pem,
const QByteArray passPhrase = QByteArray() 
)
QSslKey privateKey ( ) const
QList<QSslCipher> ciphers ( ) const
void setCiphers ( const QList< QSslCipher > &  ciphers)
void setCiphers ( const QString ciphers)
static void setDefaultCiphers ( const QList< QSslCipher > &  ciphers)
static
static QList<QSslCipher> defaultCiphers ( )
static
static QList<QSslCipher> supportedCiphers ( )
static
bool addCaCertificates ( const QString path,
QSsl::EncodingFormat  format = QSsl::Pem,
QRegExp::PatternSyntax  syntax = QRegExp::FixedString 
)
void addCaCertificate ( const QSslCertificate certificate)
void addCaCertificates ( const QList< QSslCertificate > &  certificates)
void setCaCertificates ( const QList< QSslCertificate > &  certificates)
QList<QSslCertificate> caCertificates ( ) const
static bool addDefaultCaCertificates ( const QString path,
QSsl::EncodingFormat  format = QSsl::Pem,
QRegExp::PatternSyntax  syntax = QRegExp::FixedString 
)
static
static void addDefaultCaCertificate ( const QSslCertificate certificate)
static
static void addDefaultCaCertificates ( const QList< QSslCertificate > &  certificates)
static
static void setDefaultCaCertificates ( const QList< QSslCertificate > &  certificates)
static
static QList<QSslCertificate> defaultCaCertificates ( )
static
static QList<QSslCertificate> systemCaCertificates ( )
static
bool waitForConnected ( int  msecs = 30000)
bool waitForEncrypted ( int  msecs = 30000)
bool waitForReadyRead ( int  msecs = 30000)
virtual

Reimplemented from QAbstractSocket.

bool waitForBytesWritten ( int  msecs = 30000)
virtual

Reimplemented from QAbstractSocket.

bool waitForDisconnected ( int  msecs = 30000)
QList<QSslError> sslErrors ( ) const
static bool supportsSsl ( )
static
void ignoreSslErrors ( const QList< QSslError > &  errors)
void startClientEncryption ( )
slot
void startServerEncryption ( )
slot
void ignoreSslErrors ( )
slot
void encrypted ( )
signal
void peerVerifyError ( const QSslError error)
signal
void sslErrors ( const QList< QSslError > &  errors)
signal
void modeChanged ( QSslSocket::SslMode  newMode)
signal
void encryptedBytesWritten ( qint64  totalBytes)
signal
void connectToHostImplementation ( const QString hostName,
quint16  port,
OpenMode  openMode 
)
protectedslot
void disconnectFromHostImplementation ( )
protectedslot
qint64 readData ( char *  data,
qint64  maxlen 
)
protectedvirtual

Reimplemented from QAbstractSocket.

qint64 writeData ( const char *  data,
qint64  len 
)
protectedvirtual

Reimplemented from QAbstractSocket.


The documentation for this class was generated from the following file: