QSslKey Class

QSslKey クラスは、秘密鍵と公開鍵のためのインターフェイスを提供します。詳細...

ヘッダー #include <QSslKey>
CMake: find_package(Qt6 REQUIRED COMPONENTS Network)
target_link_libraries(mytarget PRIVATE Qt6::Network)
qmake: QT += network

注釈このクラスの関数はすべてリエントラントです。

パブリック関数

QSslKey()
QSslKey(Qt::HANDLE handle, QSsl::KeyType type = QSsl::PrivateKey)
QSslKey(QIODevice *device, QSsl::KeyAlgorithm algorithm, QSsl::EncodingFormat encoding = QSsl::Pem, QSsl::KeyType type = QSsl::PrivateKey, const QByteArray &passPhrase = QByteArray())
QSslKey(const QByteArray &encoded, QSsl::KeyAlgorithm algorithm, QSsl::EncodingFormat encoding = QSsl::Pem, QSsl::KeyType type = QSsl::PrivateKey, const QByteArray &passPhrase = QByteArray())
QSslKey(const QSslKey &other)
~QSslKey()
QSsl::KeyAlgorithm algorithm() const
void clear()
Qt::HANDLE handle() const
bool isNull() const
int length() const
void swap(QSslKey &other)
QByteArray toDer(const QByteArray &passPhrase = QByteArray()) const
QByteArray toPem(const QByteArray &passPhrase = QByteArray()) const
QSsl::KeyType type() const
bool operator!=(const QSslKey &other) const
QSslKey &operator=(const QSslKey &other)
bool operator==(const QSslKey &other) const

詳細説明

QSslKey は、鍵を管理するためのシンプルな API を提供します。

QSslSocketQSslCertificate 、およびQSslCipherも参照してください

メンバ関数のドキュメント

QSslKey::QSslKey()

NULL キーを構築します。

isNull()も参照

[explicit] QSslKey::QSslKey(Qt::HANDLE handle, QSsl::KeyType type = QSsl::PrivateKey)

有効なネイティブ鍵handle から QSslKey を構築します。type は、鍵が公開鍵か秘密鍵かを指定します。

QSslKey がこの鍵の所有権を持つので、ネイティブライブラリを使用して鍵を解放してはいけません。

QSslKey::QSslKey(QIODevice *device, QSsl::KeyAlgorithm algorithm, QSsl::EncodingFormat encoding = QSsl::Pem, QSsl::KeyType type = QSsl::PrivateKey, const QByteArray &passPhrase = QByteArray())

指定されたalgorithmencoding フォーマットを使用してdevice からデータを読み取り、デコードすることで QSslKey を構築する。type は、鍵が公開鍵か秘密鍵かを指定する。

鍵が暗号化されている場合は、passPhrase

構築後、isNull ()を使用して、device が有効な鍵であるかどうかをチェックする。

QSslKey::QSslKey(const QByteArray &encoded, QSsl::KeyAlgorithm algorithm, QSsl::EncodingFormat encoding = QSsl::Pem, QSsl::KeyType type = QSsl::PrivateKey, const QByteArray &passPhrase = QByteArray())

バイト配列encoded の文字列を、指定されたalgorithmencoding の書式で復号して QSslKey を構築する。type は、鍵が公開鍵か秘密鍵かを指定する。

鍵が暗号化されている場合は、passPhrase を使って復号します。

構築後、isNull ()を使用して、encoded に有効な鍵が含まれているかどうかをチェックする。

QSslKey::QSslKey(const QSslKey &other)

other の同一コピーを作成する。

[noexcept] QSslKey::~QSslKey()

QSslKey オブジェクトを破棄する。

QSsl::KeyAlgorithm QSslKey::algorithm() const

キーアルゴリズムを返します。

void QSslKey::clear()

このキーの内容をクリアし、ヌル・キーにします。

isNull()も参照

Qt::HANDLE QSslKey::handle() const

nullptrネイティブ・キー・ハンドルへのポインタを返します。

このハンドルとネイティブAPIを併用することで、キーに関する拡張情報にアクセスできる。

警告 この関数は移植不可能な可能性が高く、その戻り値はプラットフォームやQtのマイナーリリースによって異なる可能性があります。

bool QSslKey::isNull() const

null キーの場合はtrue を返し、そうでない場合は false を返す。

clear()も参照

int QSslKey::length() const

キーの長さをビット単位で返します。キーが NULL の場合は -1。

[noexcept] void QSslKey::swap(QSslKey &other)

このsslキーをother と交換する。この操作は非常に速く、失敗することはない。

QByteArray QSslKey::toDer(const QByteArray &passPhrase = QByteArray()) const

DERエンコーディングでキーを返す。

DERは暗号化できないため、passPhrase 引数は省略する必要があります。これは Qt の将来のバージョンで削除される予定です。

QByteArray QSslKey::toPem(const QByteArray &passPhrase = QByteArray()) const

鍵をPEMエンコーディングで返す。キーが秘密鍵でpassPhrase が空でない場合、結果はpassPhrase で暗号化される。

QSsl::KeyType QSslKey::type() const

鍵の種類(PublicKey または PrivateKey)を返します。

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

このキーがキーother と等しくない場合はtrue を返し、そうでない場合はfalse を返す。

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

other の内容をこのキーにコピーし、2 つのキーを同一にする。

このQSslKey への参照を返す。

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

このキーがother と等しい場合はtrue を返し、そうでない場合はfalse を返す。

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