Qyoto  4.0.5
Qyoto is a C# language binding for Qt
 All Classes Namespaces Functions Variables Typedefs Enumerations Properties
QtNetwork.QSslSocket Class Reference

The QSslSocket class provides an SSL encrypted socket for both clients and servers. More...

Inheritance diagram for QtNetwork.QSslSocket:
Collaboration diagram for QtNetwork.QSslSocket:

Public Types

enum  PeerVerifyMode { AutoVerifyPeer = 3, QueryPeer = 1, VerifyNone = 0, VerifyPeer = 2 }
  More...
 
enum  SslMode { SslClientMode = 1, SslServerMode = 2, UnencryptedMode = 0 }
  More...
 

Public Member Functions

 QSslSocket (QObject parent=null)
 
 
override void CreateProxy ()
 
new void Abort ()
 
 
new void AddCaCertificate (QSslCertificate certificate)
 
 
new bool AddCaCertificates (string path, QSsl.EncodingFormat format=QSsl.EncodingFormat.Pem, QRegExp.PatternSyntax syntax=QRegExp.PatternSyntax.FixedString)
 
 
new void AddCaCertificates (System.Collections.Generic.List< QSslCertificate > certificates)
 
 
override bool AtEnd ()
 
 
override long BytesAvailable ()
 
 
override long BytesToWrite ()
 
 
override bool CanReadLine ()
 
 
override void Close ()
 
 
new void ConnectToHostEncrypted (string hostName, ushort port, QIODevice.OpenModeFlag mode=QIODevice.OpenModeFlag.ReadWrite)
 
 
new void ConnectToHostEncrypted (string hostName, ushort port, string sslPeerName, QIODevice.OpenModeFlag mode=QIODevice.OpenModeFlag.ReadWrite)
 
 
new long EncryptedBytesAvailable ()
 
 
new long EncryptedBytesToWrite ()
 
 
new bool Flush ()
 
 
new void IgnoreSslErrors ()
 
 
new void IgnoreSslErrors (System.Collections.Generic.List< QSslError > errors)
 
 
new bool IsEncrypted ()
 
 
new QSslSocket.SslMode Mode ()
 
 
new QSslCertificate PeerCertificate ()
 
 
new
System.Collections.Generic.List
< QSslCertificate
PeerCertificateChain ()
 
 
new QSslCipher SessionCipher ()
 
 
new void SetCiphers (string ciphers)
 
 
new void SetLocalCertificate (string fileName, QSsl.EncodingFormat format=QSsl.EncodingFormat.Pem)
 
 
new void SetPrivateKey (string fileName, QSsl.KeyAlgorithm algorithm=QSsl.KeyAlgorithm.Rsa, QSsl.EncodingFormat format=QSsl.EncodingFormat.Pem)
 
 
new void SetPrivateKey (string fileName, QSsl.KeyAlgorithm algorithm, QSsl.EncodingFormat format, QByteArray passPhrase)
 
 
new void SetReadBufferSize (long size)
 
 
new bool SetSocketDescriptor (int socketDescriptor, QAbstractSocket.SocketState state=QAbstractSocket.SocketState.ConnectedState, QIODevice.OpenModeFlag openMode=QIODevice.OpenModeFlag.ReadWrite)
 
 
new void SetSocketOption (QAbstractSocket.SocketOption option, object value)
 
 
new object socketOption (QAbstractSocket.SocketOption option)
 
 
new
System.Collections.Generic.List
< QSslError
OnSslErrors ()
 
 
new void StartClientEncryption ()
 
 
new void StartServerEncryption ()
 
 
override bool WaitForBytesWritten (int msecs=30000)
 
 
new bool WaitForConnected (int msecs=30000)
 
 
new bool WaitForDisconnected (int msecs=30000)
 
 
new bool WaitForEncrypted (int msecs=30000)
 
 
override bool WaitForReadyRead (int msecs=30000)
 
 
new void Dispose ()
 
- Public Member Functions inherited from QtNetwork.QTcpSocket
 QTcpSocket (QObject parent=null)
 
 
override void CreateProxy ()
 
new void Dispose ()
 
- Public Member Functions inherited from QtNetwork.QAbstractSocket
 QAbstractSocket (QAbstractSocket.SocketType socketType, QObject parent)
 
 
new void Abort ()
 
 
new void ConnectToHost (QHostAddress address, ushort port, QIODevice.OpenModeFlag mode=QIODevice.OpenModeFlag.ReadWrite)
 
 
new void ConnectToHost (string hostName, ushort port, QIODevice.OpenModeFlag mode=QIODevice.OpenModeFlag.ReadWrite)
 
 
new void DisconnectFromHost ()
 
 
new QAbstractSocket.SocketError OnError ()
 
 
new bool Flush ()
 
 
override bool IsSequential ()
 
 
new bool IsValid ()
 
 
new QHostAddress LocalAddress ()
 
 
new ushort LocalPort ()
 
 
new QHostAddress PeerAddress ()
 
 
new string PeerName ()
 
 
new ushort PeerPort ()
 
 
new bool SetSocketDescriptor (int socketDescriptor, QAbstractSocket.SocketState state=QAbstractSocket.SocketState.ConnectedState, QIODevice.OpenModeFlag openMode=QIODevice.OpenModeFlag.ReadWrite)
 
 
new void SetSocketOption (QAbstractSocket.SocketOption option, object value)
 
 
new int SocketDescriptor ()
 
 
new object socketOption (QAbstractSocket.SocketOption option)
 
 
new QAbstractSocket.SocketType socketType ()
 
 
new QAbstractSocket.SocketState State ()
 
 
new bool WaitForConnected (int msecs=30000)
 
 
new bool WaitForDisconnected (int msecs=30000)
 
 
new void Dispose ()
 
- Public Member Functions inherited from QtCore.QIODevice
 QIODevice ()
 
 
 QIODevice (QObject parent)
 
 
new string ErrorString ()
 
 
new bool GetChar (Pointer< sbyte > c)
 
 
new bool IsOpen ()
 
 
new bool IsReadable ()
 
 
new bool IsTextModeEnabled ()
 
 
new bool IsWritable ()
 
 
virtual bool Open (QIODevice.OpenModeFlag mode)
 
 
new QIODevice.OpenModeFlag OpenMode ()
 
 
new QByteArray Peek (long maxlen)
 
 
new long Peek (Pointer< sbyte > data, long maxlen)
 
 
virtual long Pos ()
 
 
new bool PutChar (sbyte c)
 
 
new QByteArray Read (long maxlen)
 
 
new long Read (Pointer< sbyte > data, long maxlen)
 
 
new QByteArray ReadAll ()
 
 
new QByteArray ReadLine (long maxlen=0)
 
 
new long ReadLine (Pointer< sbyte > data, long maxlen)
 
 
virtual bool Reset ()
 
 
virtual bool Seek (long pos)
 
 
new void SetTextModeEnabled (bool enabled)
 
 
virtual long Size ()
 
 
new void UngetChar (sbyte c)
 
 
new long Write (QByteArray data)
 
 
new long Write (string data)
 
 
new long Write (string data, long len)
 
 
new void Dispose ()
 
