Skip to content
Snippets Groups Projects
Commit 0ee8f62b authored by Roman Khlopkov's avatar Roman Khlopkov 🔜
Browse files

[*] Cert metadata debugged

parent b7451a83
No related branches found
No related tags found
1 merge request!129features-3584
Subproject commit ca871a2bf1a314d0672cd11a0d8e6e3e3eec3d62 Subproject commit f68669962a4f63b020f5d3cef47b02202071cea1
Subproject commit 386787b6ad82aa9bdf8dc75b09ffd1175dd5d380 Subproject commit 1307c3fb4e2ff23ccde8e38d85ef6274a9315016
...@@ -98,6 +98,9 @@ ...@@ -98,6 +98,9 @@
#include "cellframe_node.h" #include "cellframe_node.h"
#endif #endif
#undef log_it
#define log_it(_log_level, string, ...) printf(string, ##__VA_ARGS__)
static int s_init( int argc, const char * argv[] ); static int s_init( int argc, const char * argv[] );
static void s_help( ); static void s_help( );
...@@ -182,7 +185,7 @@ int main(int argc, const char **argv) ...@@ -182,7 +185,7 @@ int main(int argc, const char **argv)
if ( l_data_file ) {} if ( l_data_file ) {}
} }
else { else {
log_it( L_ERROR, "Cert index %d can't be found in wallet with %u certs inside" log_it( L_ERROR, "Cert index %d can't be found in wallet with %lu certs inside"
,l_cert_index,l_wallet_certs_number ); ,l_cert_index,l_wallet_certs_number );
s_help(); s_help();
exit( -3002 ); exit( -3002 );
...@@ -325,12 +328,12 @@ int main(int argc, const char **argv) ...@@ -325,12 +328,12 @@ int main(int argc, const char **argv)
exit(-500); exit(-500);
} }
DAP_DELETE(l_cert_path); DAP_DELETE(l_cert_path);
} else if (strcmp(argv[2], "add_meta") == 0) { } else if (strcmp(argv[2], "add_metadata") == 0) {
if (argc >= 5) { if (argc >= 5) {
const char *l_cert_name = argv[3]; const char *l_cert_name = argv[3];
dap_cert_t *l_cert = dap_cert_add_file(l_cert_name, s_system_ca_dir); dap_cert_t *l_cert = dap_cert_add_file(l_cert_name, s_system_ca_dir);
if ( l_cert ) { if ( l_cert ) {
char **l_params = dap_strsplit(argv[3], ":", 4); char **l_params = dap_strsplit(argv[4], ":", 4);
dap_cert_metadata_type_t l_type = (dap_cert_metadata_type_t)atoi(l_params[1]); dap_cert_metadata_type_t l_type = (dap_cert_metadata_type_t)atoi(l_params[1]);
if (l_type == DAP_CERT_META_STRING || l_type == DAP_CERT_META_SIGN || l_type == DAP_CERT_META_CUSTOM) { if (l_type == DAP_CERT_META_STRING || l_type == DAP_CERT_META_SIGN || l_type == DAP_CERT_META_CUSTOM) {
dap_cert_add_meta(l_cert, l_params[0], l_type, (void *)l_params[3], strtoul(l_params[2], NULL, 10)); dap_cert_add_meta(l_cert, l_params[0], l_type, (void *)l_params[3], strtoul(l_params[2], NULL, 10));
...@@ -491,4 +494,7 @@ static void s_help() ...@@ -491,4 +494,7 @@ static void s_help()
printf(" * Export only public key from <cert name> and stores it \n"); printf(" * Export only public key from <cert name> and stores it \n");
printf("\t%s cert create_cert_pkey <cert name> <new cert name>\n\n",dap_get_appname()); printf("\t%s cert create_cert_pkey <cert name> <new cert name>\n\n",dap_get_appname());
printf(" * Add metadata item to <cert name>\n");
printf("\t%s cert add_metadata <cert name> <key:type:length:value>\n\n",dap_get_appname());
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment