QOpcUaKeyPair Class
QOpcUaKeyPairは秘密鍵と公開鍵のペアを扱います。詳細...
ヘッダ | #include <QOpcUaKeyPair> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS OpcUa) target_link_libraries(mytarget PRIVATE Qt6::OpcUa) |
qmake: | QT += opcua |
継承: | QObject |
パブリックな型
enum class | Cipher { Aes128Cbc, Unencrypted } |
enum class | KeyType { Rsa, Empty, Unknown } |
enum class | RsaKeyStrength { Bits1024, Bits2048, Bits4096 } |
パブリック関数
QOpcUaKeyPair(QObject *parent = nullptr) | |
virtual | ~QOpcUaKeyPair() |
void | generateRsaKey(QOpcUaKeyPair::RsaKeyStrength strength) |
bool | hasPrivateKey() const |
bool | loadFromPemData(const QByteArray &data) |
QByteArray | privateKeyToByteArray(QOpcUaKeyPair::Cipher cipher, const QString &password) const |
QByteArray | publicKeyToByteArray() const |
QOpcUaKeyPair::KeyType | type() const |
シグナル
void | passphraseNeeded(QString &passphrase, int maximumLength, bool writeOperation) |
詳細説明
このクラスは現在、技術プレビューとして提供されています。したがって、このクラスが提供する API と機能は、事前の通知なしにいつでも変更される可能性があります。
このクラスは、非対称暗号化用の鍵の生成、読み込み、保存を行うことができます。このクラスのインスタンスは、鍵を必要とする関数に渡さなければなりません。
メンバ型のドキュメント
enum class QOpcUaKeyPair::Cipher
秘密鍵を暗号化するための暗号。
定数 | 値 | 説明 |
---|---|---|
QOpcUaKeyPair::Cipher::Aes128Cbc | 0 | CBC による AES128 の暗号化 |
QOpcUaKeyPair::Cipher::Unencrypted | 1 | 鍵は暗号化されない。 |
enum class QOpcUaKeyPair::KeyType
この列挙型はキーの型を指定する。
定数 | 値 | 説明 |
---|---|---|
QOpcUaKeyPair::KeyType::Rsa | 0 | RSA 鍵 |
QOpcUaKeyPair::KeyType::Empty | 1 | 鍵はありません。 |
QOpcUaKeyPair::KeyType::Unknown | 2 | 鍵の種類は扱えません。 |
enum class QOpcUaKeyPair::RsaKeyStrength
この列挙型はRSA鍵の強度を指定する。
定数 | 値 | 説明 |
---|---|---|
QOpcUaKeyPair::RsaKeyStrength::Bits1024 | 1024 | 1024 ビットの鍵強度。 |
QOpcUaKeyPair::RsaKeyStrength::Bits2048 | 2048 | 2048 ビットの鍵強度。 |
QOpcUaKeyPair::RsaKeyStrength::Bits4096 | 4096 | 4096 ビットの鍵強度。 |
メンバ関数ドキュメント
QOpcUaKeyPair::QOpcUaKeyPair(QObject *parent = nullptr)
parent を親オブジェクトとする新しい空のキー・ペアを作成する。
[virtual noexcept]
QOpcUaKeyPair::~QOpcUaKeyPair()
キー・ペアを破棄する。
void QOpcUaKeyPair::generateRsaKey(QOpcUaKeyPair::RsaKeyStrength strength)
新しい非対称RSA鍵ペアを生成する。
鍵の長さはstrength で指定する。
bool QOpcUaKeyPair::hasPrivateKey() const
現在の鍵に秘密鍵が含まれていればtrue
を返し、そうでなければfalse
を返す。
bool QOpcUaKeyPair::loadFromPemData(const QByteArray &data)
data にあるPEMエンコードされたデータから鍵をロードする。成功すればtrue
を返し、そうでなければfalse
を返す。
PEMヘッダから、データに秘密鍵が含まれているか公開鍵が含まれているかを検出する。暗号化された鍵のロードは、パスフレーズを提供するためのシグナルpassphraseNeeded
に関数を接続することで可能です。
[signal]
void QOpcUaKeyPair::passphraseNeeded(QString &passphrase, int maximumLength, bool writeOperation)
このシグナルは、秘密鍵が暗号化または復号化のためにpassphrase を必要とするときに発せられる。
writeOperation パスフレーズが鍵のエクスポートに必要な場合は となり、 パスフレーズが鍵のインポートに必要な場合は となる。true
false
maximumLength は、パスフレーズの最大長をバイト数で指定する。この制限を超える の文字はすべて無視される。passphrase
このシグナルをスレッド境界を越えて使用する場合は、Qt::BlockingQueuedConnection
で接続する必要がある。
QByteArray QOpcUaKeyPair::privateKeyToByteArray(QOpcUaKeyPair::Cipher cipher, const QString &password) const
PEM エンコードした秘密鍵を返します。秘密鍵がない場合は、空のバイト配列が返される。
鍵の暗号化は、パラメータcipher およびpassword で指定する必要があります。 鍵を暗号化せずに保存するには、暗号Cipher::Unencrypted
を使用する必要があります。
QByteArray QOpcUaKeyPair::publicKeyToByteArray() const
公開鍵をバイト配列で返します。
QOpcUaKeyPair::KeyType QOpcUaKeyPair::type() const
現在のキーのタイプを返します。
© 2025 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.