1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Add update server keygen tool

This commit is contained in:
tux3 2015-12-09 00:05:43 +01:00
parent e30fb4d919
commit e6083e4f5b
No known key found for this signature in database
GPG Key ID: 7E086DD661263264
2 changed files with 48 additions and 0 deletions

View File

@ -0,0 +1,35 @@
#include <sodium.h>
#include <QCoreApplication>
#include <QByteArray>
#include <QFile>
#include <QDebug>
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;
}

View File

@ -0,0 +1,13 @@
QT += core
QT -= gui
TARGET = qtox-updater-genkeys
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
LIBS += -lsodium