- Public Member Functions inherited from QtCore.QObject
 QObject (QObject parent=null)
 
 
new bool BlockSignals (bool b)
 
 
new
System.Collections.Generic.List
< QObject
Children ()
 
 
new bool Connect (QObject sender, string signal, string member, Qt.ConnectionType type=Qt.ConnectionType.AutoConnection)
 
 
new void DeleteLater ()
 
 
new bool Disconnect (QObject receiver, string member=null)
 
 
new bool Disconnect (string signal=null, QObject receiver=null, string member=null)
 
 
new void DumpObjectInfo ()
 
 
new void DumpObjectTree ()
 
 
new
System.Collections.Generic.List
< QByteArray
DynamicPropertyNames ()
 
 
virtual bool OnEvent (QEvent arg1)
 
 
virtual bool EventFilter (QObject arg1, QEvent arg2)
 
 
new bool Inherits (string classname)
 
 
new void InstallEventFilter (QObject arg1)
 
 
new bool IsWidgetType ()
 
 
new void KillTimer (int id)
 
 
new object Property (string name)
 
 
new void RemoveEventFilter (QObject arg1)
 
 
new bool SetProperty (string name, object value)
 
 
new void SetUserData (uint id, QObjectUserData data)
 
new bool SignalsBlocked ()
 
 
new int StartTimer (int interval)
 
 
new QObjectUserData UserData (uint id)
 
new void Dispose ()
 
- Public Member Functions inherited from QtCore.Qt
delegate QTextStream FuncQTextStreamQTextStream (QTextStream qTextStream)
 
delegate string FuncStringQByteArray (QByteArray qByteArray)
 
delegate QByteArray FuncQByteArrayString (string @string)
 
delegate void ActionQtMsgTypeString (QtMsgType qtMsgType, string @string)
 
delegate QObject FuncQObject ()
 

Static Public Member Functions

static void AddDefaultCaCertificate (QSslCertificate certificate)
 
 
static bool AddDefaultCaCertificates (string path, QSsl.EncodingFormat format=QSsl.EncodingFormat.Pem, QRegExp.PatternSyntax syntax=QRegExp.PatternSyntax.FixedString)
 
 
static void AddDefaultCaCertificates (System.Collections.Generic.List< QSslCertificate > certificates)
 
 
static
System.Collections.Generic.List
< QSslCipher
SupportedCiphers ()
 
 
static bool SupportsSsl ()
 
 
static
System.Collections.Generic.List
< QSslCertificate
SystemCaCertificates ()
 
 
static string Tr (string s, string c=null)
 
static string Tr (string s, string c, int n)
 
static string TrUtf8 (string s, string c=null)
 
static string TrUtf8 (string s, string c, int n)
 
- Static Public Member Functions inherited from QtNetwork.QTcpSocket
static string Tr (string s, string c=null)
 
static string Tr (string s, string c, int n)
 
static string TrUtf8 (string s, string c=null)
 
static string TrUtf8 (string s, string c, int n)
 
- Static Public Member Functions inherited from QtNetwork.QAbstractSocket
static string Tr (string s, string c=null)
 
static string Tr (string s, string c, int n)
 
static string TrUtf8 (string s, string c=null)
 
static string TrUtf8 (string s, string c, int n)
 
- Static Public Member Functions inherited from QtCore.QIODevice
static string Tr (string s, string c=null)
 
static string Tr (string s, string c, int n)
 
static string TrUtf8 (string s, string c=null)
 
static string TrUtf8 (string s, string c, int n)
 
- Static Public Member Functions inherited from QtCore.QObject
static bool Connect (QObject sender, QMetaMethod signal, QObject receiver, QMetaMethod method, Qt.ConnectionType type=Qt.ConnectionType.AutoConnection)
 
 
static bool Connect (QObject sender, string signal, QObject receiver, string member, Qt.ConnectionType arg5=Qt.ConnectionType.AutoConnection)
 
 
static bool Disconnect (QObject sender, QMetaMethod signal, QObject receiver, QMetaMethod member)
 
 
static bool Disconnect (QObject sender, string signal, QObject receiver, string member)
 
 
static uint RegisterUserData ()
 
static string Tr (string s, string c=null)
 
 
static string Tr (string s, string c, int n)
 
 
static string TrUtf8 (string s, string c=null)
 
 
static string TrUtf8 (string s, string c, int n)
 
 
- Static Public Member Functions inherited from QtCore.Qt
static QDataStream Write (QDataStream s, object p)
 
static QDataStream Write (QDataStream arg1, QSizeF arg2)
 
static QTextStream Write (QTextStream s, Qt.FuncQTextStreamQTextStream f)
 
static QDataStream Write (QDataStream arg1, QPoint arg2)
 
static QDataStream Write (QDataStream arg1, QLineF arg2)
 
static QDataStream Write (QDataStream arg1, QPointF arg2)
 
static QDataStream Write (QDataStream arg1, QChar arg2)
 
static QDataStream Write (QDataStream arg1, QByteArray arg2)
 
static QDataStream Write (QDataStream arg1, QEasingCurve arg2)
 
static QDataStream Write (QDataStream arg1, QRectF arg2)
 
static QDataStream Write (QDataStream arg1, QDateTime arg2)
 
static QDataStream Write (QDataStream arg1, QUrl arg2)
 
static QDataStream Write (QDataStream arg1, QTime arg2)
 
static QDataStream Write (QDataStream arg1, QLocale arg2)
 
static QDataStream Write (QDataStream arg1, QBitArray arg2)
 
static QDataStream Write (QDataStream arg1, QUuid arg2)
 
static QDataStream Write (QDataStream arg1, QLine arg2)
 
static QDataStream Write (QDataStream arg1, QDate arg2)
 
static QDataStream Write (QDataStream @out, QRegExp regExp)
 
static QDataStream Write (QDataStream arg1, QRect arg2)
 
static QDataStream Write (QDataStream arg1, QSize arg2)
 
static QDataStream Write (QDataStream s, QVariant.Type p)
 
static QDataStream Write (QDataStream arg1, string arg2)
 
static QDataStream Write (QDataStream @out, System.Collections.Generic.List< string > list)
 
static QDataStream Read (QDataStream arg1, QChar arg2)
 
static QDataStream Read (QDataStream arg1, QLocale arg2)
 
static QDataStream Read (QDataStream arg1, QRect arg2)
 
static QDataStream Read (QDataStream arg1, QEasingCurve arg2)
 
static QDataStream Read (QDataStream arg1, QDate arg2)
 
static QDataStream Read (QDataStream arg1, QUrl arg2)
 
static QDataStream Read (QDataStream arg1, QUuid arg2)
 
