QKnxSecureKey Class

The QKnxSecureKey class represents the elliptic-curve secure key to be used with the elliptic curve Diffie-Hellman (ECDH) key agreement scheme. 更多...

头: #include <QKnxSecureKey>
qmake: QT += knx
Since: Qt 5.13

该类在 Qt 5.13 引入。

公共类型

enum class Type { Private, Public, Invalid }

公共函数

QKnxSecureKey (const QKnxSecureKey & other )
QKnxSecureKey ()
QKnxSecureKey & operator= (const QKnxSecureKey & other )
~QKnxSecureKey ()
QKnxByteArray bytes () const
bool isNull () const
bool isValid () const
QKnxSecureKey::Type type () const
bool operator!= (const QKnxSecureKey & other ) const
bool operator== (const QKnxSecureKey & other ) const

静态公共成员

QKnxSecureKey fromBytes (QKnxSecureKey::Type type , const QKnxByteArray & data , quint16 index = 0)
void generateKeys (QKnxSecureKey * privateKey , QKnxSecureKey * publicKey )
QKnxSecureKey generatePrivateKey ()
QKnxSecureKey publicKeyFromPrivate (const QKnxSecureKey & privateKey )
QKnxSecureKey publicKeyFromPrivate (const QKnxByteArray & privateKey )
QKnxByteArray sharedSecret (const QKnxSecureKey & privateKey , const QKnxSecureKey & peerPublicKey )
QKnxByteArray sharedSecret (const QKnxByteArray & privateKey , const QKnxByteArray & peerPublicKey )

详细描述

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.

成员类型文档编制

enum class QKnxSecureKey:: Type

Describes the types of keys QKnxSecureKey 支持。

常量 描述
QKnxSecureKey::Type::Private 0 私钥。
QKnxSecureKey::Type::Public 1 公钥。
QKnxSecureKey::Type::Invalid 2 An invalid key, please do not use.

成员函数文档编制

QKnxSecureKey:: QKnxSecureKey (const QKnxSecureKey & other )

构造副本为 other .

QKnxSecureKey:: QKnxSecureKey ()

Constructs an empty invalid secure key.

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

赋值指定 other 到此对象。

QKnxSecureKey:: ~QKnxSecureKey ()

Destroys the secure key and releases all allocated resources.

QKnxByteArray QKnxSecureKey:: bytes () const

Returns an array of bytes that represent the Curve25519 raw secure key.

注意: The function will return an empty byte array for the private key unless OpenSLL with version 1.1.1a is used as back-end.

[static] QKnxSecureKey QKnxSecureKey:: fromBytes ( QKnxSecureKey::Type type , const QKnxByteArray & data , quint16 index = 0)

Constructs the Curve25519 secure key from the byte array data 起始于位置 index inside the array and sets the key type to type if OpenSSL is available and no error occurs; otherwise returns a default-constructed key which can be invalid.

[static] void QKnxSecureKey:: generateKeys ( QKnxSecureKey * privateKey , QKnxSecureKey * publicKey )

设置 privateKey to a new valid private key and publicKey to a new valid public key derived from the freshly generated private key if OpenSSL is available and no error occurs.

[static] QKnxSecureKey QKnxSecureKey:: generatePrivateKey ()

Returns a new valid private key if OpenSSL is available and no error occurs.

bool QKnxSecureKey:: isNull () const

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

bool QKnxSecureKey:: isValid () const

返回 true if OpenSSL is available and if the key contains initialized values, otherwise returns false .

[static] QKnxSecureKey QKnxSecureKey:: publicKeyFromPrivate (const QKnxSecureKey & privateKey )

Returns a new valid public key with the given private key privateKey if OpenSSL is available and no error occurs.

[static] QKnxSecureKey QKnxSecureKey:: publicKeyFromPrivate (const QKnxByteArray & privateKey )

This function overloads publicKeyFromPrivate().

[static] QKnxByteArray QKnxSecureKey:: sharedSecret (const QKnxSecureKey & privateKey , const QKnxSecureKey & peerPublicKey )

Derives and returns the shared secret from the given private key privateKey and the peer's public key peerPublicKey if OpenSSL is available and no error occurs; otherwise returns a 默认构造值 which can be empty.

[static] QKnxByteArray QKnxSecureKey:: sharedSecret (const QKnxByteArray & privateKey , const QKnxByteArray & peerPublicKey )

This function overloads sharedSecret().

QKnxSecureKey::Type QKnxSecureKey:: type () const

Returns the type of the key: Public or Private .

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

返回 true if this key and the given other key are not equal; otherwise returns false .

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

返回 true if this key and the given other key are equal; otherwise returns false .