mirror of
https://github.com/nextcloud/desktop.git
synced 2024-10-27 23:17:13 +03:00
[cse] Correctly send the CSR
finally. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This commit is contained in:
parent
307dfd195c
commit
090336c928
2 changed files with 9 additions and 5 deletions
|
@ -150,7 +150,7 @@ QString ClientSideEncryption::generateCSR(EVP_PKEY *keyPair)
|
|||
|
||||
X509_REQ *x509_req = nullptr;
|
||||
auto out = BIO_new(BIO_s_mem());
|
||||
QByteArray output("csr=\"");
|
||||
QByteArray output;
|
||||
char data[80];
|
||||
SignPublicKeyApiJob *job = nullptr;
|
||||
|
||||
|
@ -186,10 +186,11 @@ QString ClientSideEncryption::generateCSR(EVP_PKEY *keyPair)
|
|||
do {
|
||||
ret = BIO_gets(out, data, 80);
|
||||
output += data;
|
||||
if (output.endsWith("-----END CERTIFICATE REQUEST-----"))
|
||||
if (output.endsWith("-----END CERTIFICATE REQUEST-----")) {
|
||||
output = output.trimmed();
|
||||
break;
|
||||
}
|
||||
} while (ret > 0 );
|
||||
output += "\"";
|
||||
|
||||
qCInfo(lcCse()) << "Returning the certificate";
|
||||
qCInfo(lcCse()) << output;
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include <QPixmap>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
|
||||
#include "networkjobs.h"
|
||||
#include "account.h"
|
||||
#include "owncloudpropagator.h"
|
||||
|
@ -950,7 +949,9 @@ SignPublicKeyApiJob::SignPublicKeyApiJob(const AccountPtr& account, const QStrin
|
|||
|
||||
void SignPublicKeyApiJob::setCsr(const QByteArray& csr)
|
||||
{
|
||||
_csr.setData(csr);
|
||||
QByteArray data = "csr=";
|
||||
data += QUrl::toPercentEncoding(csr);
|
||||
_csr.setData(data);
|
||||
}
|
||||
|
||||
void SignPublicKeyApiJob::start()
|
||||
|
@ -963,6 +964,7 @@ void SignPublicKeyApiJob::start()
|
|||
};
|
||||
url.setQueryItems(params);
|
||||
|
||||
qCInfo(lcSignPublicKeyApiJob) << "Sending the CSR" << _csr.data();
|
||||
sendRequest("POST", url, req, &_csr);
|
||||
AbstractNetworkJob::start();
|
||||
}
|
||||
|
@ -977,3 +979,4 @@ bool SignPublicKeyApiJob::finished()
|
|||
}
|
||||
|
||||
} // namespace OCC
|
||||
|
||||
|
|
Loading…
Reference in a new issue