Skip to content

Commit

Permalink
start using OpenSSL API for hardware token
Browse files Browse the repository at this point in the history
Signed-off-by: Matthieu Gallien <[email protected]>
  • Loading branch information
mgallien committed Jul 10, 2023
1 parent 2b814ce commit 820e33a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/libsync/clientsideencryption.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "clientsideencryption.h"

#define OPENSSL_SUPPRESS_DEPRECATED

#include <openssl/rsa.h>
#include <openssl/evp.h>
#include <openssl/pem.h>
Expand Down Expand Up @@ -34,6 +36,8 @@
#include <QRandomGenerator>
#include <QCryptographicHash>

#include <openssl/provider.h>

#include <map>
#include <string>
#include <algorithm>
Expand Down Expand Up @@ -874,7 +878,15 @@ QByteArray encryptStringAsymmetric(EVP_PKEY *publicKey, const QByteArray& data)
}


ClientSideEncryption::ClientSideEncryption() = default;
ClientSideEncryption::ClientSideEncryption()
{
auto defaultProvider = OSSL_PROVIDER_load(NULL, "default");

qCInfo(lcCse()) << "loaded provider" << defaultProvider;

_sslEngine = ENGINE_new();
qCInfo(lcCse()) << "ssl engine" << _sslEngine;
}

const QSslKey &ClientSideEncryption::getPublicKey() const
{
Expand Down
2 changes: 2 additions & 0 deletions src/libsync/clientsideencryption.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@ private slots:
bool _newMnemonicGenerated = false;

bool isInitialized = false;

ENGINE *_sslEngine = nullptr;
};

/* Generates the Metadata for the folder */
Expand Down

0 comments on commit 820e33a

Please sign in to comment.