static QTextStream Read (QTextStream s, Qt.FuncQTextStreamQTextStream f)
 
static QDataStream Read (QDataStream arg1, QLineF arg2)
 
static QDataStream Read (QDataStream arg1, QRectF arg2)
 
static QDataStream Read (QDataStream arg1, QPointF arg2)
 
static QDataStream Read (QDataStream arg1, QLine arg2)
 
static QDataStream Read (QDataStream arg1, QBitArray arg2)
 
static QDataStream Read (QDataStream arg1, QSize arg2)
 
static QDataStream Read (QDataStream arg1, QDateTime arg2)
 
static QDataStream Read (QDataStream arg1, QTime arg2)
 
static QDataStream Read (QDataStream arg1, QPoint arg2)
 
static QDataStream Read (QDataStream @in, QRegExp regExp)
 
static QDataStream Read (QDataStream s, object p)
 
static QDataStream Read (QDataStream arg1, QByteArray arg2)
 
static QDataStream Read (QDataStream arg1, QSizeF arg2)
 
static QDataStream Read (QDataStream arg1, string arg2)
 
static QDataStream Read (QDataStream s, QVariant.Type p)
 
static QDataStream Read (QDataStream @in, System.Collections.Generic.List< string > list)
 
static double qAcos (double v)
 
static void qAddPostRoutine (System.Action arg1)
 
static string qAppName ()
 
static double qAsin (double v)
 
static double qAtan (double v)
 
static double qAtan2 (double x, double y)
 
static void qBadAlloc ()
 
static int qCeil (double v)
 
static ushort qChecksum (string s, uint len)
 
static QByteArray qCompress (QByteArray data)
 
static QByteArray qCompress (QByteArray data, int compressionLevel=-1)
 
static QByteArray qCompress (Pointer< byte > data, int nbytes)
 
static QByteArray qCompress (Pointer< byte > data, int nbytes, int compressionLevel=-1)
 
static double qCos (double v)
 
static double qExp (double v)
 
static double qFabs (double v)
 
static double qFastCos (double x)
 
static double qFastSin (double x)
 
static string qFlagLocation (string method)
 
static int qFloor (double v)
 
static bool qFuzzyCompare (double p1, double p2)
 
static bool qFuzzyCompare (float p1, float p2)
 
static bool qFuzzyIsNull (double d)
 
static bool qFuzzyIsNull (float f)
 
static uint qHash (QBitArray key)
 
static uint qHash (QChar key)
 
static uint qHash (QStringRef key)
 
static uint qHash (QUrl url)
 
static uint qHash (QPersistentModelIndex index)
 
static uint qHash (QByteArray key)
 
static uint qHash (QModelIndex index)
 
static uint qHash (uint key)
 
static uint qHash (sbyte key)
 
static uint qHash (byte key)
 
static uint qHash (short key)
 
static uint qHash (NativeLong key)
 
static uint qHash (ushort key)
 
static uint qHash (long key)
 
static uint qHash (ulong key)
 
static uint qHash (int key)
 
static uint qHash (string key)
 
static uint qHash (NativeULong key)
 
static double qInf ()
 
static Qt.ActionQtMsgTypeString qInstallMsgHandler (Qt.ActionQtMsgTypeString arg1)
 
static int qIntCast (float f)
 
static int qIntCast (double f)
 
static bool qIsFinite (double d)
 
static bool qIsFinite (float f)
 
static bool qIsInf (float f)
 
static bool qIsInf (double d)
 
static bool qIsNaN (float f)
 
static bool qIsNaN (double d)
 
static bool qIsNull (float f)
 
static bool qIsNull (double d)
 
static double qLn (double v)
 
static double qPow (double x, double y)
 
static double qQNaN ()
 
static void qRegisterStaticPluginInstanceFunction (Qt.FuncQObject function)
 
static void qRemovePostRoutine (System.Action arg1)
 
static int qRound (double d)
 
static long qRound64 (double d)
 
static double qSNaN ()
 
static bool qSharedBuild ()
 
static double qSin (double v)
 
static double qSqrt (double v)
 
static bool qStringComparisonHelper (QStringRef s1, string s2)
 
static double qTan (double v)
 
static QByteArray qUncompress (QByteArray data)
 
static QByteArray qUncompress (Pointer< byte > data, int nbytes)
 
static string qVersion ()
 
static void Qbswap_helper (Pointer< byte > src, Pointer< byte > dest, int size)
 
static QByteArray Qgetenv (string varName)
 
static bool Qputenv (string varName, QByteArray value)
 
static int Qrand ()
 
static void Qsrand (uint seed)
 
static int Qstrcmp (QByteArray str1, QByteArray str2)
 
static int Qstrcmp (QByteArray str1, string str2)
 
static int Qstrcmp (string str1, QByteArray str2)
 
static int Qstrcmp (string str1, string str2)
 
static Pointer< sbyte > Qstrcpy (Pointer< sbyte > dst, string src)
 
static Pointer< sbyte > Qstrdup (string arg1)
 
static int Qstricmp (string arg1, string arg2)
 
static uint Qstrlen (string str)
 
static int Qstrncmp (string str1, string str2, uint len)
 
static Pointer< sbyte > Qstrncpy (Pointer< sbyte > dst, string src, uint len)
 
static int Qstrnicmp (string arg1, string arg2, uint len)
 
static uint Qstrnlen (string str, uint maxlen)
 
static string QtTrId (string id, int n=-1)
 

Protected Member Functions

 QSslSocket (System.Type dummy)
 
new void ConnectToHostImplementation (string hostName, ushort port, QIODevice.OpenModeFlag openMode)
 
new void DisconnectFromHostImplementation ()
 
new void OnEncrypted ()
 
 
new void OnEncryptedBytesWritten (long totalBytes)
 
 
new void OnModeChanged (QSslSocket.SslMode newMode)
 
 
new void OnPeerVerifyError (QSslError error)
 
 
override long ReadData (Pointer< sbyte > data, long maxlen)
 
 
new void OnSslErrors (System.Collections.Generic.List< QSslError > errors)
 
 
override long WriteData (string data, long len)
 
 
- Protected Member Functions inherited from QtNetwork.QTcpSocket
 QTcpSocket (System.Type dummy)
 
- Protected Member Functions inherited from QtNetwork.QAbstractSocket
 QAbstractSocket (System.Type dummy)
 
