blob: 0f599d5be12f2640e56d7b81eb6ab80e2dabd83b [file] [log] [blame]
Jeff Thompson5cae5e52013-07-10 19:41:20 -07001/**
2 * @author: Jeff Thompson
3 * See COPYING for copyright and distribution information.
4 */
5
6#ifndef NDN_KEY_H
Jeff Thompson2d27e2f2013-08-09 12:55:00 -07007#define NDN_KEY_H
Jeff Thompson5cae5e52013-07-10 19:41:20 -07008
Jeff Thompson2d27e2f2013-08-09 12:55:00 -07009#ifdef __cplusplus
Jeff Thompson5cae5e52013-07-10 19:41:20 -070010extern "C" {
11#endif
12
13typedef enum {
14 ndn_KeyLocatorType_KEY = 1,
15 ndn_KeyLocatorType_CERTIFICATE = 2,
16 ndn_KeyLocatorType_KEYNAME = 3
17} ndn_KeyLocatorType;
18
19struct ndn_KeyLocator {
Jeff Thompsonfdc8dc92013-07-11 11:00:44 -070020 ndn_KeyLocatorType type; /**< -1 for none */
Jeff Thompson5cae5e52013-07-10 19:41:20 -070021 unsigned char *keyOrCertificate; /**< if type is ndn_KeyLocatorType_KEY, pointer to the pre-allocated buffer for the key value.
22 if type is ndn_KeyLocatorType_CERTIFICATE, pointer to the pre-allocated buffer for the cetrificate value. */
23 unsigned int keyOrCertificateLength;
24 // TODO: Implement keyName.
25};
26
27static inline void ndn_KeyLocator_init(struct ndn_KeyLocator *self) {
28 self->type = (ndn_KeyLocatorType)-1;
29 self->keyOrCertificate = 0;
30 self->keyOrCertificateLength = 0;
31 // TODO: Implement keyName.
32}
33
Jeff Thompson2d27e2f2013-08-09 12:55:00 -070034#ifdef __cplusplus
Jeff Thompson5cae5e52013-07-10 19:41:20 -070035}
36#endif
37
38#endif