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

[dnssec] tests: compare key ids in binary form

parent ef6a5c2e
Branches
Tags
1 merge request!332libdnssec
......@@ -34,10 +34,9 @@ static void check_key(const char *name, const key_parameters_t *params)
dnssec_key_id_t key_id = { 0 };
r = dnssec_key_get_id(key, key_id);
char *key_id_str = dnssec_key_id_to_string(key_id);
ok(r == DNSSEC_EOK && strcmp(key_id_str, params->id) == 0,
ok(r == DNSSEC_EOK &&
memcmp(key_id, params->key_id.data, params->key_id.size) == 0,
"%s: dnssec_key_get_id()", name);
free(key_id_str);
ok(dnssec_key_get_keytag(key) == params->keytag,
"%s: dnssec_key_get_keytag()", name);
......
......@@ -13,7 +13,7 @@ typedef struct key_parameters {
dnssec_binary_t rdata;
// Hashes
char *id;
dnssec_binary_t key_id;
uint16_t keytag;
// Key information
......@@ -58,7 +58,10 @@ static const key_parameters_t SAMPLE_RSA_KEY = {
0x03, 0x01, 0x00, 0x01, 0xad, 0xa0, 0x24, 0xcf, 0x45, 0x7b,
0xc3, 0x6c, 0x9b, 0x91, 0x71, 0xc6, 0x3f, 0x8e, 0xd3, 0x8d,
}},
.id = "bbab201968d2f46aae88c6c8c9687e6900122883",
.key_id = { .size = 20, .data = (uint8_t []) {
0xbb, 0xab, 0x20, 0x19, 0x68, 0xd2, 0xf4, 0x6a, 0xae, 0x88,
0xc6, 0xc8, 0xc9, 0x68, 0x7e, 0x69, 0x00, 0x12, 0x28, 0x83,
}},
.keytag = 726,
.bit_size = 128,
.privkey_params = {
......@@ -155,7 +158,10 @@ static const key_parameters_t SAMPLE_DSA_KEY = {
0x3f, 0xc8, 0x26,
}},
.keytag = 1203,
.id = "141b2d54837494735b53795bf0c1579bd9e12754",
.key_id = { .size = 20, .data = (uint8_t []) {
0x14, 0x1b, 0x2d, 0x54, 0x83, 0x74, 0x94, 0x73, 0x5b, 0x53,
0x79, 0x5b, 0xf0, 0xc1, 0x57, 0x9b, 0xd9, 0xe1, 0x27, 0x54,
}},
.bit_size = 512,
.privkey_params = {
{ "prime", { .size = 64, .data = (uint8_t []) {
......@@ -233,7 +239,10 @@ static const key_parameters_t SAMPLE_ECDSA_KEY = {
0x66, 0xcb, 0x97, 0xcc,
}},
.keytag = 5345,
.id = "47fd10011e76cc6741af586041eae5519465fc8d",
.key_id = { .size = 20, .data = (uint8_t []) {
0x47, 0xfd, 0x10, 0x01, 0x1e, 0x76, 0xcc, 0x67, 0x41, 0xaf,
0x58, 0x60, 0x41, 0xea, 0xe5, 0x51, 0x94, 0x65, 0xfc, 0x8d,
}},
.bit_size = 256,
.privkey_params = {
{ "private_key", { .size = 32, .data = (uint8_t []) {
......
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