Skip to content
Snippets Groups Projects
Commit e6127b4f authored by Jan Včelák's avatar Jan Včelák :rocket:
Browse files

[dnssec] key id conversion, use new API

parent 43f33e35
Branches
Tags
1 merge request!332libdnssec
......@@ -3,28 +3,21 @@
#include <stdbool.h>
#include <string.h>
#include "key.h"
#include "binary.h"
#include "error.h"
#include "hex.h"
#include "key.h"
#include "keytag.h"
#include "wire.h"
static const char BIN_TO_HEX[] = { '0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
char *dnssec_key_id_to_string(const dnssec_key_id_t key_id)
char *dnssec_key_id_to_string(const dnssec_key_id_t id)
{
char *str = malloc(DNSSEC_KEY_ID_STRING_SIZE + 1);
if (!str) {
return NULL;
}
for (int i = 0; i < DNSSEC_KEY_ID_SIZE; i++) {
str[2*i] = BIN_TO_HEX[key_id[i] >> 4];
str[2*i+1] = BIN_TO_HEX[key_id[i] & 0x0f];
}
str[DNSSEC_KEY_ID_STRING_SIZE] = '\0';
const dnssec_binary_t binary = {
.data = (uint8_t *)id,
.size = DNSSEC_KEY_ID_SIZE
};
return str;
return hex_to_string(&binary);
}
static bool key_is_valid(const dnssec_key_t *key)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment