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) |
상세 설명
이 클래스는 현재 기술 미리 보기(Technology Preview)로 제공되므로, 이 클래스가 제공하는 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
현재 키의 유형을 반환합니다.
© 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.