summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Keller <Rainer.Keller@qt.io>2019-03-15 15:16:11 +0100
committerRainer Keller <Rainer.Keller@qt.io>2019-03-25 07:31:34 +0000
commit06bf9809f8e15349b80b29eaf16520a802860257 (patch)
tree8c05b89456a974244474fe17f98377c4a19cc553
parentca4e5567f9e8af280c3d7f0463b959adc373c1ba (diff)
Rename API to be more consistent with QT API
Change-Id: I6e55cd8d51b0058e051d757d4eead6024c88caf0 Reviewed-by: Frank Meerkoetter <frank.meerkoetter@basyskom.com>
-rw-r--r--examples/opcua/opcuaviewer/certificatedialog.cpp6
-rw-r--r--examples/opcua/opcuaviewer/certificatedialog.h4
-rw-r--r--examples/opcua/opcuaviewer/mainwindow.cpp24
-rw-r--r--src/opcua/client/qopcuaapplicationidentity.cpp4
-rw-r--r--src/opcua/client/qopcuaclient.cpp8
-rw-r--r--src/opcua/client/qopcuaclient.h4
-rw-r--r--src/opcua/client/qopcuaclient_p.h6
-rw-r--r--src/opcua/client/qopcuaclientprivate.cpp8
-rw-r--r--src/opcua/client/qopcuapkiconfiguration.cpp84
-rw-r--r--src/opcua/client/qopcuapkiconfiguration.h24
-rw-r--r--src/plugins/opcua/uacpp/quacppbackend.cpp20
-rw-r--r--tests/auto/security/tst_security.cpp30
12 files changed, 111 insertions, 111 deletions
diff --git a/examples/opcua/opcuaviewer/certificatedialog.cpp b/examples/opcua/opcuaviewer/certificatedialog.cpp
index 61628bc..dd1b61a 100644
--- a/examples/opcua/opcuaviewer/certificatedialog.cpp
+++ b/examples/opcua/opcuaviewer/certificatedialog.cpp
@@ -54,11 +54,11 @@ CertificateDialog::~CertificateDialog()
}
/** Returns 0 if the connect should be aborted, 1 if it should be resumed. */
-int CertificateDialog::showCertificate(const QString &message, const QByteArray &der, const QString &trustListLocation)
+int CertificateDialog::showCertificate(const QString &message, const QByteArray &der, const QString &trustListDirectory)
{
QList<QSslCertificate> certs = QSslCertificate::fromData(der, QSsl::Der);
- m_trustListLocation = trustListLocation;
+ m_trustListDirectory = trustListDirectory;
// if it is a unstrusted self-signed certificate we can allow to trust it
if (certs.count() == 1 && certs[0].isSelfSigned()) {
@@ -81,7 +81,7 @@ int CertificateDialog::showCertificate(const QString &message, const QByteArray
void CertificateDialog::saveCertificate()
{
const QByteArray digest = m_cert.digest();
- const QString path = m_trustListLocation + "/" + digest.toHex() + ".der";
+ const QString path = m_trustListDirectory + "/" + digest.toHex() + ".der";
QFile file(path);
if (file.open(QIODevice::WriteOnly)) {
diff --git a/examples/opcua/opcuaviewer/certificatedialog.h b/examples/opcua/opcuaviewer/certificatedialog.h
index 6e82ae1..ba0fc81 100644
--- a/examples/opcua/opcuaviewer/certificatedialog.h
+++ b/examples/opcua/opcuaviewer/certificatedialog.h
@@ -54,7 +54,7 @@ public:
explicit CertificateDialog(QWidget *parent = nullptr);
~CertificateDialog();
- int showCertificate(const QString &message, const QByteArray &der, const QString &trustListLocation);
+ int showCertificate(const QString &message, const QByteArray &der, const QString &trustListDirectory);
private slots:
void saveCertificate();
@@ -62,7 +62,7 @@ private slots:
private:
Ui::CertificateDialog *ui;
QSslCertificate m_cert;
- QString m_trustListLocation;
+ QString m_trustListDirectory;
};
QT_END_NAMESPACE
diff --git a/examples/opcua/opcuaviewer/mainwindow.cpp b/examples/opcua/opcuaviewer/mainwindow.cpp
index ac367fa..e97b448 100644
--- a/examples/opcua/opcuaviewer/mainwindow.cpp
+++ b/examples/opcua/opcuaviewer/mainwindow.cpp
@@ -193,12 +193,12 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
void MainWindow::setupPkiConfiguration()
{
const QString pkidir = QCoreApplication::applicationDirPath() + "/pki";
- m_pkiConfig.setClientCertificateLocation(pkidir + "/own/certs/opcuaviewer.der");
- m_pkiConfig.setPrivateKeyLocation(pkidir + "/own/private/opcuaviewer.pem");
- m_pkiConfig.setTrustListLocation(pkidir + "/trusted/certs");
- m_pkiConfig.setRevocationListLocation(pkidir + "/trusted/crl");
- m_pkiConfig.setIssuerListLocation(pkidir + "/issuers/certs");
- m_pkiConfig.setIssuerRevocationListLocation(pkidir + "/issuers/crl");
+ m_pkiConfig.setClientCertificateFile(pkidir + "/own/certs/opcuaviewer.der");
+ m_pkiConfig.setPrivateKeyFile(pkidir + "/own/private/opcuaviewer.pem");
+ m_pkiConfig.setTrustListDirectory(pkidir + "/trusted/certs");
+ m_pkiConfig.setRevocationListDirectory(pkidir + "/trusted/crl");
+ m_pkiConfig.setIssuerListDirectory(pkidir + "/issuers/certs");
+ m_pkiConfig.setIssuerRevocationListDirectory(pkidir + "/issuers/crl");
// create the folders if they don't exist yet
createPkiFolders();
@@ -217,7 +217,7 @@ void MainWindow::createClient()
}
connect(mOpcUaClient, &QOpcUaClient::connectError, this, &MainWindow::showErrorDialog);
- mOpcUaClient->setIdentity(m_identity);
+ mOpcUaClient->setApplicationIdentity(m_identity);
mOpcUaClient->setPkiConfiguration(m_pkiConfig);
if (mOpcUaClient->supportedUserTokenTypes().contains(QOpcUaUserTokenPolicy::TokenType::Certificate)) {
@@ -431,19 +431,19 @@ bool MainWindow::createPkiPath(const QString &path)
bool MainWindow::createPkiFolders()
{
- bool result = createPkiPath(m_pkiConfig.trustListLocation());
+ bool result = createPkiPath(m_pkiConfig.trustListDirectory());
if (!result)
return result;
- result = createPkiPath(m_pkiConfig.revocationListLocation());
+ result = createPkiPath(m_pkiConfig.revocationListDirectory());
if (!result)
return result;
- result = createPkiPath(m_pkiConfig.issuerListLocation());
+ result = createPkiPath(m_pkiConfig.issuerListDirectory());
if (!result)
return result;
- result = createPkiPath(m_pkiConfig.issuerRevocationListLocation());
+ result = createPkiPath(m_pkiConfig.issuerRevocationListDirectory());
if (!result)
return result;
@@ -467,7 +467,7 @@ void MainWindow::showErrorDialog(QOpcUaErrorState *errorState)
case QOpcUaErrorState::ConnectionStep::CertificateValidation:
msg += tr("Server certificate validation failed with error 0x%1 (%2).\nClick 'Abort' to abort the connect, or 'Ignore' to continue connecting.")
.arg(static_cast<ulong>(errorState->errorCode()), 8, 16, QLatin1Char('0')).arg(statuscode);
- result = dlg.showCertificate(msg, m_endpoint.serverCertificate(), m_pkiConfig.trustListLocation());
+ result = dlg.showCertificate(msg, m_endpoint.serverCertificate(), m_pkiConfig.trustListDirectory());
errorState->setIgnoreError(result == 1);
break;
case QOpcUaErrorState::ConnectionStep::OpenSecureChannel:
diff --git a/src/opcua/client/qopcuaapplicationidentity.cpp b/src/opcua/client/qopcuaapplicationidentity.cpp
index e16acfb..6e96102 100644
--- a/src/opcua/client/qopcuaapplicationidentity.cpp
+++ b/src/opcua/client/qopcuaapplicationidentity.cpp
@@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE
and functionality provided by the class may be subject to change at any time without
prior notice.
- This info must be configured using \l QOpcUaClient::setIdentity.
+ This info must be configured using \l QOpcUaClient::setApplicationIdentity.
The application identity can be set up manually or derived from a certificate.
\code
@@ -67,7 +67,7 @@ QT_BEGIN_NAMESPACE
identity.setApplicationName(QCoreApplication::applicationName());
identity.setApplicationType(QOpcUaApplicationDescription::Client);
- client->setIdentity(identity);
+ client->setApplicationIdentity(identity);
\endcode
In case your application authenticates using certificates the application identity has to match
diff --git a/src/opcua/client/qopcuaclient.cpp b/src/opcua/client/qopcuaclient.cpp
index bc47ec7..2deaa41 100644
--- a/src/opcua/client/qopcuaclient.cpp
+++ b/src/opcua/client/qopcuaclient.cpp
@@ -326,10 +326,10 @@ QOpcUaClient::~QOpcUaClient()
and functionality provided by the class may be subject to change at any time without
prior notice.
*/
-void QOpcUaClient::setIdentity(const QOpcUaApplicationIdentity &identity)
+void QOpcUaClient::setApplicationIdentity(const QOpcUaApplicationIdentity &identity)
{
Q_D(QOpcUaClient);
- d->setIdentity(identity);
+ d->setApplicationIdentity(identity);
}
/*!
@@ -340,10 +340,10 @@ void QOpcUaClient::setIdentity(const QOpcUaApplicationIdentity &identity)
and functionality provided by the class may be subject to change at any time without
prior notice.
*/
-QOpcUaApplicationIdentity QOpcUaClient::identity() const
+QOpcUaApplicationIdentity QOpcUaClient::applicationIdentity() const
{
Q_D(const QOpcUaClient);
- return d->identity();
+ return d->applicationIdentity();
}
/*!
diff --git a/src/opcua/client/qopcuaclient.h b/src/opcua/client/qopcuaclient.h
index 3c1cef1..2824922 100644
--- a/src/opcua/client/qopcuaclient.h
+++ b/src/opcua/client/qopcuaclient.h
@@ -93,8 +93,8 @@ public:
explicit QOpcUaClient(QOpcUaClientImpl *impl, QObject *parent = nullptr);
~QOpcUaClient();
- void setIdentity(const QOpcUaApplicationIdentity &identity);
- QOpcUaApplicationIdentity identity() const;
+ void setApplicationIdentity(const QOpcUaApplicationIdentity &identity);
+ QOpcUaApplicationIdentity applicationIdentity() const;
void setPkiConfiguration(const QOpcUaPkiConfiguration &config);
QOpcUaPkiConfiguration pkiConfiguration() const;
diff --git a/src/opcua/client/qopcuaclient_p.h b/src/opcua/client/qopcuaclient_p.h
index 98a020e..62d8ed5 100644
--- a/src/opcua/client/qopcuaclient_p.h
+++ b/src/opcua/client/qopcuaclient_p.h
@@ -85,8 +85,8 @@ public:
void namespaceArrayUpdated(QOpcUa::NodeAttributes attr);
void setupNamespaceArrayMonitoring();
- void setIdentity(const QOpcUaApplicationIdentity &identity);
- QOpcUaApplicationIdentity identity() const;
+ void setApplicationIdentity(const QOpcUaApplicationIdentity &identity);
+ QOpcUaApplicationIdentity applicationIdentity() const;
void setPkiConfiguration(const QOpcUaPkiConfiguration &config);
QOpcUaPkiConfiguration pkiConfiguration() const;
@@ -97,7 +97,7 @@ private:
QScopedPointer<QOpcUaNode> m_namespaceArrayNode;
bool m_namespaceArrayAutoupdateEnabled;
unsigned int m_namespaceArrayUpdateInterval;
- QOpcUaApplicationIdentity m_identity;
+ QOpcUaApplicationIdentity m_applicationIdentity;
QOpcUaPkiConfiguration m_pkiConfig;
};
diff --git a/src/opcua/client/qopcuaclientprivate.cpp b/src/opcua/client/qopcuaclientprivate.cpp
index 467dd41..1e4c0ae 100644
--- a/src/opcua/client/qopcuaclientprivate.cpp
+++ b/src/opcua/client/qopcuaclientprivate.cpp
@@ -259,14 +259,14 @@ void QOpcUaClientPrivate::setupNamespaceArrayMonitoring()
}
}
-void QOpcUaClientPrivate::setIdentity(const QOpcUaApplicationIdentity &identity)
+void QOpcUaClientPrivate::setApplicationIdentity(const QOpcUaApplicationIdentity &identity)
{
- m_identity = identity;
+ m_applicationIdentity = identity;
}
-QOpcUaApplicationIdentity QOpcUaClientPrivate::identity() const
+QOpcUaApplicationIdentity QOpcUaClientPrivate::applicationIdentity() const
{
- return m_identity;
+ return m_applicationIdentity;
}
void QOpcUaClientPrivate::setPkiConfiguration(const QOpcUaPkiConfiguration &config)
diff --git a/src/opcua/client/qopcuapkiconfiguration.cpp b/src/opcua/client/qopcuapkiconfiguration.cpp
index 05f5795..5c92740 100644
--- a/src/opcua/client/qopcuapkiconfiguration.cpp
+++ b/src/opcua/client/qopcuapkiconfiguration.cpp
@@ -62,12 +62,12 @@ Q_DECLARE_LOGGING_CATEGORY(QT_OPCUA_SECURITY);
QOpcUaPkiConfiguration pkiConfig;
const QString pkiDir = QCoreApplication::applicationDirPath() + "/pki";
- pkiConfig.setClientCertificateLocation(pkidir + "/own/certs/application.der");
- pkiConfig.setPrivateKeyLocation(pkidir + "/own/private/application.pem");
- pkiConfig.setTrustListLocation(pkidir + "/trusted/certs");
+ pkiConfig.setClientCertificateDirectory(pkidir + "/own/certs/application.der");
+ pkiConfig.setPrivateKeyDirectory(pkidir + "/own/private/application.pem");
+ pkiConfig.setTrustListDirectory(pkidir + "/trusted/certs");
pkiConfig.setRevocationListLocation(pkidir + "/trusted/crl");
- pkiConfig.setIssuerListLocation(pkidir + "/issuers/certs");
- pkiConfig.setIssuerRevocationListLocation(pkidir + "/issuers/crl");
+ pkiConfig.setIssuerListDirectory(pkidir + "/issuers/certs");
+ pkiConfig.setIssuerRevocationListDirectory(pkidir + "/issuers/crl");
client->setPkiConfiguration(pkiConfig);
\endcode
@@ -78,12 +78,12 @@ class QOpcUaPkiConfigurationData : public QSharedData
public:
QOpcUaPkiConfigurationData() {}
- QString m_clientCertificateLocation; /**< Own application certificate filename */
- QString m_privateKeyLocation; /**< Private key filename which belongs to m_certificateLocation */
- QString m_trustListLocation; /**< Path to trust list location */
- QString m_revocationListLocation; /**< Path to certificate revocation list */
- QString m_issuerListLocation; /**< Path to issuer intermediate certficates (untrusted) */
- QString m_issuerRevocationListLocation; /**< Path to issure revocation list */
+ QString m_clientCertificateFile; /**< Own application certificate filename */
+ QString m_privateKeyFile; /**< Private key filename which belongs to m_certificateFile */
+ QString m_trustListDirectory; /**< Path to trust list directory */
+ QString m_revocationListDirectory; /**< Folder containing certificate revocation list */
+ QString m_issuerListDirectory; /**< Folder containing issuer intermediate certficates (untrusted) */
+ QString m_issuerRevocationListDirectory; /**< Folder containing issuer revocation list */
};
QOpcUaPkiConfiguration::QOpcUaPkiConfiguration()
@@ -113,9 +113,9 @@ QOpcUaPkiConfiguration &QOpcUaPkiConfiguration::operator=(const QOpcUaPkiConfigu
/*!
Returns the file path of the application's client certificate.
*/
-QString QOpcUaPkiConfiguration::clientCertificateLocation() const
+QString QOpcUaPkiConfiguration::clientCertificateFile() const
{
- return data->m_clientCertificateLocation;
+ return data->m_clientCertificateFile;
}
/*!
@@ -123,17 +123,17 @@ QString QOpcUaPkiConfiguration::clientCertificateLocation() const
This file has to be in X509 DER format.
*/
-void QOpcUaPkiConfiguration::setClientCertificateLocation(const QString &value)
+void QOpcUaPkiConfiguration::setClientCertificateFile(const QString &value)
{
- data->m_clientCertificateLocation = value;
+ data->m_clientCertificateFile = value;
}
/*!
Returns the file path of the application's private key.
*/
-QString QOpcUaPkiConfiguration::privateKeyLocation() const
+QString QOpcUaPkiConfiguration::privateKeyFile() const
{
- return data->m_privateKeyLocation;
+ return data->m_privateKeyFile;
}
/*!
@@ -141,17 +141,17 @@ QString QOpcUaPkiConfiguration::privateKeyLocation() const
This file has to be in X509 PEM format.
*/
-void QOpcUaPkiConfiguration::setPrivateKeyLocation(const QString &value)
+void QOpcUaPkiConfiguration::setPrivateKeyFile(const QString &value)
{
- data->m_privateKeyLocation = value;
+ data->m_privateKeyFile = value;
}
/*!
- Returns the path of the certificate trust list directory.
+ Returns the folder of the certificate trust list.
*/
-QString QOpcUaPkiConfiguration::trustListLocation() const
+QString QOpcUaPkiConfiguration::trustListDirectory() const
{
- return data->m_trustListLocation;
+ return data->m_trustListDirectory;
}
/*!
@@ -160,25 +160,25 @@ QString QOpcUaPkiConfiguration::trustListLocation() const
All certificates in this directory will be trusted.
Certificates have to be in X509 DER format.
*/
-void QOpcUaPkiConfiguration::setTrustListLocation(const QString &value)
+void QOpcUaPkiConfiguration::setTrustListDirectory(const QString &value)
{
- data->m_trustListLocation = value;
+ data->m_trustListDirectory = value;
}
/*!
Returns the path of the certificate revocation list directory.
*/
-QString QOpcUaPkiConfiguration::revocationListLocation() const
+QString QOpcUaPkiConfiguration::revocationListDirectory() const
{
- return data->m_revocationListLocation;
+ return data->m_revocationListDirectory;
}
/*!
Sets the path of the certificate revocation list directory to \a value.
*/
-void QOpcUaPkiConfiguration::setRevocationListLocation(const QString &value)
+void QOpcUaPkiConfiguration::setRevocationListDirectory(const QString &value)
{
- data->m_revocationListLocation = value;
+ data->m_revocationListDirectory = value;
}
/*!
@@ -186,33 +186,33 @@ void QOpcUaPkiConfiguration::setRevocationListLocation(const QString &value)
These issuers will not be trusted.
*/
-QString QOpcUaPkiConfiguration::issuerListLocation() const
+QString QOpcUaPkiConfiguration::issuerListDirectory() const
{
- return data->m_issuerListLocation;
+ return data->m_issuerListDirectory;
}
/*!
Sets the path of the intermediate issuer list directory to \a value.
*/
-void QOpcUaPkiConfiguration::setIssuerListLocation(const QString &value)
+void QOpcUaPkiConfiguration::setIssuerListDirectory(const QString &value)
{
- data->m_issuerListLocation = value;
+ data->m_issuerListDirectory = value;
}
/*!
Returns the path of the intermediate issuer revocation list directory.
*/
-QString QOpcUaPkiConfiguration::issuerRevocationListLocation() const
+QString QOpcUaPkiConfiguration::issuerRevocationListDirectory() const
{
- return data->m_issuerRevocationListLocation;
+ return data->m_issuerRevocationListDirectory;
}
/*!
Sets the path of the intermediate issuer revocation list directory to \a value.
*/
-void QOpcUaPkiConfiguration::setIssuerRevocationListLocation(const QString &value)
+void QOpcUaPkiConfiguration::setIssuerRevocationListDirectory(const QString &value)
{
- data->m_issuerRevocationListLocation = value;
+ data->m_issuerRevocationListDirectory = value;
}
/*!
@@ -225,9 +225,9 @@ QOpcUaApplicationIdentity QOpcUaPkiConfiguration::applicationIdentity() const
{
QOpcUaApplicationIdentity identity;
- auto certList = QSslCertificate::fromPath(data->m_clientCertificateLocation, QSsl::Der);
+ auto certList = QSslCertificate::fromPath(clientCertificateFile(), QSsl::Der);
if (certList.isEmpty()) {
- qCWarning(QT_OPCUA_SECURITY) << "No client certificate found at" << data->m_clientCertificateLocation
+ qCWarning(QT_OPCUA_SECURITY) << "No client certificate found at" << clientCertificateFile()
<< ". Application identity will be invalid.";
return QOpcUaApplicationIdentity();
}
@@ -261,10 +261,10 @@ QOpcUaApplicationIdentity QOpcUaPkiConfiguration::applicationIdentity() const
*/
bool QOpcUaPkiConfiguration::isPkiValid() const
{
- return !data->m_issuerListLocation.isEmpty() &&
- !data->m_issuerRevocationListLocation.isEmpty() &&
- !data->m_revocationListLocation.isEmpty() &&
- !data->m_trustListLocation.isEmpty();
+ return !issuerListDirectory().isEmpty() &&
+ !issuerRevocationListDirectory().isEmpty() &&
+ !revocationListDirectory().isEmpty() &&
+ !trustListDirectory().isEmpty();
}
QT_END_NAMESPACE
diff --git a/src/opcua/client/qopcuapkiconfiguration.h b/src/opcua/client/qopcuapkiconfiguration.h
index 2a4d7a0..8c0fe7f 100644
--- a/src/opcua/client/qopcuapkiconfiguration.h
+++ b/src/opcua/client/qopcuapkiconfiguration.h
@@ -57,23 +57,23 @@ public:
QOpcUaPkiConfiguration(const QOpcUaPkiConfiguration &other);
QOpcUaPkiConfiguration &operator=(const QOpcUaPkiConfiguration &rhs);
- QString clientCertificateLocation() const;
- void setClientCertificateLocation(const QString &value);
+ QString clientCertificateFile() const;
+ void setClientCertificateFile(const QString &value);
- QString privateKeyLocation() const;
- void setPrivateKeyLocation(const QString &value);
+ QString privateKeyFile() const;
+ void setPrivateKeyFile(const QString &value);
- QString trustListLocation() const;
- void setTrustListLocation(const QString &value);
+ QString trustListDirectory() const;
+ void setTrustListDirectory(const QString &value);
- QString revocationListLocation() const;
- void setRevocationListLocation(const QString &value);
+ QString revocationListDirectory() const;
+ void setRevocationListDirectory(const QString &value);
- QString issuerListLocation() const;
- void setIssuerListLocation(const QString &value);
+ QString issuerListDirectory() const;
+ void setIssuerListDirectory(const QString &value);
- QString issuerRevocationListLocation() const;
- void setIssuerRevocationListLocation(const QString &value);
+ QString issuerRevocationListDirectory() const;
+ void setIssuerRevocationListDirectory(const QString &value);
QOpcUaApplicationIdentity applicationIdentity() const;
diff --git a/src/plugins/opcua/uacpp/quacppbackend.cpp b/src/plugins/opcua/uacpp/quacppbackend.cpp
index 813d0cb..0dcab29 100644
--- a/src/plugins/opcua/uacpp/quacppbackend.cpp
+++ b/src/plugins/opcua/uacpp/quacppbackend.cpp
@@ -226,7 +226,7 @@ void UACppAsyncBackend::connectToEndpoint(const QOpcUaEndpointDescription &endpo
emit stateAndOrErrorChanged(QOpcUaClient::Connecting, QOpcUaClient::NoError);
- const auto identity = m_clientImpl->m_client->identity();
+ const auto identity = m_clientImpl->m_client->applicationIdentity();
const auto authInfo = m_clientImpl->m_client->authenticationInformation();
const auto pkiConfig = m_clientImpl->m_client->pkiConfiguration();
@@ -242,10 +242,10 @@ void UACppAsyncBackend::connectToEndpoint(const QOpcUaEndpointDescription &endpo
if (pkiConfig.isPkiValid()) {
auto result = sessionSecurityInfo.initializePkiProviderOpenSSL(
- pkiConfig.revocationListLocation().toUtf8().constData(),
- pkiConfig.trustListLocation().toUtf8().constData(),
- pkiConfig.issuerRevocationListLocation().toUtf8().constData(),
- pkiConfig.issuerListLocation().toUtf8().constData());
+ pkiConfig.revocationListDirectory().toUtf8().constData(),
+ pkiConfig.trustListDirectory().toUtf8().constData(),
+ pkiConfig.issuerRevocationListDirectory().toUtf8().constData(),
+ pkiConfig.issuerListDirectory().toUtf8().constData());
if (result.isNotGood()) {
qCWarning(QT_OPCUA_PLUGINS_UACPP) << "Failed to set up PKI: " << QString::fromUtf8(result.toString().toUtf8());
@@ -272,15 +272,15 @@ void UACppAsyncBackend::connectToEndpoint(const QOpcUaEndpointDescription &endpo
sessionSecurityInfo.disableEncryptedPasswordCheck = OpcUa_True;
} else if (authInfo.authenticationType() == QOpcUaUserTokenPolicy::TokenType::Certificate) {
// try to load the client certificate
- const UaString certificateFilePath(pkiConfig.clientCertificateLocation().toUtf8());
- const UaString privateKeyFilePath(pkiConfig.privateKeyLocation().toUtf8());
+ const UaString certificateFilePath(pkiConfig.clientCertificateFile().toUtf8());
+ const UaString privateKeyFilePath(pkiConfig.privateKeyFile().toUtf8());
UaStatus result;
QFile certFile(certificateFilePath.toUtf8());
if (certFile.open(QIODevice::ReadOnly)) {
certFile.close();
} else {
- qCWarning(QT_OPCUA_PLUGINS_UACPP) << "Failed to load certificate: " << pkiConfig.clientCertificateLocation();
+ qCWarning(QT_OPCUA_PLUGINS_UACPP) << "Failed to load certificate: " << pkiConfig.clientCertificateFile();
result = OpcUa_BadNotFound;
}
@@ -288,7 +288,7 @@ void UACppAsyncBackend::connectToEndpoint(const QOpcUaEndpointDescription &endpo
if (keyFile.open(QIODevice::ReadOnly)) {
keyFile.close();
} else {
- qCWarning(QT_OPCUA_PLUGINS_UACPP) << "Failed to load private key: " << pkiConfig.privateKeyLocation();
+ qCWarning(QT_OPCUA_PLUGINS_UACPP) << "Failed to load private key: " << pkiConfig.privateKeyFile();
result = OpcUa_BadNotFound;
}
@@ -301,7 +301,7 @@ void UACppAsyncBackend::connectToEndpoint(const QOpcUaEndpointDescription &endpo
do {
// This signal is connected using Qt::BlockingQueuedConnection. It will place a metacall to a different thread and waits
// until this metacall is fully handled before returning.
- emit QOpcUaBackend::passwordForPrivateKeyRequired(pkiConfig.privateKeyLocation(), &password, !password.isEmpty());
+ emit QOpcUaBackend::passwordForPrivateKeyRequired(pkiConfig.privateKeyFile(), &password, !password.isEmpty());
if (password.isEmpty())
break;
diff --git a/tests/auto/security/tst_security.cpp b/tests/auto/security/tst_security.cpp
index 9bf3c4b..cd0e31e 100644
--- a/tests/auto/security/tst_security.cpp
+++ b/tests/auto/security/tst_security.cpp
@@ -265,19 +265,19 @@ void Tst_QOpcUaSecurity::connectAndDisconnectUsingCertificate()
const QString pkidir = m_pkiData->path();
QOpcUaPkiConfiguration pkiConfig;
- pkiConfig.setClientCertificateLocation(pkidir + "/own/certs/tst_security.der");
- pkiConfig.setPrivateKeyLocation(pkidir + "/own/private/privateKeyWithoutPassword.pem");
- pkiConfig.setTrustListLocation(pkidir + "/trusted/certs");
- pkiConfig.setRevocationListLocation(pkidir + "/trusted/crl");
- pkiConfig.setIssuerListLocation(pkidir + "/issuers/certs");
- pkiConfig.setIssuerRevocationListLocation(pkidir + "/issuers/crl");
+ pkiConfig.setClientCertificateFile(pkidir + "/own/certs/tst_security.der");
+ pkiConfig.setPrivateKeyFile(pkidir + "/own/private/privateKeyWithoutPassword.pem");
+ pkiConfig.setTrustListDirectory(pkidir + "/trusted/certs");
+ pkiConfig.setRevocationListDirectory(pkidir + "/trusted/crl");
+ pkiConfig.setIssuerListDirectory(pkidir + "/issuers/certs");
+ pkiConfig.setIssuerRevocationListDirectory(pkidir + "/issuers/crl");
const auto identity = pkiConfig.applicationIdentity();
QOpcUaAuthenticationInformation authInfo;
authInfo.setCertificateAuthentication();
client->setAuthenticationInformation(authInfo);
- client->setIdentity(identity);
+ client->setApplicationIdentity(identity);
client->setPkiConfiguration(pkiConfig);
qDebug() << "Testing security policy" << endpoint.securityPolicyUri();
@@ -327,19 +327,19 @@ void Tst_QOpcUaSecurity::connectAndDisconnectUsingEncryptedPassword()
const QString pkidir = m_pkiData->path();
QOpcUaPkiConfiguration pkiConfig;
- pkiConfig.setClientCertificateLocation(pkidir + "/own/certs/tst_security.der");
- pkiConfig.setPrivateKeyLocation(pkidir + "/own/private/privateKeyWithPassword:secret.pem");
- pkiConfig.setTrustListLocation(pkidir + "/trusted/certs");
- pkiConfig.setRevocationListLocation(pkidir + "/trusted/crl");
- pkiConfig.setIssuerListLocation(pkidir + "/issuers/certs");
- pkiConfig.setIssuerRevocationListLocation(pkidir + "/issuers/crl");
+ pkiConfig.setClientCertificateFile(pkidir + "/own/certs/tst_security.der");
+ pkiConfig.setPrivateKeyFile(pkidir + "/own/private/privateKeyWithPassword:secret.pem");
+ pkiConfig.setTrustListDirectory(pkidir + "/trusted/certs");
+ pkiConfig.setRevocationListDirectory(pkidir + "/trusted/crl");
+ pkiConfig.setIssuerListDirectory(pkidir + "/issuers/certs");
+ pkiConfig.setIssuerRevocationListDirectory(pkidir + "/issuers/crl");
const auto identity = pkiConfig.applicationIdentity();
QOpcUaAuthenticationInformation authInfo;
authInfo.setCertificateAuthentication();
client->setAuthenticationInformation(authInfo);
- client->setIdentity(identity);
+ client->setApplicationIdentity(identity);
client->setPkiConfiguration(pkiConfig);
qDebug() << "Testing security policy" << endpoint.securityPolicyUri();
@@ -355,7 +355,7 @@ void Tst_QOpcUaSecurity::connectAndDisconnectUsingEncryptedPassword()
QVERIFY(previousTryFailed == true);
}
- QCOMPARE(privateKeyFilePath, pkiConfig.privateKeyLocation());
+ QCOMPARE(privateKeyFilePath, pkiConfig.privateKeyFile());
if (passwordRequestSpy < 1)
*password = "wrong password";