libs: vendor qca (Qt Cryptographic Architecture, Qt6) for kf6-kwallet ksecretd
redbear-ci / check (push) Has been cancelled
redbear-ci / check (push) Has been cancelled
kf6-kwallet's ksecretd daemon (the org.freedesktop.secrets Secret Service provider) requires Qca-qt6 2.3.1. Vendor QCA 2.3.10 under the full-fork model and build the gcrypt provider plugin (backed by the vendored libgcrypt) so QCA has a working SymmetricCipher/Hash/PBKDF2 backend on Redox. External-toolkit providers (ossl/nss/botan/gnupg/pkcs11/cyrus-sasl) are disabled — those libraries are not part of the Redox userland; logger + softstore (pure-Qt) are kept. Source edit: the top-level Qt6 find_package required the Test component unconditionally; gate it on BUILD_TESTS so a tools/tests-off build configures without Qt6Test. Install via DESTDIR since QCA anchors its install dirs to the absolute Qt prefix (/usr), which ignores cmake --install --prefix. Build libgpg-error + libgcrypt with --with-pic so their static archives can be linked into the qca-gcrypt shared plugin. Add qca to kf6-kwallet deps.
This commit is contained in:
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
Copyright (C) 2007 Justin Karneges <justin@affinix.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
// QtCrypto has the declarations for all of QCA
|
||||
#include <QtCrypto>
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QFile>
|
||||
#include <QTimer>
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
#ifdef QT_STATICPLUGIN
|
||||
#include "import_plugins.h"
|
||||
#endif
|
||||
|
||||
class PassphraseHandler : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QCA::EventHandler handler;
|
||||
|
||||
PassphraseHandler(QObject *parent = nullptr)
|
||||
: QObject(parent)
|
||||
{
|
||||
connect(&handler, &QCA::EventHandler::eventReady, this, &PassphraseHandler::eh_eventReady);
|
||||
handler.start();
|
||||
}
|
||||
|
||||
private Q_SLOTS:
|
||||
void eh_eventReady(int id, const QCA::Event &event)
|
||||
{
|
||||
if (event.type() == QCA::Event::Password) {
|
||||
QCA::SecureArray pass;
|
||||
QCA::ConsolePrompt prompt;
|
||||
prompt.getHidden(QStringLiteral("Passphrase"));
|
||||
prompt.waitForFinished();
|
||||
pass = prompt.result();
|
||||
handler.submitPassword(id, pass);
|
||||
} else
|
||||
handler.reject(id);
|
||||
}
|
||||
};
|
||||
|
||||
class App : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QCA::KeyLoader keyLoader;
|
||||
QString str;
|
||||
|
||||
App()
|
||||
{
|
||||
connect(&keyLoader, &QCA::KeyLoader::finished, this, &App::kl_finished);
|
||||
}
|
||||
|
||||
public Q_SLOTS:
|
||||
void start()
|
||||
{
|
||||
keyLoader.loadPrivateKeyFromPEMFile(str);
|
||||
}
|
||||
|
||||
Q_SIGNALS:
|
||||
void quit();
|
||||
|
||||
private Q_SLOTS:
|
||||
void kl_finished()
|
||||
{
|
||||
if (keyLoader.convertResult() == QCA::ConvertGood) {
|
||||
QCA::PrivateKey key = keyLoader.privateKey();
|
||||
printf("Loaded successfully. Bits: %d\n", key.bitSize());
|
||||
} else
|
||||
printf("Unable to load.\n");
|
||||
|
||||
emit quit();
|
||||
}
|
||||
};
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
QCA::Initializer init;
|
||||
QCoreApplication qapp(argc, argv);
|
||||
|
||||
if (argc < 2) {
|
||||
printf("usage: keyloader [privatekey.pem]\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
PassphraseHandler passphraseHandler;
|
||||
App app;
|
||||
app.str = QFile::decodeName(argv[1]);
|
||||
QObject::connect(&app, &App::quit, &qapp, QCoreApplication::quit);
|
||||
QTimer::singleShot(0, &app, &App::start);
|
||||
qapp.exec();
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include "keyloader.moc"
|
||||
Reference in New Issue
Block a user