mirror of https://github.com/qTox/qTox.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
830 B
35 lines
830 B
#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; |
|
} |
|
|
|
|