diff options
| author | Felix (xq) Queißner <git@mq32.de> | 2020-06-19 23:47:25 +0200 |
|---|---|---|
| committer | Felix (xq) Queißner <git@mq32.de> | 2020-06-19 23:47:25 +0200 |
| commit | 06d33eaa221d445561e3e76f5462a12ec4d0d7c5 (patch) | |
| tree | 2a688a3b6eae89a4e9ebd4bac24bb33c4378060b /src/webclient.cpp | |
| parent | d77e80fd9b241c6b18ebcb48d283e5419043a35e (diff) | |
| download | kristall-06d33eaa221d445561e3e76f5462a12ec4d0d7c5.tar.gz | |
Adds client certificates for HTTPS (untested)
Diffstat (limited to 'src/webclient.cpp')
| -rw-r--r-- | src/webclient.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/webclient.cpp b/src/webclient.cpp index b5d4d9d..b50d508 100644 --- a/src/webclient.cpp +++ b/src/webclient.cpp @@ -41,6 +41,11 @@ bool WebClient::startRequest(const QUrl &url, RequestOptions options) else ssl_config.setCaCertificates(QList<QSslCertificate> { }); + if(this->current_identity.isValid()) { + ssl_config.setLocalCertificate(this->current_identity.certificate); + ssl_config.setPrivateKey(this->current_identity.private_key); + } + // request.setMaximumRedirectsAllowed(5); request.setAttribute(QNetworkRequest::FollowRedirectsAttribute, false); request.setSslConfiguration(ssl_config); @@ -73,6 +78,17 @@ bool WebClient::cancelRequest() return true; } +bool WebClient::enableClientCertificate(const CryptoIdentity &ident) +{ + current_identity = ident; + return true; +} + +void WebClient::disableClientCertificate() +{ + current_identity = CryptoIdentity(); +} + void WebClient::on_data() { this->body.append(this->current_reply->readAll()); @@ -112,6 +128,7 @@ void WebClient::on_finished() } qDebug() << "web network error" << reply->errorString(); + qDebug() << this->body; emit this->networkError(error, reply->errorString()); } else |
