Squashed 'external/toxcore/c-toxcore/' content from commit 67badf69
git-subtree-dir: external/toxcore/c-toxcore git-subtree-split: 67badf69416a74e74f6d7eb51dd96f37282b8455
This commit is contained in:
28
other/fun/create_bootstrap_keys.c
Normal file
28
other/fun/create_bootstrap_keys.c
Normal file
@ -0,0 +1,28 @@
|
||||
/* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*
|
||||
* Creates bootstrap keys data for a given secret key, if provided, or a random key otherwise.
|
||||
* The data is written to stderr, human-readable key info is written to stdout.
|
||||
*
|
||||
* Build: gcc -o create_bootstrap_keys create_bootstrap_key.c -lsodium -std=c99
|
||||
*
|
||||
* Usage: ./create_bootstrap_key [secret-key] 2>data
|
||||
*/
|
||||
#include <stdio.h>
|
||||
|
||||
#include "create_common.h"
|
||||
|
||||
int main(const int argc, const char *const argv[])
|
||||
{
|
||||
init_sodium();
|
||||
|
||||
unsigned char public_key[crypto_box_PUBLICKEYBYTES];
|
||||
unsigned char secret_key[crypto_box_SECRETKEYBYTES];
|
||||
handle_args(argc, argv, "Creates bootstrap keys data", public_key, secret_key);
|
||||
|
||||
print_keys(public_key, secret_key);
|
||||
|
||||
fwrite(public_key, sizeof(public_key), 1, stderr);
|
||||
fwrite(secret_key, sizeof(secret_key), 1, stderr);
|
||||
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user