aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSona Kurazyan <sona.kurazyan@qt.io>2019-05-14 13:38:49 +0200
committerSona Kurazyan <sona.kurazyan@qt.io>2019-05-14 15:16:02 +0000
commit38f8e9feb94b1a552795af711c3c68c73dd1caba (patch)
treed7751073a164481db13c33c3a810e4405f808094
parent273f3fa6cee9c215fcdea6b5ee52ad34eb146452 (diff)
Improve namings of QCoapSecurityConfiguration
- Rename QCoapPrivateKey::isEmpty() -> QCoapPrivateKey::isNull(). - Use 'preSharedKeyIdentity' instead of 'identity'. This change is based on the feedback from API review. Change-Id: Iba517a01a16edede86c4572204d560978b3dc067 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
-rw-r--r--examples/coap/quicksecureclient/qmlcoapsecureclient.cpp2
-rw-r--r--src/coap/qcoapqudpconnection.cpp4
-rw-r--r--src/coap/qcoapsecurityconfiguration.cpp12
-rw-r--r--src/coap/qcoapsecurityconfiguration.h6
4 files changed, 12 insertions, 12 deletions
diff --git a/examples/coap/quicksecureclient/qmlcoapsecureclient.cpp b/examples/coap/quicksecureclient/qmlcoapsecureclient.cpp
index 1d141bb..dd40f4e 100644
--- a/examples/coap/quicksecureclient/qmlcoapsecureclient.cpp
+++ b/examples/coap/quicksecureclient/qmlcoapsecureclient.cpp
@@ -127,7 +127,7 @@ QmlCoapSecureClient::setSecurityConfiguration(const QString &preSharedKey, const
{
QCoapSecurityConfiguration configuration;
configuration.setPreSharedKey(preSharedKey.toUtf8());
- configuration.setIdentity(identity.toUtf8());
+ configuration.setPreSharedKeyIdentity(identity.toUtf8());
m_configuration = configuration;
}
diff --git a/src/coap/qcoapqudpconnection.cpp b/src/coap/qcoapqudpconnection.cpp
index 4ca78dd..ebb3fa9 100644
--- a/src/coap/qcoapqudpconnection.cpp
+++ b/src/coap/qcoapqudpconnection.cpp
@@ -376,7 +376,7 @@ void QCoapQUdpConnectionPrivate::setSecurityConfiguration(
if (!configuration.localCertificateChain().isEmpty())
dtlsConfig.setLocalCertificateChain(configuration.localCertificateChain().toList());
- if (!configuration.privateKey().isEmpty()) {
+ if (!configuration.privateKey().isNull()) {
if (configuration.privateKey().algorithm() != QSsl::Opaque) {
QSslKey privateKey(configuration.privateKey().key(),
configuration.privateKey().algorithm(),
@@ -409,7 +409,7 @@ void QCoapQUdpConnectionPrivate::setSecurityConfiguration(
void QCoapQUdpConnection::pskRequired(QSslPreSharedKeyAuthenticator *authenticator)
{
Q_ASSERT(authenticator);
- authenticator->setIdentity(securityConfiguration().identity());
+ authenticator->setIdentity(securityConfiguration().preSharedKeyIdentity());
authenticator->setPreSharedKey(securityConfiguration().preSharedKey());
}
diff --git a/src/coap/qcoapsecurityconfiguration.cpp b/src/coap/qcoapsecurityconfiguration.cpp
index 02b4022..5fb8b26 100644
--- a/src/coap/qcoapsecurityconfiguration.cpp
+++ b/src/coap/qcoapsecurityconfiguration.cpp
@@ -149,9 +149,9 @@ QCoapPrivateKey &QCoapPrivateKey::operator=(const QCoapPrivateKey &other)
}
/*!
- Returns \c true if the private key is empty, returns \c false otherwise.
+ Returns \c true if the private key is null, returns \c false otherwise.
*/
-bool QCoapPrivateKey::isEmpty() const
+bool QCoapPrivateKey::isNull() const
{
return d->algorithm == QSsl::Opaque ? !d->opaqueKey : d->key.isEmpty();
}
@@ -262,9 +262,9 @@ QCoapSecurityConfiguration::~QCoapSecurityConfiguration()
/*!
Sets the PSK client identity (to be advised to the server) to \a identity.
- \sa identity()
+ \sa preSharedKeyIdentity()
*/
-void QCoapSecurityConfiguration::setIdentity(const QByteArray &identity)
+void QCoapSecurityConfiguration::setPreSharedKeyIdentity(const QByteArray &identity)
{
d->identity = identity;
}
@@ -272,9 +272,9 @@ void QCoapSecurityConfiguration::setIdentity(const QByteArray &identity)
/*!
Returns the PSK client identity.
- \sa setIdentity()
+ \sa setPreSharedKeyIdentity()
*/
-QByteArray QCoapSecurityConfiguration::identity() const
+QByteArray QCoapSecurityConfiguration::preSharedKeyIdentity() const
{
return d->identity;
}
diff --git a/src/coap/qcoapsecurityconfiguration.h b/src/coap/qcoapsecurityconfiguration.h
index 7dc00bf..d91ac52 100644
--- a/src/coap/qcoapsecurityconfiguration.h
+++ b/src/coap/qcoapsecurityconfiguration.h
@@ -59,7 +59,7 @@ public:
void swap(QCoapPrivateKey &other) Q_DECL_NOTHROW
{ qSwap(d, other.d); }
- bool isEmpty() const;
+ bool isNull() const;
QByteArray key() const;
Qt::HANDLE handle() const;
@@ -86,8 +86,8 @@ public:
void swap(QCoapSecurityConfiguration &other) Q_DECL_NOTHROW
{ qSwap(d, other.d); }
- void setIdentity(const QByteArray &identity);
- QByteArray identity() const;
+ void setPreSharedKeyIdentity(const QByteArray &preSharedKeyIdentity);
+ QByteArray preSharedKeyIdentity() const;
void setPreSharedKey(const QByteArray &preSharedKey);
QByteArray preSharedKey() const;