QSslPreSharedKeyAuthenticator Class
QSslPreSharedKeyAuthenticator 클래스는 PSK(사전 공유 키) 암호 집합에 대한 인증 데이터를 제공합니다. 더 보기...
헤더: | #include <QSslPreSharedKeyAuthenticator> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Network) target_link_libraries(mytarget PRIVATE Qt6::Network) |
qmake: | QT += network |
- 상속된 멤버를 포함한 모든 멤버 목록
- QSslPreSharedKeyAuthenticator는 네트워크 프로그래밍 API 및 암시적으로 공유되는 클래스의 일부입니다.
참고: 이 클래스의 모든 함수는 재진입됩니다.
공용 함수
QSslPreSharedKeyAuthenticator() | |
QSslPreSharedKeyAuthenticator(const QSslPreSharedKeyAuthenticator &authenticator) | |
~QSslPreSharedKeyAuthenticator() | |
QByteArray | identity() const |
QByteArray | identityHint() const |
int | maximumIdentityLength() const |
int | maximumPreSharedKeyLength() const |
QByteArray | preSharedKey() const |
void | setIdentity(const QByteArray &identity) |
void | setPreSharedKey(const QByteArray &preSharedKey) |
void | swap(QSslPreSharedKeyAuthenticator &other) |
QSslPreSharedKeyAuthenticator & | operator=(QSslPreSharedKeyAuthenticator &&authenticator) |
QSslPreSharedKeyAuthenticator & | operator=(const QSslPreSharedKeyAuthenticator &authenticator) |
관련 비회원
bool | operator!=(const QSslPreSharedKeyAuthenticator &lhs, const QSslPreSharedKeyAuthenticator &rhs) |
bool | operator==(const QSslPreSharedKeyAuthenticator &lhs, const QSslPreSharedKeyAuthenticator &rhs) |
상세 설명
QSslPreSharedKeyAuthenticator 클래스는 SSL 소켓에서 사전 공유 키(PSK) 암호세트에 필요한 인증 데이터를 제공하는 데 사용됩니다.
PSK 핸드셰이크에서 클라이언트는 서버에 설정된 키와 일치해야 하는 키를 도출해야 합니다. 키를 도출하는 정확한 알고리즘은 애플리케이션에 따라 다르지만, 이를 위해 서버는 신원 힌트를 클라이언트에 보낼 수 있습니다. 이 힌트는 다른 정보(예: 암호 구문)와 결합되어 클라이언트에서 공유 키를 구성하는 데 사용됩니다.
QSslPreSharedKeyAuthenticator는 클라이언트 애플리케이션에 PSK 핸드셰이크를 완료하기 위한 수단을 제공합니다. 클라이언트 애플리케이션은 QSslSocket::preSharedKeyAuthenticationRequired() 신호에 슬롯을 연결해야 합니다:
connect(socket, &QSslSocket::preSharedKeyAuthenticationRequired, this, &AuthManager::handlePreSharedKeyAuthentication);
이 신호는 서버가 클라이언트에 보낸 신원 힌트가 포함된 QSslPreSharedKeyAuthenticator 객체를 전달하며, 해당 클라이언트 신원과 파생된 키로 채워야 합니다:
void AuthManager::handlePreSharedKeyAuthentication(QSslPreSharedKeyAuthenticator *authenticator) { authenticator->setIdentity("My Qt App"); const QByteArray key = deriveKey(authenticator->identityHint(), passphrase); authenticator->setPreSharedKey(key); }
참고: PSK 암호화 스위트는 SSL 백엔드로 OpenSSL 1.0.1 이상을 사용하는 경우에만 지원됩니다.
참고: PSK는 현재 OpenSSL에서만 지원됩니다.
QSslSocket 을참조하세요 .
멤버 기능 문서
QSslPreSharedKeyAuthenticator::QSslPreSharedKeyAuthenticator()
기본 QSslPreSharedKeyAuthenticator 객체를 구축합니다.
신원 힌트, 신원 및 키는 빈 바이트 배열로 초기화되며 신원과 키의 최대 길이는 모두 0으로 초기화됩니다.
QSslPreSharedKeyAuthenticator::QSslPreSharedKeyAuthenticator(const QSslPreSharedKeyAuthenticator &authenticator)
authenticator 의 복사본으로 QSslPreSharedKeyAuthenticator 객체를 구축합니다.
operator=()도 참조하세요 .
[noexcept]
QSslPreSharedKeyAuthenticator::~QSslPreSharedKeyAuthenticator()
QSslPreSharedKeyAuthenticator 객체를 삭제합니다.
QByteArray QSslPreSharedKeyAuthenticator::identity() const
PSK 클라이언트 ID를 반환합니다.
setIdentity()도 참조하세요 .
QByteArray QSslPreSharedKeyAuthenticator::identityHint() const
서버에서 제공한 PSK 신원 힌트를 반환합니다. 이 힌트의 해석은 애플리케이션에 맡겨집니다.
int QSslPreSharedKeyAuthenticator::maximumIdentityLength() const
PSK 클라이언트 ID의 최대 길이를 바이트 단위로 반환합니다.
참고: 길이가 maximumIdentityLength()보다 큰 ID를 설정할 수 있으며, 이 경우 실제로 서버에 전송되는 것은 첫 번째 maximumIdentityLength() 바이트뿐입니다.
setIdentity()도 참조하세요 .
int QSslPreSharedKeyAuthenticator::maximumPreSharedKeyLength() const
미리 공유한 키의 최대 길이를 바이트 단위로 반환합니다.
참고: 길이가 maximumPreSharedKeyLength()보다 큰 키를 설정할 수 있으며, 이 경우 실제로는 첫 번째 maximumPreSharedKeyLength()의 바이트만 서버로 전송됩니다.
setPreSharedKey()도 참조하세요 .
QByteArray QSslPreSharedKeyAuthenticator::preSharedKey() const
미리 공유한 키를 반환합니다.
setPreSharedKey()도 참조하세요 .
void QSslPreSharedKeyAuthenticator::setIdentity(const QByteArray &identity)
(서버에 알릴) PSK 클라이언트 ID를 identity 로 설정합니다.
참고: 길이가 maximumIdentityLength()보다 큰 ID를 설정할 수 있으며, 이 경우 실제로는 첫 번째 maximumIdentityLength() 바이트만 서버로 전송됩니다.
identity() 및 maximumIdentityLength()도 참조하세요 .
void QSslPreSharedKeyAuthenticator::setPreSharedKey(const QByteArray &preSharedKey)
사전 공유 키를 preSharedKey 로 설정합니다.
참고: 길이가 maximumPreSharedKeyLength() 보다 큰 키를 설정할 수 있으며, 이 경우 실제로는 첫 번째 maximumPreSharedKeyLength() 바이트만 서버로 전송됩니다.
preSharedKey(), maximumPreSharedKeyLength() 및 QByteArray::fromHex()도 참조하세요 .
[noexcept]
void QSslPreSharedKeyAuthenticator::swap(QSslPreSharedKeyAuthenticator &other)
이 인증서를 other 로 바꿉니다. 이 작업은 매우 빠르며 실패하지 않습니다.
[noexcept]
QSslPreSharedKeyAuthenticator &QSslPreSharedKeyAuthenticator::operator=(QSslPreSharedKeyAuthenticator &&authenticator)
이동 - QSslPreSharedKeyAuthenticator 객체 authenticator 를 이 객체에 할당하고 이동된 인스턴스에 대한 참조를 반환합니다.
QSslPreSharedKeyAuthenticator &QSslPreSharedKeyAuthenticator::operator=(const QSslPreSharedKeyAuthenticator &authenticator)
QSslPreSharedKeyAuthenticator 객체 authenticator 를 이 객체에 할당하고 복사본에 대한 참조를 반환합니다.
관련 비회원
bool operator!=(const QSslPreSharedKeyAuthenticator &lhs, const QSslPreSharedKeyAuthenticator &rhs)
인증자 객체 lhs 가 rhs 와 같지 않은 경우 true
를 반환하고, 그렇지 않은 경우 false
를 반환합니다.
bool operator==(const QSslPreSharedKeyAuthenticator &lhs, const QSslPreSharedKeyAuthenticator &rhs)
인증자 객체 lhs 가 rhs 와 같으면 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.