QKnxNetIpSecureConfiguration Class

The QKnxNetIpSecureConfiguration class holds configuration options used for the secure session authentication process. More...

Header: #include <QKnxNetIpSecureConfiguration>
qmake: QT += knx
Since: Qt 5.13

This class was introduced in Qt 5.13.

Public Types

enum Type { Tunneling, DeviceManagement }

Public Functions

QKnxNetIpSecureConfiguration(QKnxNetIpSecureConfiguration &&other)
QKnxNetIpSecureConfiguration(const QKnxNetIpSecureConfiguration &other)
QKnxNetIpSecureConfiguration()
QKnxNetIpSecureConfiguration &operator=(QKnxNetIpSecureConfiguration &&other)
QKnxNetIpSecureConfiguration &operator=(const QKnxNetIpSecureConfiguration &other)
~QKnxNetIpSecureConfiguration()
QByteArray deviceAuthenticationCode() const
QKnxAddress host() const
QKnxAddress individualAddress() const
bool isNull() const
bool isSecureSessionKeepAliveSet() const
bool isValid() const
QKnxSecureKey privateKey() const
QKnxSecureKey publicKey() const
bool setDeviceAuthenticationCode(const QByteArray &authenticationCode)
void setHost(const QKnxAddress &hostAddress)
bool setIndividualAddress(const QKnxAddress &address)
void setKeepSecureSessionAlive(bool keepAlive)
bool setPrivateKey(const QKnxSecureKey &key)
bool setUserId(QKnxNetIp::SecureUserId userId)
void setUserPassword(const QByteArray &userPassword)
void swap(QKnxNetIpSecureConfiguration &other)
QKnxNetIp::SecureUserId userId() const
QByteArray userPassword() const
bool operator!=(const QKnxNetIpSecureConfiguration &other) const
bool operator==(const QKnxNetIpSecureConfiguration &other) const

Static Public Members

QVector<QKnxNetIpSecureConfiguration> fromKeyring(QKnxNetIpSecureConfiguration::Type type, const QString &keyring, const QByteArray &password, bool validate)
QKnxNetIpSecureConfiguration fromKeyring(QKnxNetIpSecureConfiguration::Type type, const QKnxAddress &ia, const QString &keyring, const QByteArray &password, bool validate)

Detailed Description

It holds information such as secure key, user ID and password, device authentication code, and so on.

This class is part of the Qt KNX module and currently available as a Technology Preview, and therefore the API and functionality provided by the class may be subject to change at any time without prior notice.

Member Type Documentation

enum QKnxNetIpSecureConfiguration::Type

This enum holds the type of secure configuration that can be constructed from an ETS exported keyring (*.knxkeys) file.

ConstantValueDescription
QKnxNetIpSecureConfiguration::Tunneling0x00KNXnet/IP secure tunneling configuration.
QKnxNetIpSecureConfiguration::DeviceManagement001KNXnet/IP secure device management configuration.

Member Function Documentation

QKnxNetIpSecureConfiguration::QKnxNetIpSecureConfiguration(QKnxNetIpSecureConfiguration &&other)

Move-constructs a secure configuration, making it point to the same secure configuration that other was pointing to.

QKnxNetIpSecureConfiguration::QKnxNetIpSecureConfiguration(const QKnxNetIpSecureConfiguration &other)

Constructs a copy of other.

QKnxNetIpSecureConfiguration::QKnxNetIpSecureConfiguration()

Constructs a new, empty, invalid secure configuration.

See also isNull() and isValid().

QKnxNetIpSecureConfiguration &QKnxNetIpSecureConfiguration::operator=(QKnxNetIpSecureConfiguration &&other)

Move-assigns other to this secure configuration.

QKnxNetIpSecureConfiguration &QKnxNetIpSecureConfiguration::operator=(const QKnxNetIpSecureConfiguration &other)

Assigns the specified other to this secure configuration.

QKnxNetIpSecureConfiguration::~QKnxNetIpSecureConfiguration()

Releases any resources held by the secure configuration.

QByteArray QKnxNetIpSecureConfiguration::deviceAuthenticationCode() const

Returns the device authentication code to establish the secure session as an array of bytes.

See also setDeviceAuthenticationCode().

[static] QVector<QKnxNetIpSecureConfiguration> QKnxNetIpSecureConfiguration::fromKeyring(QKnxNetIpSecureConfiguration::Type type, const QString &keyring, const QByteArray &password, bool validate)

Constructs a vector of secure configurations for the given type type from an ETS exported keyring (*.knxkeys) file that was encrypted with the given password password. Set the validate argument to true to verify that all data in the keyring file is trustworthy, false to omit the check.

Note: If an error occurred, no or invalid information for type was found in the keyring file, the returned vector can be empty.

