QCA::SecureLayer Class Reference

Abstract interface to a security layer. More...

#include <QtCrypto>

Inheritance diagram for QCA::SecureLayer:

QObject QCA::SASL QCA::TLS Collaboration diagram for QCA::SecureLayer:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 SecureLayer (QObject *parent=0)
virtual bool isClosable () const
virtual int bytesAvailable () const =0
virtual int bytesOutgoingAvailable () const =0
virtual void close ()
virtual void write (const QByteArray &a)=0
virtual QByteArray read ()=0
virtual void writeIncoming (const QByteArray &a)=0
virtual QByteArray readOutgoing (int *plainBytes=0)=0
virtual QByteArray readUnprocessed ()
virtual int convertBytesWritten (qint64 encryptedBytes)=0
void readyReadOutgoing ()
void closed ()
void error ()

Public Attributes

Q_SIGNALS __pad0__: void readyRead()

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.


Constructor & Destructor Documentation

QCA::SecureLayer::SecureLayer QObject parent = 0  ) 
 

Constructor for an abstract secure communications layer.

Parameters:
parent the parent object for this object


Member Function Documentation

virtual bool QCA::SecureLayer::isClosable  )  const [virtual]
 

Returns true if the layer has a meaningful "close".

Reimplemented in QCA::TLS.

virtual int QCA::SecureLayer::bytesAvailable  )  const [pure virtual]
 

Returns the number of bytes available to be read() on the application side.

Implemented in QCA::TLS, and QCA::SASL.

virtual int QCA::SecureLayer::bytesOutgoingAvailable  )  const [pure virtual]
 

Returns the number of bytes available to be readOutgoing() on the network side.

Implemented in QCA::TLS, and QCA::SASL.

virtual 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.

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.

Implemented in QCA::TLS, and QCA::SASL.

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.

Implemented in QCA::TLS, and QCA::SASL.

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.

Implemented in QCA::TLS, and QCA::SASL.

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.

Implemented in QCA::TLS, and QCA::SASL.

virtual 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.

virtual int QCA::SecureLayer::convertBytesWritten qint64  encryptedBytes  )  [pure virtual]
 

Convert encrypted bytes written to plain text bytes written.

Implemented in QCA::TLS, and QCA::SASL.

void QCA::SecureLayer::readyReadOutgoing  ) 
 

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.

void QCA::SecureLayer::closed  ) 
 

This signal is emitted when the SecureLayer connection is closed.

void QCA::SecureLayer::error  ) 
 

This signal is emitted when an error is detected.

You can determine the error type using errorCode().


The documentation for this class was generated from the following file:
Generated on Fri Jul 6 12:15:30 2007 for Qt Cryptographic Architecture by  doxygen 1.4.6