2025-01-29 16:42:37 +01:00
|
|
|
#ifndef UTPASSPHRASEPROVIDER_H
|
|
|
|
#define UTPASSPHRASEPROVIDER_H
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <gpg-error.h>
|
2025-02-05 11:02:59 +01:00
|
|
|
// extern "C" {
|
|
|
|
// #include <rnp/rnp.h>
|
|
|
|
// }
|
2025-01-29 16:42:37 +01:00
|
|
|
|
2025-02-03 17:48:30 +01:00
|
|
|
class TesTPassphraseProvider : public QObject
|
2025-01-29 16:42:37 +01:00
|
|
|
{
|
2025-01-30 16:25:29 +01:00
|
|
|
Q_OBJECT
|
2025-02-03 17:48:30 +01:00
|
|
|
private:
|
|
|
|
explicit TesTPassphraseProvider(QObject * parent = nullptr)
|
|
|
|
{}
|
2025-01-29 16:42:37 +01:00
|
|
|
|
|
|
|
public:
|
2025-02-03 17:48:30 +01:00
|
|
|
~TesTPassphraseProvider() = default;
|
|
|
|
|
2025-02-03 21:46:21 +01:00
|
|
|
static TesTPassphraseProvider &instance()
|
2025-01-30 16:25:29 +01:00
|
|
|
{
|
2025-02-03 17:48:30 +01:00
|
|
|
static TesTPassphraseProvider instance;
|
|
|
|
return instance;
|
|
|
|
}
|
|
|
|
TesTPassphraseProvider(TesTPassphraseProvider const &) = delete;
|
|
|
|
void operator=(TesTPassphraseProvider const &) = delete;
|
2025-01-29 16:42:37 +01:00
|
|
|
|
|
|
|
|
2025-02-03 21:46:21 +01:00
|
|
|
static bool
|
|
|
|
example_pass_provider(rnp_ffi_t ffi,
|
|
|
|
void *app_ctx,
|
|
|
|
rnp_key_handle_t key,
|
|
|
|
const char *pgp_context,
|
|
|
|
char buf[],
|
|
|
|
size_t buf_len)
|
|
|
|
{
|
|
|
|
strncpy(buf, "utpasspassphrase", buf_len);
|
2025-02-03 17:48:30 +01:00
|
|
|
return true;
|
2025-02-03 21:46:21 +01:00
|
|
|
}
|
2025-02-03 17:48:30 +01:00
|
|
|
};
|
2025-01-29 16:42:37 +01:00
|
|
|
#endif
|