diff --git a/tools/update-server/qtox-updater-genkeys/main.cpp b/tools/update-server/qtox-updater-genkeys/main.cpp new file mode 100644 index 000000000..c17c486ae --- /dev/null +++ b/tools/update-server/qtox-updater-genkeys/main.cpp @@ -0,0 +1,35 @@ +#include +#include +#include +#include +#include + +int main(int argc, char *argv[]) +{ + QCoreApplication a(argc, argv); + (void) a; + + QByteArray skey(crypto_box_SECRETKEYBYTES, 0); + QFile skeyFile("qtox-updater-skey"); + if (!skeyFile.open(QIODevice::WriteOnly)) + { + qCritical() << "Failed to open qtox-updater-skey"; + return 1; + } + + QByteArray pkey(crypto_box_PUBLICKEYBYTES, 0); + QFile pkeyFile("qtox-updater-pkey"); + if (!pkeyFile.open(QIODevice::WriteOnly)) + { + qCritical() << "Failed to open qtox-updater-pkey"; + return 1; + } + + crypto_box_keypair((uint8_t*)pkey.data(), (uint8_t*)skey.data()); + skeyFile.write(skey); + pkeyFile.write(pkey); + + qDebug() << "Wrote new keys to disk"; + return 0; +} + diff --git a/tools/update-server/qtox-updater-genkeys/qtox-updater-genkeys.pro b/tools/update-server/qtox-updater-genkeys/qtox-updater-genkeys.pro new file mode 100644 index 000000000..ef4ef29e8 --- /dev/null +++ b/tools/update-server/qtox-updater-genkeys/qtox-updater-genkeys.pro @@ -0,0 +1,13 @@ +QT += core +QT -= gui + +TARGET = qtox-updater-genkeys +CONFIG += console +CONFIG -= app_bundle + +TEMPLATE = app + +SOURCES += main.cpp + + +LIBS += -lsodium