new void ConnectToHostImplementation (string hostName, ushort port, QIODevice.OpenModeFlag mode=QIODevice.OpenModeFlag.ReadWrite)
 
 
new void OnConnected ()
 
 
new void DisconnectFromHostImplementation ()
 
 
new void OnDisconnected ()
 
 
new void OnError (QAbstractSocket.SocketError arg1)
 
 
new void OnHostFound ()
 
 
new void OnProxyAuthenticationRequired (QNetworkProxy proxy, QAuthenticator authenticator)
 
 
override long ReadLineData (Pointer< sbyte > data, long maxlen)
 
 
new void SetLocalAddress (QHostAddress address)
 
 
new void SetLocalPort (ushort port)
 
 
new void SetPeerAddress (QHostAddress address)
 
 
new void SetPeerName (string name)
 
 
new void SetPeerPort (ushort port)
 
 
new void SetSocketError (QAbstractSocket.SocketError socketError)
 
 
new void SetSocketState (QAbstractSocket.SocketState state)
 
 
new void OnStateChanged (QAbstractSocket.SocketState arg1)
 
 
- Protected Member Functions inherited from QtCore.QIODevice
 QIODevice (System.Type dummy)
 
new void OnAboutToClose ()
 
 
new void OnBytesWritten (long bytes)
 
 
new void OnReadChannelFinished ()
 
 
new void OnReadyRead ()
 
 
new void SetErrorString (string errorString)
 
 
new void SetOpenMode (QIODevice.OpenModeFlag openMode)
 
 
- Protected Member Functions inherited from QtCore.QObject
 QObject (System.Type dummy)
 
virtual void OnChildEvent (QChildEvent arg1)
 
 
virtual void ConnectNotify (string signal)
 
 
virtual void OnCustomEvent (QEvent arg1)
 
 
new void OnDestroyed (QObject arg1=null)
 
 
virtual void DisconnectNotify (string signal)
 
 
new int Receivers (string signal)
 
 
new QObject Sender ()
 
 
new int SenderSignalIndex ()
 
 
virtual void OnTimerEvent (QTimerEvent arg1)
 
 

Properties

Slot Encrypted
 
 
Slot< QSslErrorPeerVerifyError
 
 
Slot
< System.Collections.Generic.List
< QSslError > > 
SslErrors
 
 
Slot< QSslSocket.SslModeModeChanged
 
 
Slot< System.Int64 > EncryptedBytesWritten
 
 
new
System.Collections.Generic.List
< QSslCertificate
CaCertificates [get, set]
 
 
new
System.Collections.Generic.List
< QSslCipher
Ciphers [get, set]
 
 
static
System.Collections.Generic.List
< QSslCertificate
DefaultCaCertificates [get, set]
 
 
static
System.Collections.Generic.List
< QSslCipher
DefaultCiphers [get, set]
 
 
new QSslCertificate LocalCertificate [get, set]
 
 
new int PeerVerifyDepth [get, set]
 
 
new QSslSocket.PeerVerifyMode peerVerifyMode [get, set]
 
 
new string PeerVerifyName [get, set]
 
 
new QSslKey PrivateKey [get, set]
 
 
new QSsl.SslProtocol Protocol [get, set]
 
 
new QSslConfiguration SslConfiguration [get, set]
 
 
static new QMetaObject StaticMetaObject [get]
 
new IQSslSocketSignals Emit [get]
 
- Properties inherited from QtNetwork.QTcpSocket
static new QMetaObject StaticMetaObject [get]
 
new IQTcpSocketSignals Emit [get]
 
- Properties inherited from QtNetwork.QAbstractSocket
Slot HostFound
 
 
Slot Connected
 
 
Slot Disconnected
 
 
Slot< QAbstractSocket.SocketStateStateChanged
 
 
Slot< QAbstractSocket.SocketErrorError
 
 
Slot< QNetworkProxy,
QAuthenticator
ProxyAuthenticationRequired
 
 
Slot ConnectionClosed
 
Slot DelayedCloseFinished
 
new QNetworkProxy Proxy [get, set]
 
 
new long ReadBufferSize [get, set]
 
 
static new QMetaObject StaticMetaObject [get]
 
new IQAbstractSocketSignals Emit [get]
 
- Properties inherited from QtCore.QIODevice
Slot ReadyRead
 
 
Slot< System.Int64 > BytesWritten
 
 
Slot AboutToClose
 
 
Slot ReadChannelFinished
 
 
static new QMetaObject StaticMetaObject [get]
 
new IQIODeviceSignals Emit [get]
 
- Properties inherited from QtCore.QObject
virtual EventHandler
< QEventArgs< QChildEvent > > 
ChildEvent
 
 
virtual EventHandler
< QEventArgs< QEvent > > 
CustomEvent
 
 
virtual EventHandler
< QEventArgs< QEvent > > 
Event
 
 
virtual EventHandler
< QEventArgs< QTimerEvent > > 
TimerEvent
 
 
Slot< QObjectDestroyedQObject
 
Slot Destroyed
 
 
new QObject Parent [get, set]
 
 
virtual System.IntPtr SmokeObject [get, set]
 
new string ObjectName [get, set]
 
 
static new QMetaObject StaticMetaObject [get]
 
 
static new QMetaObject StaticQtMetaObject [get]
 
new IQObjectSignals Emit [get]
 

Additional Inherited Members

- Protected Attributes inherited from QtCore.QObject
object Q_EMIT = null
 
SmokeInvocation interceptor
 
readonly List< QEventHandler > eventFilters = new List<QEventHandler>()
 

Detailed Description

The QSslSocket class provides an SSL encrypted socket for both clients and servers.

QSslSocket establishes a secure, encrypted TCP connection you can use for transmitting encrypted data. It can operate in both client and server mode, and it supports modern SSL protocols, including SSLv3 and TLSv1. By default, QSslSocket uses TLSv1, but you can change the SSL protocol by calling setProtocol() as long as you do it before the handshake has started.

SSL encryption operates on top of the existing TCP stream after the socket enters the ConnectedState. There are two simple ways to establish a secure connection using QSslSocket: With an immediate SSL handshake, or with a delayed SSL handshake occurring after the connection has been established in unencrypted mode.

The most common way to use QSslSocket is to construct an object and start a secure connection by calling connectToHostEncrypted(). This method starts an immediate SSL handshake once the connection has been established.

QSslSocket *socket = new QSslSocket(this);

connect(socket, SIGNAL(encrypted()), this, SLOT(ready()));

socket->connectToHostEncrypted("imap.example.com", 993);

As with a plain QTcpSocket, QSslSocket enters the HostLookupState, ConnectingState, and finally the ConnectedState, if the connection is successful. The handshake then starts automatically, and if it succeeds, the encrypted() signal is emitted to indicate the socket has entered the encrypted state and is ready for use.

Note that data can be written to the socket immediately after the return from connectToHostEncrypted() (i.e., before the encrypted() signal is emitted). The data is queued in QSslSocket until after the encrypted() signal is emitted.

An example of using the delayed SSL handshake to secure an existing connection is the case where an SSL server secures an incoming connection. Suppose you create an SSL server class as a subclass of QTcpServer. You would override QTcpServer::incomingConnection() with something like the example below, which first constructs an instance of QSslSocket and then calls setSocketDescriptor() to set the new socket's descriptor to the existing one passed in. It then initiates the SSL handshake by calling startServerEncryption().

void SslServer::incomingConnection(int socketDescriptor)

