| 1 | // Copyright (C) 2019 The Qt Company Ltd. |
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | // |
| 5 | // W A R N I N G |
| 6 | // ------------- |
| 7 | // |
| 8 | // This file is not part of the Qt API. It exists purely as an |
| 9 | // implementation detail. This header file may change from version to |
| 10 | // version without notice, or even be removed. |
| 11 | // |
| 12 | // We mean it. |
| 13 | // |
| 14 | |
| 15 | #ifndef QOPCUAPUBLICKEYPRIVATE_H |
| 16 | #define QOPCUAPUBLICKEYPRIVATE_H |
| 17 | |
| 18 | #include <private/qobject_p.h> |
| 19 | #include "qopcuakeypair.h" |
| 20 | #include <QtCore/QLoggingCategory> |
| 21 | #include <openssl/rsa.h> |
| 22 | |
| 23 | QT_BEGIN_NAMESPACE |
| 24 | |
| 25 | Q_DECLARE_LOGGING_CATEGORY(lcSsl) |
| 26 | |
| 27 | class QOpcUaKeyPairPrivate : public QObjectPrivate |
| 28 | { |
| 29 | public: |
| 30 | QOpcUaKeyPairPrivate(); |
| 31 | ~QOpcUaKeyPairPrivate(); |
| 32 | |
| 33 | bool generateRsaKey(QOpcUaKeyPair::RsaKeyStrength strength); |
| 34 | bool loadFromPemData(const QByteArray &data); |
| 35 | QByteArray publicKeyToByteArray() const; |
| 36 | QByteArray privateKeyToByteArray(QOpcUaKeyPair::Cipher cipher, const QString &password) const; |
| 37 | QOpcUaKeyPair::KeyType keyType() const; |
| 38 | bool hasPrivateKey() const; |
| 39 | |
| 40 | protected: |
| 41 | EVP_PKEY *m_keyData = nullptr; |
| 42 | bool m_hasPrivateKey = false; |
| 43 | |
| 44 | private: |
| 45 | Q_DECLARE_PUBLIC(QOpcUaKeyPair) |
| 46 | |
| 47 | friend class QOpcUaX509CertificateSigningRequestPrivate; |
| 48 | }; |
| 49 | QT_END_NAMESPACE |
| 50 | |
| 51 | #endif // QOPCUAPUBLICKEYPRIVATE_H |
| 52 |
