이 페이지에서

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를 제공합니다.

QSslSocket, QSslCertificate 및 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())

지정된 algorithm 및 encoding 형식을 사용하여 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())

지정된 algorithm 및 encoding 형식을 사용하여 바이트 배열 encoded 에 포함된 문자열을 디코딩함으로써 QSslKey 객체를 생성합니다. type 는 키가 공개 키인지 개인 키인지를 지정합니다.

키가 암호화된 경우, passPhrase 를 사용하여 키를 복호화합니다.

생성 후에는 isNull()를 사용하여 encoded 에 유효한 키가 포함되어 있는지 확인하십시오.

QSslKey::QSslKey(const QSslKey &other)

other 의 동일한 복사본을 생성합니다.

[noexcept] QSslKey::~QSslKey()

QSslKey 객체를 삭제합니다.

QSsl::KeyAlgorithm QSslKey::algorithm() const

키 알고리즘을 반환합니다.

void QSslKey::clear()

이 키의 내용을 지워, 해당 키를 null 키로 만듭니다.

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

이 키가 key other 와 같지 않으면 true 를 반환하고, 그렇지 않으면 false 를 반환합니다.

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

other 의 내용을 이 키로 복사하여 두 키를 동일하게 만듭니다.

이 ` QSslKey`에 대한 참조를 반환합니다.

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

이 키가 other 와 같으면 true 를 반환하고, 그렇지 않으면 false 를 반환합니다.

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