{

QSslSocket *serverSocket = new QSslSocket;

if (serverSocket->setSocketDescriptor(socketDescriptor)) {

connect(serverSocket, SIGNAL(encrypted()), this, SLOT(ready()));

serverSocket->startServerEncryption();

} else {

delete serverSocket;

}

}

If an error occurs, QSslSocket emits the sslErrors() signal. In this case, if no action is taken to ignore the error(s), the connection is dropped. To continue, despite the occurrence of an error, you can call ignoreSslErrors(), either from within this slot after the error occurs, or any time after construction of the QSslSocket and before the connection is attempted. This will allow QSslSocket to ignore the errors it encounters when establishing the identity of the peer. Ignoring errors during an SSL handshake should be used with caution, since a fundamental characteristic of secure connections is that they should be established with a successful handshake.

Once encrypted, you use QSslSocket as a regular QTcpSocket. When readyRead() is emitted, you can call read(), canReadLine() and readLine(), or getChar() to read decrypted data from QSslSocket's internal buffer, and you can call write() or putChar() to write data back to the peer. QSslSocket will automatically encrypt the written data for you, and emit encryptedBytesWritten() once the data has been written to the peer.

As a convenience, QSslSocket supports QTcpSocket's blocking functions waitForConnected(), waitForReadyRead(), waitForBytesWritten(), and waitForDisconnected(). It also provides waitForEncrypted(), which will block the calling thread until an encrypted connection has been established.

QSslSocket socket;

socket.connectToHostEncrypted("http.example.com", 443);

if (!socket.waitForEncrypted()) {

qDebug() << socket.errorString();

return false;

}

socket.write("GET / HTTP/1.0\r\n\r\n");

while (socket.waitForReadyRead())

qDebug() << socket.readAll().data();

QSslSocket provides an extensive, easy-to-use API for handling cryptographic ciphers, private keys, and local, peer, and Certification Authority (CA) certificates. It also provides an API for handling errors that occur during the handshake phase.

The following features can also be customized:

The socket's cryptographic cipher suite can be customized before the handshake phase with setCiphers() and setDefaultCiphers().

The socket's local certificate and private key can be customized before the handshake phase with setLocalCertificate() and setPrivateKey().

The CA certificate database can be extended and customized with addCaCertificate(), addCaCertificates(), setCaCertificates(), addDefaultCaCertificate(), addDefaultCaCertificates(), and setDefaultCaCertificates().

Note: If available, root certificates on Unix (excluding Mac OS X) will be loaded on demand from the standard certificate directories. If you do not want to load root certificates on demand, you need to call either the static function setDefaultCaCertificates() before the first SSL handshake is made in your application, (e.g. via "QSslSocket::setDefaultCaCertificates(QSslSocket::systemCaCertificates());"), or call setCaCertificates() on your QSslSocket instance prior to the SSL handshake.

For more information about ciphers and certificates, refer to QSslCipher and QSslCertificate.

This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/).

Note: Be aware of the difference between the bytesWritten() signal and the encryptedBytesWritten() signal. For a QTcpSocket, bytesWritten() will get emitted as soon as data has been written to the TCP socket. For a QSslSocket, bytesWritten() will get emitted when the data is being encrypted and encryptedBytesWritten() will get emitted as soon as data has been written to the TCP socket.

Symbian Platform Security Requirements

On Symbian, processes which use this class must have the NetworkServices platform security capability. If the client process lacks this capability, operations will fail.

Platform security capabilities are added via the TARGET.CAPABILITY qmake variable.

See also QSslCertificate, QSslCipher, and QSslError.

Member Enumeration Documentation

Describes the peer verification modes for QSslSocket. The default mode is AutoVerifyPeer, which selects an appropriate mode depending on the socket's QSocket::SslMode.

This enum was introduced or modified in Qt 4.4.

See also QSslSocket::peerVerifyMode().

Enumerator:
AutoVerifyPeer 

QSslSocket will automatically use QueryPeer for server sockets and VerifyPeer for client sockets.

QueryPeer 

QSslSocket will request a certificate from the peer, but does not require this certificate to be valid. This is useful when you want to display peer certificate details to the user without affecting the actual SSL handshake. This mode is the default for servers.

VerifyNone 

QSslSocket will not request a certificate from the peer. You can set this mode if you are not interested in the identity of the other side of the connection. The connection will still be encrypted, and your socket will still send its local certificate to the peer if it's requested.

VerifyPeer 

QSslSocket will request a certificate from the peer during the SSL handshake phase, and requires that this certificate is valid. On failure, QSslSocket will emit the QSslSocket::sslErrors() signal. This mode is the default for clients.

Describes the connection modes available for QSslSocket.

Enumerator:
SslClientMode 

The socket is a client-side SSL socket. It is either alreayd encrypted, or it is in the SSL handshake phase (see QSslSocket::isEncrypted()).

SslServerMode 

The socket is a server-side SSL socket. It is either already encrypted, or it is in the SSL handshake phase (see QSslSocket::isEncrypted()).

UnencryptedMode 

The socket is unencrypted. Its behavior is identical to QTcpSocket.

Constructor & Destructor Documentation

QtNetwork.QSslSocket.QSslSocket ( System.Type  dummy)
protected
QtNetwork.QSslSocket.QSslSocket ( QObject  parent = null)

Constructs a QSslSocket object. parent is passed to QObject's constructor. The new socket's cipher suite is set to the one returned by the static method defaultCiphers().

Member Function Documentation

new void QtNetwork.QSslSocket.Abort ( )

Aborts the current connection and resets the socket. Unlike disconnectFromHost(), this function immediately closes the socket, clearing any pending data in the write buffer.

See also disconnectFromHost() and close().

new void QtNetwork.QSslSocket.AddCaCertificate ( QSslCertificate  certificate)

Adds the certificate to 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.

To add multiple certificates, use addCaCertificates().

See also caCertificates() and setCaCertificates().

new bool QtNetwork.QSslSocket.AddCaCertificates ( string  path,
QSsl.EncodingFormat  format = QSsl.EncodingFormat.Pem,
QRegExp.PatternSyntax  syntax = QRegExp.PatternSyntax.FixedString 
)

Searches all files in the path for certificates encoded in the specified format and adds them to this socket's CA certificate database. path can be explicit, or it can contain wildcards in the format specified by syntax. Returns true if one or more certificates are added to the socket's CA certificate database; otherwise returns false.

The CA certificate database is used by the socket during the handshake phase to validate the peer's certificate.

For more precise control, use addCaCertificate().

See also addCaCertificate() and QSslCertificate::fromPath().

new void QtNetwork.QSslSocket.AddCaCertificates ( System.Collections.Generic.List< QSslCertificate certificates)

Adds the certificates to 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.

For more precise control, use addCaCertificate().

See also caCertificates() and addDefaultCaCertificate().

static void QtNetwork.QSslSocket.AddDefaultCaCertificate ( QSslCertificate  certificate)
static

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

