mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-22 21:15:55 +03:00
fix upload of private key when initializing the end-to-end encryption
Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
This commit is contained in:
parent
3a0e0f2097
commit
c8e5ac7b5f
1 changed files with 19 additions and 4 deletions
|
@ -146,6 +146,11 @@ public:
|
|||
BIO_free_all(_bio);
|
||||
}
|
||||
|
||||
operator const BIO*() const
|
||||
{
|
||||
return _bio;
|
||||
}
|
||||
|
||||
operator BIO*()
|
||||
{
|
||||
return _bio;
|
||||
|
@ -1289,15 +1294,24 @@ void ClientSideEncryption::generateKeyPair(const AccountPtr &account)
|
|||
qCInfo(lcCse()) << "Key correctly generated";
|
||||
qCInfo(lcCse()) << "Storing keys locally";
|
||||
|
||||
{
|
||||
Bio privKey;
|
||||
if (PEM_write_bio_PrivateKey(privKey, localKeyPair, nullptr, nullptr, 0, nullptr, nullptr) <= 0) {
|
||||
qCInfo(lcCse()) << "Could not read private key from bio.";
|
||||
return;
|
||||
}
|
||||
|
||||
const auto key = BIO2ByteArray(privKey);
|
||||
_privateKey = key; qCDebug(lcCse) << _privateKey;
|
||||
}
|
||||
|
||||
Bio privKey;
|
||||
if (PEM_write_bio_PrivateKey(privKey, localKeyPair, nullptr, nullptr, 0, nullptr, nullptr) <= 0) {
|
||||
qCInfo(lcCse()) << "Could not read private key from bio.";
|
||||
return;
|
||||
}
|
||||
|
||||
auto privateKey = PKey::readPrivateKey(privKey);
|
||||
const auto key = BIO2ByteArray(privKey);
|
||||
//_privateKey = QSslKey(key, QSsl::Rsa, QSsl::Pem, QSsl::PrivateKey);
|
||||
_privateKey = key;
|
||||
|
||||
qCInfo(lcCse()) << "Keys generated correctly, sending to server.";
|
||||
auto csrOutput = generateCSR(account, std::move(localKeyPair), std::move(privateKey));
|
||||
|
@ -1530,7 +1544,8 @@ void ClientSideEncryption::encryptPrivateKey(const AccountPtr &account)
|
|||
generateMnemonic();
|
||||
}
|
||||
|
||||
const auto passPhrase = _mnemonic.remove(' ').toLower();
|
||||
auto passPhrase = _mnemonic;
|
||||
passPhrase = passPhrase.remove(' ').toLower();
|
||||
qCInfo(lcCse()) << "Passphrase Generated:" << passPhrase;
|
||||
|
||||
auto salt = EncryptionHelper::generateRandom(40);
|
||||
|
|
Loading…
Reference in a new issue