qca
QCA::SecureLayer Class Reference
[QCA user API]
Abstract interface to a security layer. More...
#include <QtCrypto>

Signals | |
| void | closed () |
| void | error () |
| void | readyRead () |
| void | readyReadOutgoing () |
Public Member Functions | |
| SecureLayer (QObject *parent=0) | |
| virtual int | bytesAvailable () const =0 |
| virtual int | bytesOutgoingAvailable () const =0 |
| virtual void | close () |
| virtual int | convertBytesWritten (qint64 encryptedBytes)=0 |
| virtual bool | isClosable () const |
| virtual QByteArray | read ()=0 |
| virtual QByteArray | readOutgoing (int *plainBytes=0)=0 |
| virtual QByteArray | readUnprocessed () |
| virtual void | write (const QByteArray &a)=0 |
| virtual void | writeIncoming (const QByteArray &a)=0 |
Detailed Description
Abstract interface to a security layer.
SecureLayer is normally used between an application and a potentially insecure network. It provides secure communications over that network.
The concept is that (after some initial setup), the application can write() some data to the SecureLayer implementation, and that data is encrypted (or otherwise protected, depending on the setup). The SecureLayer implementation then emits the readyReadOutgoing() signal, and the application uses readOutgoing() to retrieve the the encrypted data from the SecureLayer implementation. The encrypted data is then sent out on the network.
When some encrypted data comes back from the network, the application does a writeIncoming() to the SecureLayer implementation. Some time later, the SecureLayer implementation may emit readyRead() to the application, which then read()s the decrypted data from the SecureLayer implementation.
Note that sometimes data is sent or received between the SecureLayer implementation and the network without any data being sent between the application and the SecureLayer implementation. This is a result of the initial negotiation activities (which require network traffic to agree a configuration to use) and other overheads associated with the secure link.
Definition at line 104 of file qca_securelayer.h.
Constructor & Destructor Documentation
| QCA::SecureLayer::SecureLayer | ( | QObject * | parent = 0 |
) |
Constructor for an abstract secure communications layer.
- Parameters:
-
parent the parent object for this object
Definition at line 109 of file qca_securelayer.cpp.
Member Function Documentation
| virtual int QCA::SecureLayer::bytesAvailable | ( | ) | const [pure virtual] |
| virtual int QCA::SecureLayer::bytesOutgoingAvailable | ( | ) | const [pure virtual] |
Returns the number of bytes available to be readOutgoing() on the network side.
| void QCA::SecureLayer::close | ( | ) | [virtual] |
Close the link.
Note that this may not be meaningful / possible for all implementations.
- See also:
- isClosable() for a test that verifies if the link can be closed.
Reimplemented in QCA::TLS.
Definition at line 119 of file qca_securelayer.cpp.
| void QCA::SecureLayer::closed | ( | ) | [signal] |
This signal is emitted when the SecureLayer connection is closed.
| virtual int QCA::SecureLayer::convertBytesWritten | ( | qint64 | encryptedBytes | ) | [pure virtual] |
| void QCA::SecureLayer::error | ( | ) | [signal] |
This signal is emitted when an error is detected.
You can determine the error type using errorCode().
| bool QCA::SecureLayer::isClosable | ( | ) | const [virtual] |
Returns true if the layer has a meaningful "close".
Reimplemented in QCA::TLS.
Definition at line 114 of file qca_securelayer.cpp.
| virtual QByteArray QCA::SecureLayer::read | ( | ) | [pure virtual] |
This method reads decrypted (plain) data from the SecureLayer implementation.
You normally call this function on the application side after receiving the readyRead() signal.
| virtual QByteArray QCA::SecureLayer::readOutgoing | ( | int * | plainBytes = 0 |
) | [pure virtual] |
This method provides encoded (typically encrypted) data.
You normally call this function to get data to write out to the network socket (e.g. using QTcpSocket::write()) after receiving the readyReadOutgoing() signal.
- Parameters:
-
plainBytes the number of bytes that were read.
| QByteArray QCA::SecureLayer::readUnprocessed | ( | ) | [virtual] |
This allows you to read data without having it decrypted first.
This is intended to be used for protocols that close off the connection and return to plain text transfer. You do not normally need to use this function.
Reimplemented in QCA::TLS.
Definition at line 123 of file qca_securelayer.cpp.
| void QCA::SecureLayer::readyRead | ( | ) | [signal] |
This signal is emitted when SecureLayer has decrypted (application side) data ready to be read.
Typically you will connect this signal to a slot that reads the data (using read()).
| void QCA::SecureLayer::readyReadOutgoing | ( | ) | [signal] |
This signal is emitted when SecureLayer has encrypted (network side) data ready to be read.
Typically you will connect this signal to a slot that reads the data (using readOutgoing()) and writes it to a network socket.
| virtual void QCA::SecureLayer::write | ( | const QByteArray & | a | ) | [pure virtual] |
This method writes unencrypted (plain) data to the SecureLayer implementation.
You normally call this function on the application side.
- Parameters:
-
a the source of the application-side data
| virtual void QCA::SecureLayer::writeIncoming | ( | const QByteArray & | a | ) | [pure virtual] |
This method accepts encoded (typically encrypted) data for processing.
You normally call this function using data read from the network socket (e.g. using QTcpSocket::readAll()) after receiving a signal that indicates that the socket has data to read.
- Parameters:
-
a the ByteArray to take network-side data from
The documentation for this class was generated from the following files:
KDE 4.4 API Reference