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

[dnssec] key API: add key availability checks

parent 291f3a05
Branches
Tags
1 merge request!332libdnssec
......@@ -180,6 +180,16 @@ int dnssec_key_get_id(const dnssec_key_t *key, dnssec_key_id_t id)
return DNSSEC_EOK;
}
bool dnssec_key_can_sign(const dnssec_key_t *key)
{
return key && key->private_key;
}
bool dnssec_key_can_verify(const dnssec_key_t *key)
{
return key && key->public_key;
}
int dnssec_key_from_params(dnssec_key_t *key, uint16_t flags, uint8_t protocol,
uint8_t algorithm, const dnssec_binary_t *public_key)
{
......
#pragma once
#include <gnutls/abstract.h>
#include <stdbool.h>
#include <stdint.h>
#include "binary.h"
#include "shared.h"
......@@ -57,6 +59,9 @@ uint8_t dnssec_key_get_protocol(const dnssec_key_t *key);
uint8_t dnssec_key_get_algorithm(const dnssec_key_t *key);
int dnssec_key_get_pubkey(const dnssec_key_t *key, dnssec_binary_t *pubkey);
bool dnssec_key_can_sign(const dnssec_key_t *key);
bool dnssec_key_can_verify(const dnssec_key_t *key);
// TODO: PKCS 8
// TODO: PKCS 11
......
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