diff options
author | Marcello Stanisci <marcello.stanisci@inria.fr> | 2017-07-04 19:32:44 +0200 |
---|---|---|
committer | Marcello Stanisci <marcello.stanisci@inria.fr> | 2017-07-04 19:33:23 +0200 |
commit | aef6d798c8982e93bc68c94b1c9c09b160672d54 (patch) | |
tree | b3954b6b38bb4105b1db42197efdf5d3ee936fdb /src | |
parent | 430c95c21b478703f3191327afa74253b9d79d48 (diff) | |
download | merchant-aef6d798c8982e93bc68c94b1c9c09b160672d54.tar.gz merchant-aef6d798c8982e93bc68c94b1c9c09b160672d54.tar.bz2 merchant-aef6d798c8982e93bc68c94b1c9c09b160672d54.zip |
testcase extracts merchant priv from config
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/test_merchant_api.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/lib/test_merchant_api.c b/src/lib/test_merchant_api.c index 3474efbd..78b9bb6d 100644 --- a/src/lib/test_merchant_api.c +++ b/src/lib/test_merchant_api.c @@ -717,6 +717,40 @@ struct InterpreterState */ static struct GNUNET_DISK_PipeHandle *sigpipe; +/** + * Return instance private key from config + * + * @param config configuration handle + * @param instance instance name + * @return pointer to private key, NULL on error + */ +struct GNUNET_CRYPTO_EddsaPrivateKey * +get_instance_priv (struct GNUNET_CONFIGURATION_Handle *config, + const char *instance) +{ + char *config_section; + char *filename; + struct GNUNET_CRYPTO_EddsaPrivateKey *ret; + + (void) GNUNET_asprintf (&config_section, + "merchant-instance-%s", + instance); + + if (GNUNET_OK != + GNUNET_CONFIGURATION_get_value_filename (config, + config_section, + "KEYFILE", + &filename)) + { + GNUNET_break (0); + return NULL; + } + if (NULL == + (ret = GNUNET_CRYPTO_eddsa_key_create_from_file (filename))) + GNUNET_break (0); + + return ret; +} /** * The testcase failed, return with an error code. |