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::Aes128Cbc0CBC로 AES128 암호화
QOpcUaKeyPair::Cipher::Unencrypted1키가 암호화되지 않습니다.

enum class QOpcUaKeyPair::KeyType

이 열거형 유형은 키의 유형을 지정합니다.

Constant설명
QOpcUaKeyPair::KeyType::Rsa0RSA 키
QOpcUaKeyPair::KeyType::Empty1사용할 수 있는 키가 없습니다.
QOpcUaKeyPair::KeyType::Unknown2키 유형이 처리되지 않습니다.

enum class QOpcUaKeyPair::RsaKeyStrength

이 열거형 유형은 RSA 키의 강도를 지정합니다.

Constant설명
QOpcUaKeyPair::RsaKeyStrength::Bits102410241024비트의 키 강도.
QOpcUaKeyPair::RsaKeyStrength::Bits204820482048비트 키 강도.
QOpcUaKeyPair::RsaKeyStrength::Bits409640964096 비트의 키 강도.

멤버 함수 문서

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으로 인코딩된 개인키를 반환합니다. 개인 키가 없는 경우 빈 바이트 배열이 반환됩니다.

키의 암호화는 cipherpassword 매개 변수를 사용하여 지정해야 합니다. 키를 암호화하지 않고 저장하려면 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.