[static] QKnxNetIpSecureConfiguration QKnxNetIpSecureConfiguration::fromKeyring(QKnxNetIpSecureConfiguration::Type type, const QKnxAddress &ia, const QString &keyring, const QByteArray &password, bool validate)

Constructs a secure configurations for the given type type and the given individual address ia from an ETS exported keyring (*.knxkeys) file that was encrypted with the given password password. Set the validate argument to true to verify that all data in the keyring file is trustworthy, false to omit the check.

Note: If an error occurred, no or invalid information for type or ia was found in the keyring file; the function returns a default-constructed value which can be invalid.

QKnxAddress QKnxNetIpSecureConfiguration::host() const

Returns the host address of the secure KNX device this secure configuration targets. The host address can be empty and is not required to establish a secure session.

The purpose of this field is more to help GUI applications to indicate which KNX secure device can be used with this secure configuration.

See also setHost().

QKnxAddress QKnxNetIpSecureConfiguration::individualAddress() const

Returns the requested individual address for the secure session.

See also setIndividualAddress().

bool QKnxNetIpSecureConfiguration::isNull() const

Returns true if this is a default constructed secure configuration; otherwise returns false. A secure configuration is considered null if it contains no initialized values.

bool QKnxNetIpSecureConfiguration::isSecureSessionKeepAliveSet() const

Returns true if the keep alive flag is set; false otherwise. By default this is set to false.

bool QKnxNetIpSecureConfiguration::isValid() const

Returns true if the secure configuration contains initialized values and is in itself valid, otherwise returns false.

A valid secure configuration consists of at least a valid user ID, a valid secure key, and sensible device authentication code.

QKnxSecureKey QKnxNetIpSecureConfiguration::privateKey() const

Returns the private secure key used to establish the secure session.

See also setPrivateKey().

QKnxSecureKey QKnxNetIpSecureConfiguration::publicKey() const

Returns the public secure key used to establish the secure session. The public key is derived from the given private key.

bool QKnxNetIpSecureConfiguration::setDeviceAuthenticationCode(const QByteArray &authenticationCode)

Sets the device authentication code used to establish the secure session to authenticationCode. Returns true on success; false otherwise.

Note: The device authentication code cannot be empty.

See also deviceAuthenticationCode().

void QKnxNetIpSecureConfiguration::setHost(const QKnxAddress &hostAddress)

Sets the secure configurations host address to hostAddress. The host address can be empty and is not required to establish a secure session.

See also host().

bool QKnxNetIpSecureConfiguration::setIndividualAddress(const QKnxAddress &address)

Sets the requested individual address of the secure session to address. Returns true on success; false otherwise.

Note: To request any of the freely available addresses for the secure session, or to reset the requested one, pass an invalid address to the function.

See also individualAddress().

void QKnxNetIpSecureConfiguration::setKeepSecureSessionAlive(bool keepAlive)

Determines whether the connection should be kept alive. Set keepAlive to true to keep a secure session alive even if there is no traffic for more than 60 seconds.

bool QKnxNetIpSecureConfiguration::setPrivateKey(const QKnxSecureKey &key)

Set the secure key used to establish the secure connection to key and returns true on success; false otherwise.

See also privateKey().

bool QKnxNetIpSecureConfiguration::setUserId(QKnxNetIp::SecureUserId userId)

Sets the user ID used in the KNXnet/IP session authentication frame to userId and returns true on success; false otherwise.

Note: A userId() with the value QKnxNetIp::SecureUserId::Reserved or equal to or more than QKnxNetIp::SecureUserId::Invalid is considered invalid according to the KNX application note AN159.

See also userId().

void QKnxNetIpSecureConfiguration::setUserPassword(const QByteArray &userPassword)

Sets the user password to authenticate the user while establishing the secure session to userPassword. Returns true on success; false otherwise.

See also userPassword().

void QKnxNetIpSecureConfiguration::swap(QKnxNetIpSecureConfiguration &other)

Swaps other with this secure configuration. This operation is very fast and never fails.

QKnxNetIp::SecureUserId QKnxNetIpSecureConfiguration::userId() const

Returns the user ID used in the KNXnet/IP session authentication frame.

See also setUserId().

QByteArray QKnxNetIpSecureConfiguration::userPassword() const

Returns the user password used to authenticate the user while establishing the secure session as an array of bytes.

See also setUserPassword().

bool QKnxNetIpSecureConfiguration::operator!=(const QKnxNetIpSecureConfiguration &other) const

Returns true if this secure configuration and the given other are not equal; otherwise returns false.

bool QKnxNetIpSecureConfiguration::operator==(const QKnxNetIpSecureConfiguration &other) const

Returns true if this secure configuration and the given other are equal; otherwise returns false.

© 2019 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.