tool to manipulate EDDSA key files More...
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_testing_lib.h"
#include <gcrypt.h>
Go to the source code of this file.
Macros | |
#define | KEY_STR_LEN sizeof(struct GNUNET_CRYPTO_EddsaPublicKey) * 8 / 5 + 1 |
Number of characters a Base32-encoded public key requires. More... | |
Functions | |
static void | create_keys (const char *fn, const char *prefix) |
Create a flat file with a large number of key pairs for testing. More... | |
static void | print_hex (const char *msg, const void *buf, size_t size) |
static void | print_examples_ecdh (void) |
static void | print_examples (void) |
Print some random example operations to stdout. More... | |
static void | print_key (const char *filename) |
static void | run (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) |
Main function that will be run by the scheduler. More... | |
int | main (int argc, char *const *argv) |
Program to manipulate ECC key files. More... | |
Variables | |
static int | list_keys |
Flag for listing public key. More... | |
static unsigned int | list_keys_count |
Flag for listing public key. More... | |
static int | print_public_key |
Flag for printing public key. More... | |
static int | print_private_key |
Flag for printing private key. More... | |
static int | print_public_key_hex |
Flag for printing public key in hex. More... | |
static int | print_examples_flag |
Flag for printing the output of random example operations. More... | |
static unsigned int | make_keys |
Option set to create a bunch of keys at once. More... | |
tool to manipulate EDDSA key files
Definition in file gnunet-ecc.c.
#define KEY_STR_LEN sizeof(struct GNUNET_CRYPTO_EddsaPublicKey) * 8 / 5 + 1 |
Number of characters a Base32-encoded public key requires.
Definition at line 35 of file gnunet-ecc.c.
|
static |
Create a flat file with a large number of key pairs for testing.
fn | File name to store the keys. |
prefix | Desired prefix for the public keys, NULL if any key is OK. |
Documentation by example: vanity = "A" len = 1 n = 5/8 = 0 (bytes) rest = 5%8 = 5 (bits) mask = ~(2**(8 - 5) - 1) = ~(2**3 - 1) = ~(8 - 1) = ~b111 = b11111000
Definition at line 80 of file gnunet-ecc.c.
References _, removetrailingwhitespace::f, GNUNET_assert, GNUNET_CRYPTO_eddsa_key_create(), GNUNET_CRYPTO_eddsa_key_get_public(), GNUNET_CRYPTO_eddsa_public_key_from_string(), GNUNET_CRYPTO_eddsa_public_key_to_string(), GNUNET_free, GNUNET_OK, GNUNET_strlcpy(), consensus-simulation::int, KEY_STR_LEN, make_keys, pk, and prefix.
Referenced by run().
|
static |
Definition at line 193 of file gnunet-ecc.c.
Referenced by print_examples_ecdh(), and run().
|
static |
Definition at line 205 of file gnunet-ecc.c.
References GNUNET_assert, GNUNET_CRYPTO_ecc_ecdh(), GNUNET_CRYPTO_ecdhe_key_create(), GNUNET_CRYPTO_ecdhe_key_get_public(), GNUNET_OK, GNUNET_STRINGS_data_to_string(), and print_hex().
Referenced by print_examples().
|
static |
Print some random example operations to stdout.
Definition at line 281 of file gnunet-ecc.c.
References print_examples_ecdh().
Referenced by run().
|
static |
Definition at line 290 of file gnunet-ecc.c.
References _, GNUNET_DISK_FileHandle::fd, filename, fs, GNUNET_CRYPTO_eddsa_key_get_public(), GNUNET_CRYPTO_eddsa_public_key_to_string(), GNUNET_DISK_file_close(), GNUNET_DISK_file_open(), GNUNET_DISK_file_read(), GNUNET_DISK_file_size(), GNUNET_DISK_file_test(), GNUNET_DISK_OPEN_READ, GNUNET_DISK_PERM_NONE, GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_log_strerror_file, GNUNET_malloc, GNUNET_memcpy, GNUNET_OK, GNUNET_YES, list_keys_count, and GNUNET_PeerIdentity::public_key.
Referenced by run().
|
static |
Main function that will be run by the scheduler.
cls | closure, NULL |
args | remaining command-line arguments |
cfgfile | name of the configuration file used (for saving, can be NULL!) |
cfg | configuration |
Definition at line 378 of file gnunet-ecc.c.
References _, consensus-simulation::args, cfg, create_keys(), GNUNET_CRYPTO_eddsa_key_get_public(), GNUNET_CRYPTO_eddsa_private_key_to_string(), GNUNET_CRYPTO_eddsa_public_key_to_string(), GNUNET_DISK_file_close(), GNUNET_DISK_file_open(), GNUNET_DISK_file_read(), GNUNET_DISK_OPEN_READ, GNUNET_DISK_PERM_NONE, GNUNET_free, list_keys, make_keys, pk, print_examples(), print_examples_flag, print_hex(), print_key(), print_private_key, print_public_key, print_public_key_hex, and pub.
Referenced by main().
int main | ( | int | argc, |
char *const * | argv | ||
) |
Program to manipulate ECC key files.
argc | number of arguments from the command line |
argv | command line arguments |
Definition at line 452 of file gnunet-ecc.c.
References gettext_noop, GNUNET_GETOPT_OPTION_END, GNUNET_GETOPT_option_flag(), GNUNET_GETOPT_option_uint(), GNUNET_OK, GNUNET_OS_project_data_gnunet(), GNUNET_PROGRAM_run(), list_keys, list_keys_count, make_keys, options, print_examples_flag, print_private_key, print_public_key, print_public_key_hex, ret, and run().
|
static |
Flag for listing public key.
Definition at line 40 of file gnunet-ecc.c.
|
static |
Flag for listing public key.
Definition at line 45 of file gnunet-ecc.c.
Referenced by main(), and print_key().
|
static |
Flag for printing public key.
Definition at line 50 of file gnunet-ecc.c.
|
static |
Flag for printing private key.
Definition at line 55 of file gnunet-ecc.c.
|
static |
Flag for printing public key in hex.
Definition at line 60 of file gnunet-ecc.c.
|
static |
Flag for printing the output of random example operations.
Definition at line 65 of file gnunet-ecc.c.
|
static |
Option set to create a bunch of keys at once.
Definition at line 70 of file gnunet-ecc.c.
Referenced by create_keys(), main(), and run().