See also defaultCaCertificates() and addCaCertificates().

static bool QtNetwork.QSslSocket.AddDefaultCaCertificates ( string  path,
QSsl.EncodingFormat  format = QSsl.EncodingFormat.Pem,
QRegExp.PatternSyntax  syntax = QRegExp.PatternSyntax.FixedString 
)
static

Searches all files in the path for certificates with the specified encoding and adds them to the default CA certificate database. path can be an explicit file, or it can contain wildcards in the format specified by syntax. Returns true if any CA certificates are added to the default database.

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

See also defaultCaCertificates(), addCaCertificates(), and addDefaultCaCertificate().

static void QtNetwork.QSslSocket.AddDefaultCaCertificates ( System.Collections.Generic.List< QSslCertificate certificates)
static

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

See also defaultCaCertificates() and addCaCertificates().

override bool QtNetwork.QSslSocket.AtEnd ( )
virtual

Reimplemented from QIODevice::atEnd().

Reimplemented from QtNetwork.QAbstractSocket.

override long QtNetwork.QSslSocket.BytesAvailable ( )
virtual

Reimplemented from QIODevice::bytesAvailable().

Returns the number of decrypted bytes that are immediately available for reading.

Reimplemented from QtNetwork.QAbstractSocket.

override long QtNetwork.QSslSocket.BytesToWrite ( )
virtual

Reimplemented from QIODevice::bytesToWrite().

Returns the number of unencrypted bytes that are waiting to be encrypted and written to the network.

Reimplemented from QtNetwork.QAbstractSocket.

override bool QtNetwork.QSslSocket.CanReadLine ( )
virtual

Reimplemented from QIODevice::canReadLine().

Returns true if you can read one while line (terminated by a single ASCII '\n' character) of decrypted characters; otherwise, false is returned.

Reimplemented from QtNetwork.QAbstractSocket.

override void QtNetwork.QSslSocket.Close ( )
virtual

Reimplemented from QIODevice::close().

Reimplemented from QtNetwork.QAbstractSocket.

new void QtNetwork.QSslSocket.ConnectToHostEncrypted ( string  hostName,
ushort  port,
QIODevice.OpenModeFlag  mode = QIODevice.OpenModeFlag.ReadWrite 
)

Starts an encrypted connection to the device hostName on port, using mode as the OpenMode. This is equivalent to calling connectToHost() to establish the connection, followed by a call to startClientEncryption().

QSslSocket first enters the HostLookupState. Then, after entering either the event loop or one of the waitFor...() functions, it enters the ConnectingState, emits connected(), and then initiates the SSL client handshake. At each state change, QSslSocket emits signal stateChanged().

After initiating the SSL client handshake, if the identity of the peer can't be established, signal sslErrors() is emitted. If you want to ignore the errors and continue connecting, you must call ignoreSslErrors(), either from inside a slot function connected to the sslErrors() signal, or prior to entering encrypted mode. If ignoreSslErrors() is not called, the connection is dropped, signal disconnected() is emitted, and QSslSocket returns to the UnconnectedState.

If the SSL handshake is successful, QSslSocket emits encrypted().

QSslSocket socket;

connect(&socket, SIGNAL(encrypted()), receiver, SLOT(socketEncrypted()));

socket.connectToHostEncrypted("imap", 993);

socket->write("1 CAPABILITY\r\n");

Note: The example above shows that text can be written to the socket immediately after requesting the encrypted connection, before the encrypted() signal has been emitted. In such cases, the text is queued in the object and written to the socket after the connection is established and the encrypted() signal has been emitted.

The default for mode is ReadWrite.

If you want to create a QSslSocket on the server side of a connection, you should instead call startServerEncryption() upon receiving the incoming connection through QTcpServer.

See also connectToHost(), startClientEncryption(), waitForConnected(), and waitForEncrypted().

new void QtNetwork.QSslSocket.ConnectToHostEncrypted ( string  hostName,
ushort  port,
string  sslPeerName,
QIODevice.OpenModeFlag  mode = QIODevice.OpenModeFlag.ReadWrite 
)

Starts an encrypted connection to the device hostName on port, using mode as the OpenMode. This is equivalent to calling connectToHost() to establish the connection, followed by a call to startClientEncryption().

QSslSocket first enters the HostLookupState. Then, after entering either the event loop or one of the waitFor...() functions, it enters the ConnectingState, emits connected(), and then initiates the SSL client handshake. At each state change, QSslSocket emits signal stateChanged().

After initiating the SSL client handshake, if the identity of the peer can't be established, signal sslErrors() is emitted. If you want to ignore the errors and continue connecting, you must call ignoreSslErrors(), either from inside a slot function connected to the sslErrors() signal, or prior to entering encrypted mode. If ignoreSslErrors() is not called, the connection is dropped, signal disconnected() is emitted, and QSslSocket returns to the UnconnectedState.

If the SSL handshake is successful, QSslSocket emits encrypted().

QSslSocket socket;

connect(&socket, SIGNAL(encrypted()), receiver, SLOT(socketEncrypted()));

socket.connectToHostEncrypted("imap", 993);

socket->write("1 CAPABILITY\r\n");

Note: The example above shows that text can be written to the socket immediately after requesting the encrypted connection, before the encrypted() signal has been emitted. In such cases, the text is queued in the object and written to the socket after the connection is established and the encrypted() signal has been emitted.

The default for mode is ReadWrite.

If you want to create a QSslSocket on the server side of a connection, you should instead call startServerEncryption() upon receiving the incoming connection through QTcpServer.

See also connectToHost(), startClientEncryption(), waitForConnected(), and waitForEncrypted().

new void QtNetwork.QSslSocket.ConnectToHostImplementation ( string  hostName,
ushort  port,
QIODevice.OpenModeFlag  openMode 
)
protected
override void QtNetwork.QSslSocket.CreateProxy ( )
virtual

Reimplemented from QtNetwork.QAbstractSocket.

new void QtNetwork.QSslSocket.DisconnectFromHostImplementation ( )
protected
new void QtNetwork.QSslSocket.Dispose ( )
new long QtNetwork.QSslSocket.EncryptedBytesAvailable ( )

Returns the number of encrypted bytes that are awaiting decryption. Normally, this function will return 0 because QSslSocket decrypts its incoming data as soon as it can.

This function was introduced in Qt 4.4.

new long QtNetwork.QSslSocket.EncryptedBytesToWrite ( )

Returns the number of encrypted bytes that are waiting to be written to the network.

This function was introduced in Qt 4.4.

new bool QtNetwork.QSslSocket.Flush ( )

This function writes as much as possible from the internal write buffer to the underlying network socket, without blocking. If any data was written, this function returns true; otherwise false is returned.

Call this function if you need QSslSocket to start sending buffered data immediately. The number of bytes successfully written depends on the operating system. In most cases, you do not need to call this function, because QAbstractSocket will start sending data automatically once control goes back to the event loop. In the absence of an event loop, call waitForBytesWritten() instead.

