Skip to content
Snippets Groups Projects
Commit 6b6a6b46 authored by Dmitriy Naidolinskiy's avatar Dmitriy Naidolinskiy Committed by Roman Khlopkov
Browse files

Feature 5173

parent 22279d81
No related branches found
No related tags found
2 merge requests!459Release 5.1,!275Feature 5173
Subproject commit 828a6b42ed4ec9f6cfdf33a01cf6c6bc573ed03b
Subproject commit 8cdb1a3cc280386ef982943ed14fe266c11aad57
Subproject commit 6a774f3a8f73ff8bf5c29d802728799f7a616c48
Subproject commit 37c95060177e9d6822756ed9667c24f240a0208a
......@@ -217,29 +217,26 @@ int main(int argc, const char **argv)
}*/
} // wallet
else if (strcmp (argv[1],"cert") == 0 ) {
if (argc == 3) {
if (strcmp (argv[2], "create_pkey_hash") == 0) {
dap_config_t *l_config = dap_config_open("network/private");
if (!l_config) {
log_it(L_ERROR, "Not found a private config - private.cfg");
exit(-111);
}
uint16_t ui_acl_list_len;
dap_cert_t *l_cert = NULL;
l_cert = dap_cert_find_by_name(dap_config_get_item_str(l_config, "general", "auth_cert"));
size_t st_size = sizeof(dap_hash_fast_t);
unsigned char *l_data = DAP_NEW_Z_SIZE(unsigned char, st_size + 1);
s_fill_hash_key_for_data(l_cert->enc_key, l_data);
for (int i = 0; i < st_size; i++) {
printf("%02x", l_data[i]);
}
printf("\n");
exit(0);
}
}
if ( argc >=3 ) {
if (argc >= 5) {
if (strcmp (argv[2], "pkey") == 0 && strcmp (argv[3], "show") == 0) {
dap_cert_t *l_cert = dap_cert_find_by_name(argv[4]);
if (!l_cert) {
printf("Not found cert: %s\n", argv[4]);
exit(-134);
}
size_t l_buf_len;
uint8_t *l_pub_enc_key = dap_enc_key_serealize_pub_key(l_cert->enc_key, &l_buf_len);
dap_hash_fast_t l_hash;
dap_hash_fast (l_pub_enc_key, l_buf_len, &l_hash);
char *l_hash_str = dap_chain_hash_fast_to_str_new(&l_hash);
printf("%s\n", l_hash_str);
exit(0);
}
}
if ( strcmp( argv[2],"dump") == 0 ){
if (argc>=4) {
const char * l_cert_name = argv[3];
......@@ -586,4 +583,6 @@ static void s_help()
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());
printf(" * Print hash of cert <cert name>\n");
printf("\t%s cert pkey show <cert name>\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