return;
}
- const auto key = BIO2ByteArray(privKey);
- _privateKey = key;
+ _privateKey = BIO2ByteArray(privKey);
}
Bio privKey;
return;
}
- auto privateKey = PKey::readPrivateKey(privKey);
-
qCDebug(lcCse()) << "Key correctly generated";
- auto csrOutput = generateCSR(account, std::move(localKeyPair), std::move(privateKey));
- writeMnemonic(account, [account, keyPair = std::move(csrOutput.second), output = std::move(csrOutput.first), this]() mutable -> void {
- writeKeyPair(account, std::move(keyPair), output);
+ auto csrContent = generateCSR(account, std::move(localKeyPair), PKey::readPrivateKey(privKey));
+ writeMnemonic(account, [account, keyPair = std::move(csrContent.second), csrContent = std::move(csrContent.first), this]() mutable -> void {
+ writeKeyPair(account, std::move(keyPair), csrContent);
});
}
int nVersion = 1;
// 2. set version of x509 req
- X509_REQ *x509_req = X509_REQ_new();
+ auto x509_req = X509_REQ_new();
auto release_on_exit_x509_req = qScopeGuard([&] {
X509_REQ_free(x509_req);
});
void ClientSideEncryption::sendSignRequestCSR(const AccountPtr &account,
PKey keyPair,
- QByteArray csrContent)
+ const QByteArray &csrContent)
{
auto job = new SignPublicKeyApiJob(account, e2eeBaseUrl() + "public-key", this);
job->setCsr(csrContent);
void ClientSideEncryption::writeKeyPair(const AccountPtr &account,
PKey keyPair,
- QByteArray output)
+ const QByteArray &csrContent)
{
const auto privateKeyKeychainId = AbstractCredentials::keychainKey(
account->url().toString(),
privateKeyJob->setInsecureFallback(false);
privateKeyJob->setKey(privateKeyKeychainId);
privateKeyJob->setBinaryData(bytearrayPrivateKey);
- connect(privateKeyJob, &WritePasswordJob::finished, [keyPair = std::move(keyPair), publicKeyKeychainId, account, output, this] (Job *incoming) mutable {
+ connect(privateKeyJob, &WritePasswordJob::finished, [keyPair = std::move(keyPair), publicKeyKeychainId, account, csrContent, this] (Job *incoming) mutable {
if (incoming->error() != Error::NoError) {
failedToInitialize(account);
return;
publicKeyJob->setInsecureFallback(false);
publicKeyJob->setKey(publicKeyKeychainId);
publicKeyJob->setBinaryData(bytearrayPublicKey);
- connect(publicKeyJob, &WritePasswordJob::finished, [account, keyPair = std::move(keyPair), output, this](Job *incoming) mutable {
+ connect(publicKeyJob, &WritePasswordJob::finished, [account, keyPair = std::move(keyPair), csrContent, this](Job *incoming) mutable {
if (incoming->error() != Error::NoError) {
failedToInitialize(account);
return;
}
- sendSignRequestCSR(account, std::move(keyPair), output);
+ sendSignRequestCSR(account, std::move(keyPair), csrContent);
});
publicKeyJob->start();
});