See also write() and waitForBytesWritten().

new void QtNetwork.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.

Ignoring errors that occur during an SSL handshake should be done with caution. A fundamental characteristic of secure connections is that they should be established with an error free handshake.

See also sslErrors().

new void QtNetwork.QSslSocket.IgnoreSslErrors ( System.Collections.Generic.List< QSslError errors)

This is an overloaded function.

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

Note that you can set the expected certificate in the SSL error: 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().

new bool QtNetwork.QSslSocket.IsEncrypted ( )

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().

new QSslSocket.SslMode QtNetwork.QSslSocket.Mode ( )

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.

new void QtNetwork.QSslSocket.OnEncrypted ( )
protected

This signal is emitted when QSslSocket enters encrypted mode. After this signal has been emitted, QSslSocket::isEncrypted() will return true, and all further transmissions on the socket will be encrypted.

See also QSslSocket::connectToHostEncrypted() and QSslSocket::isEncrypted().

new void QtNetwork.QSslSocket.OnEncryptedBytesWritten ( long  totalBytes)
protected

This signal is emitted when QSslSocket writes its encrypted data to the network. The written parameter contains the number of bytes that were successfully written.

This function was introduced in Qt 4.4.

See also QIODevice::bytesWritten().

new void QtNetwork.QSslSocket.OnModeChanged ( QSslSocket.SslMode  newMode)
protected

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().

new void QtNetwork.QSslSocket.OnPeerVerifyError ( QSslError  error)
protected

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().

new System.Collections.Generic.List<QSslError> QtNetwork.QSslSocket.OnSslErrors ( )

Returns a list of the last SSL errors that occurred. This is the same list as QSslSocket passes via the sslErrors() signal. If the connection has been encrypted with no errors, this function will return an empty list.

See also connectToHostEncrypted().

new void QtNetwork.QSslSocket.OnSslErrors ( System.Collections.Generic.List< QSslError errors)
protected

QSslSocket emits this signal after the SSL handshake to indicate that one or more errors have occurred while establishing the identity of the peer. The errors are usually an indication that QSslSocket is unable to securely identify the peer. Unless any action is taken, the connection will be dropped after this signal has been emitted.

If you want to continue connecting despite the errors that have occurred, you must call QSslSocket::ignoreSslErrors() from inside a slot connected to this signal. If you need to access the error list at a later point, you can call sslErrors() (without arguments).

errors contains one or more errors that prevent QSslSocket from verifying the identity of the peer.

Note: You cannot use Qt::QueuedConnection when connecting to this signal, or calling QSslSocket::ignoreSslErrors() will have no effect.

See also peerVerifyError().

new QSslCertificate QtNetwork.QSslSocket.PeerCertificate ( )

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().

new System.Collections.Generic.List<QSslCertificate> QtNetwork.QSslSocket.PeerCertificateChain ( )

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().

override long QtNetwork.QSslSocket.ReadData ( Pointer< sbyte >  data,
long  maxlen 
)
protectedvirtual

Reimplemented from QIODevice::readData().

Reimplemented from QtNetwork.QAbstractSocket.

new QSslCipher QtNetwork.QSslSocket.SessionCipher ( )

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 ciphers(), setCiphers(), setDefaultCiphers(), defaultCiphers(), and supportedCiphers().

new void QtNetwork.QSslSocket.SetCiphers ( string  ciphers)

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().

new void QtNetwork.QSslSocket.SetLocalCertificate ( string  fileName,
QSsl.EncodingFormat  format = QSsl.EncodingFormat.Pem 
)

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.

See also localCertificate() and setPrivateKey().

new void QtNetwork.QSslSocket.SetPrivateKey ( string  fileName,
QSsl.KeyAlgorithm  algorithm = QSsl.KeyAlgorithm.Rsa,
QSsl.EncodingFormat  format = QSsl.EncodingFormat.Pem 
)

Sets the socket's private key to key. The private key and the local certificate are used by clients and servers that must prove their identity to SSL peers.

Both the key and the local certificate are required if you are creating an SSL server socket. If you are creating an SSL client socket, the key and local certificate are required if your client must identify itself to an SSL server.

See also privateKey() and setLocalCertificate().

new void QtNetwork.QSslSocket.SetPrivateKey ( string  fileName,
QSsl.KeyAlgorithm  algorithm,
QSsl.EncodingFormat  format,
QByteArray  passPhrase 
)

Sets the socket's private key to key. The private key and the local certificate are used by clients and servers that must prove their identity to SSL peers.

Both the key and the local certificate are required if you are creating an SSL server socket. If you are creating an SSL client socket, the key and local certificate are required if your client must identify itself to an SSL server.

See also privateKey() and setLocalCertificate().

new void QtNetwork.QSslSocket.SetReadBufferSize ( long  size)

Sets the size of QSslSocket's internal read buffer to be size bytes.

This function was introduced in Qt 4.4.

new bool QtNetwork.QSslSocket.SetSocketDescriptor ( int  socketDescriptor,
QAbstractSocket.SocketState  state = QAbstractSocket.SocketState.ConnectedState,
QIODevice.OpenModeFlag  openMode = QIODevice.OpenModeFlag.ReadWrite 
)

Initializes QSslSocket with the native socket descriptor socketDescriptor. Returns true if socketDescriptor is accepted as a valid socket descriptor; otherwise returns false. The socket is opened in the mode specified by openMode, and enters the socket state specified by state.

Note: It is not possible to initialize two sockets with the same native socket descriptor.

See also socketDescriptor().

new void QtNetwork.QSslSocket.SetSocketOption ( QAbstractSocket.SocketOption  option,
object  value 
)

Sets the given option to the value described by value.

This function was introduced in Qt 4.6.

See also socketOption().

new object QtNetwork.QSslSocket.socketOption ( QAbstractSocket.SocketOption  option)

Returns the value of the option option.

This function was introduced in Qt 4.6.

See also setSocketOption().

new void QtNetwork.QSslSocket.StartClientEncryption ( )

Starts a delayed SSL handshake for a client connection. This function can be called when the socket is in the ConnectedState but still in the UnencryptedMode. If it is not yet connected, or if it is already encrypted, this function has no effect.

Clients that implement STARTTLS functionality often make use of delayed SSL handshakes. Most other clients can avoid calling this function directly by using connectToHostEncrypted() instead, which automatically performs the handshake.

See also connectToHostEncrypted() and startServerEncryption().

new void QtNetwork.QSslSocket.StartServerEncryption ( )

Starts a delayed SSL handshake for a server connection. This function can be called when the socket is in the ConnectedState but still in UnencryptedMode. If it is not connected or it is already encrypted, the function has no effect.

For server sockets, calling this function is the only way to initiate the SSL handshake. Most servers will call this function immediately upon receiving a connection, or as a result of having received a protocol-specific command to enter SSL mode (e.g, the server may respond to receiving the string "STARTTLS\r\n" by calling this function).

