35 #define TEST_RECORD_LABEL "test" 36 #define TEST_RECORD_A "1.2.3.4" 37 #define TEST_RRCOUNT 2 46 for (i = 0; i < buf_len; i++)
48 if ((0 != i) && (0 != fold) && (i % fold == 0))
50 printf (
"%02x", ((
unsigned char*) buf)[i]);
67 "FLAGS: %d\n", rd->
flags);
71 fprintf (stdout,
"\n");
107 fprintf (stdout,
"Zone private key (d, little-endian, with ztype prepended):\n");
109 fprintf (stdout,
"\n");
110 fprintf (stdout,
"Zone identifier (zid):\n");
116 fprintf (stdout,
"\n");
117 fprintf (stdout,
"Encoded zone identifier (zkl = zTLD):\n");
118 fprintf (stdout,
"%s\n", ztld);
119 fprintf (stdout,
"\n");
134 fprintf (stdout,
"Record #0\n");
137 rd[1].
data = &pkey_data;
142 fprintf (stdout,
"Record #1\n");
152 fprintf (stdout,
"RDATA:\n");
154 fprintf (stdout,
"\n");
162 - sizeof(struct GNUNET_TIME_AbsoluteNBO);
165 + sizeof(struct GNUNET_CRYPTO_EcdsaSignature);
166 size_t block_size = ecblock_size +
sizeof (uint32_t);
169 fprintf (stdout,
"BDATA:\n");
171 fprintf (stdout,
"\n");
172 fprintf (stdout,
"RRBLOCK:\n");
174 fprintf (stdout,
"\n");
201 "Generate test vectors for GNS",
GNUNET_NETWORK_STRUCT_END ssize_t GNUNET_GNSRECORD_records_get_size(unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
Calculate how many bytes we will need to serialize the given records.
enum GNUNET_GenericReturnValue GNUNET_PROGRAM_run(int argc, char *const *argv, const char *binaryName, const char *binaryHelp, const struct GNUNET_GETOPT_CommandLineOption *options, GNUNET_PROGRAM_Main task, void *task_cls)
Run a standard GNUnet command startup sequence (initialize loggers and configuration, parse options).
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
struct GNUNET_GNSRECORD_EcdsaBlock ecdsa_block
ssize_t GNUNET_GNSRECORD_records_serialize(unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd, size_t dest_size, char *dest)
Serialize the given records to the given destination buffer.
static size_t data_size
Number of bytes in data.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
ssize_t GNUNET_IDENTITY_key_get_length(const struct GNUNET_IDENTITY_PublicKey *key)
Get the compacted length of a GNUNET_IDENTITY_PublicKey.
static void print_record(const struct GNUNET_GNSRECORD_Data *rd)
A private key for an identity as per LSD0001.
size_t data_size
Number of bytes in data.
Definition of a command line option.
uint64_t abs_value_us
The actual value.
struct GNUNET_GNSRECORD_Block * GNUNET_GNSRECORD_block_create(const struct GNUNET_IDENTITY_PrivateKey *key, struct GNUNET_TIME_Absolute expire, const char *label, const struct GNUNET_GNSRECORD_Data *rd, unsigned int rd_count)
Sign name and records.
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_OPTION_END
header of what an ECC signature signs this must be followed by "size - 8" bytes of the actual signed ...
struct GNUNET_CRYPTO_EccSignaturePurpose purpose
Number of bytes signed; also specifies the number of bytes of encrypted data that follow...
struct GNUNET_CRYPTO_EcdsaPrivateKey ecdsa_key
An ECDSA identity key.
static void print_bytes(void *buf, size_t buf_len, int fold)
const void * data
Binary value stored in the DNS record.
#define GNUNET_GNSRECORD_TYPE_PKEY
Record type for GNS zone transfer ("PKEY").
uint64_t expiration_time
Expiration time for the DNS record.
enum GNUNET_GenericReturnValue GNUNET_IDENTITY_key_get_public(const struct GNUNET_IDENTITY_PrivateKey *privkey, struct GNUNET_IDENTITY_PublicKey *key)
Retrieves the public key representation of a private key.
This is a private record of this peer and it should thus not be handed out to other peers...
uint32_t size
How many bytes does this signature sign? (including this purpose header); in network byte order (!)...
#define TEST_RECORD_LABEL
int GNUNET_GNSRECORD_string_to_value(uint32_t type, const char *s, void **data, size_t *data_size)
Convert human-readable version of a 'value' of a record to the binary representation.
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get(void)
Get the current time.
static void run(void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg)
Main function that will be run.
uint32_t type
Type of public key.
An identity key as per LSD0001.
uint32_t record_type
Type of the GNS/DNS record.
void GNUNET_CRYPTO_ecdsa_key_create(struct GNUNET_CRYPTO_EcdsaPrivateKey *pk)
Create a new private key.
Public ECC key (always for Curve25519) encoded in a format suitable for network transmission and ECDS...
Time for absolute times used by GNUnet, in microseconds.
enum GNUNET_GNSRECORD_Flags flags
Flags for the record.
int GNUNET_log_setup(const char *comp, const char *loglevel, const char *logfile)
Setup logging.
uint32_t data
The data value.
int main(int argc, char *const *argv)
The main function of the test vector generation tool.
#define GNUNET_DNSPARSER_TYPE_A
#define GNUNET_malloc(size)
Wrapper around malloc.
char * GNUNET_STRINGS_data_to_string(const void *data, size_t size, char *out, size_t out_size)
Convert binary data to ASCII encoding using CrockfordBase32.