The most common way to implement an SSL server is to create a subclass of QTcpServer and reimplement QTcpServer::incomingConnection(). The returned socket descriptor is then passed to QSslSocket::setSocketDescriptor().

See also connectToHostEncrypted() and startClientEncryption().

static System.Collections.Generic.List<QSslCipher> QtNetwork.QSslSocket.SupportedCiphers ( )
static

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 bool QtNetwork.QSslSocket.SupportsSsl ( )
static

Returns true if this platform supports SSL; otherwise, returns false. If the platform doesn't support SSL, the socket will fail in the connection phase.

static System.Collections.Generic.List<QSslCertificate> QtNetwork.QSslSocket.SystemCaCertificates ( )
static

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().

static string QtNetwork.QSslSocket.Tr ( string  s,
string  c = null 
)
static
static string QtNetwork.QSslSocket.Tr ( string  s,
string  c,
int  n 
)
static
static string QtNetwork.QSslSocket.TrUtf8 ( string  s,
string  c = null 
)
static
static string QtNetwork.QSslSocket.TrUtf8 ( string  s,
string  c,
int  n 
)
static
override bool QtNetwork.QSslSocket.WaitForBytesWritten ( int  msecs = 30000)
virtual

Reimplemented from QIODevice::waitForBytesWritten().

Reimplemented from QtNetwork.QAbstractSocket.

new bool QtNetwork.QSslSocket.WaitForConnected ( int  msecs = 30000)

Waits until the socket is connected, or msecs milliseconds, whichever happens first. If the connection has been established, this function returns true; otherwise it returns false.

See also QAbstractSocket::waitForConnected().

new bool QtNetwork.QSslSocket.WaitForDisconnected ( int  msecs = 30000)

Waits until the socket has disconnected or msecs milliseconds, whichever comes first. If the connection has been disconnected, this function returns true; otherwise it returns false.

See also QAbstractSocket::waitForDisconnected().

new bool QtNetwork.QSslSocket.WaitForEncrypted ( int  msecs = 30000)

Waits until the socket has completed the SSL handshake and has emitted encrypted(), or msecs milliseconds, whichever comes first. If encrypted() has been emitted, this function returns true; otherwise (e.g., the socket is disconnected, or the SSL handshake fails), false is returned.

The following example waits up to one second for the socket to be encrypted:

socket->connectToHostEncrypted("imap", 993);

if (socket->waitForEncrypted(1000))

qDebug("Encrypted!");

If msecs is -1, this function will not time out.

See also startClientEncryption(), startServerEncryption(), encrypted(), and isEncrypted().

override bool QtNetwork.QSslSocket.WaitForReadyRead ( int  msecs = 30000)
virtual

Reimplemented from QIODevice::waitForReadyRead().

Reimplemented from QtNetwork.QAbstractSocket.

override long QtNetwork.QSslSocket.WriteData ( string  data,
long  len 
)
protectedvirtual

Reimplemented from QIODevice::writeData().

Reimplemented from QtNetwork.QAbstractSocket.

Property Documentation

new System.Collections.Generic.List<QSslCertificate> QtNetwork.QSslSocket.CaCertificates
getset

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.

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().

new System.Collections.Generic.List<QSslCipher> QtNetwork.QSslSocket.Ciphers
getset

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().

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.

System.Collections.Generic.List<QSslCertificate> QtNetwork.QSslSocket.DefaultCaCertificates
staticgetset

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.

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.

System.Collections.Generic.List<QSslCipher> QtNetwork.QSslSocket.DefaultCiphers
staticgetset

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().

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.

new IQSslSocketSignals QtNetwork.QSslSocket.Emit
getprotected
Slot QtNetwork.QSslSocket.Encrypted
addremove

This signal is emitted when QSslSocket enters encrypted mode. After this signal has been emitted, QSslSocket::isEncrypted() will return true, and all further transmissions on the socket will be encrypted.

See also QSslSocket::connectToHostEncrypted() and QSslSocket::isEncrypted().

Slot<System.Int64> QtNetwork.QSslSocket.EncryptedBytesWritten
addremove

This signal is emitted when QSslSocket writes its encrypted data to the network. The written parameter contains the number of bytes that were successfully written.

This function was introduced in Qt 4.4.

See also QIODevice::bytesWritten().

new QSslCertificate QtNetwork.QSslSocket.LocalCertificate
getset

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

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.

Slot<QSslSocket.SslMode> QtNetwork.QSslSocket.ModeChanged
addremove

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().

new int QtNetwork.QSslSocket.PeerVerifyDepth
getset

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.

Sets the maximum number of certificates in the peer's certificate chain to be checked during the SSL handshake phase, to depth. Setting a depth of 0 means that no maximum depth is 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.

Slot<QSslError> QtNetwork.QSslSocket.PeerVerifyError
addremove

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().

new QSslSocket.PeerVerifyMode QtNetwork.QSslSocket.peerVerifyMode
getset

Returns the socket's verify mode. This mode 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.

Sets the socket's verify mode to 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.

Setting this mode after encryption has started has no effect on the current connection.

This function was introduced in Qt 4.4.

new string QtNetwork.QSslSocket.PeerVerifyName
getset

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

This function was introduced in Qt 4.8.

Sets a different host name, given by hostName, for the certificate validation instead of the one used for the TCP connection.

This function was introduced in Qt 4.8.

new QSslKey QtNetwork.QSslSocket.PrivateKey
getset

Returns this socket's private key.

Sets the socket's private key to key. The private key and the local certificate are used by clients and servers that must prove their identity to SSL peers.

Both the key and the local certificate are required if you are creating an SSL server socket. If you are creating an SSL client socket, the key and local certificate are required if your client must identify itself to an SSL server.

new QSsl.SslProtocol QtNetwork.QSslSocket.Protocol
getset

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

Sets the socket's SSL protocol to protocol. This will affect the next initiated handshake; calling this function on an already-encrypted socket will not affect the socket's protocol.

new QSslConfiguration QtNetwork.QSslSocket.SslConfiguration
getset

Returns the socket's SSL configuration state. The default SSL configuration of a socket is to use the default ciphers, default CA certificates, no local private key or certificate.

The SSL configuration also contains fields that can change with time without notice.

This function was introduced in Qt 4.4.

Sets the socket's SSL configuration to be the contents of configuration. This function sets the local certificate, the ciphers, the private key and the CA certificates to those stored in configuration.

It is not possible to set the SSL-state related fields.

This function was introduced in Qt 4.4.

Slot<System.Collections.Generic.List<QSslError> > QtNetwork.QSslSocket.SslErrors
addremove

Returns a list of the last SSL errors that occurred. This is the same list as QSslSocket passes via the sslErrors() signal. If the connection has been encrypted with no errors, this function will return an empty list.

See also connectToHostEncrypted().

new QMetaObject QtNetwork.QSslSocket.StaticMetaObject
staticget