Jeff Thompson | 5cae5e5 | 2013-07-10 19:41:20 -0700 | [diff] [blame] | 1 | /** |
| 2 | * @author: Jeff Thompson |
| 3 | * See COPYING for copyright and distribution information. |
| 4 | */ |
| 5 | |
| 6 | #ifndef NDN_KEY_H |
Jeff Thompson | 2d27e2f | 2013-08-09 12:55:00 -0700 | [diff] [blame] | 7 | #define NDN_KEY_H |
Jeff Thompson | 5cae5e5 | 2013-07-10 19:41:20 -0700 | [diff] [blame] | 8 | |
Jeff Thompson | 2d27e2f | 2013-08-09 12:55:00 -0700 | [diff] [blame] | 9 | #ifdef __cplusplus |
Jeff Thompson | 5cae5e5 | 2013-07-10 19:41:20 -0700 | [diff] [blame] | 10 | extern "C" { |
| 11 | #endif |
| 12 | |
| 13 | typedef enum { |
| 14 | ndn_KeyLocatorType_KEY = 1, |
| 15 | ndn_KeyLocatorType_CERTIFICATE = 2, |
| 16 | ndn_KeyLocatorType_KEYNAME = 3 |
| 17 | } ndn_KeyLocatorType; |
| 18 | |
| 19 | struct ndn_KeyLocator { |
Jeff Thompson | fdc8dc9 | 2013-07-11 11:00:44 -0700 | [diff] [blame] | 20 | ndn_KeyLocatorType type; /**< -1 for none */ |
Jeff Thompson | 5cae5e5 | 2013-07-10 19:41:20 -0700 | [diff] [blame] | 21 | 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 | |
| 27 | static 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 Thompson | 2d27e2f | 2013-08-09 12:55:00 -0700 | [diff] [blame] | 34 | #ifdef __cplusplus |
Jeff Thompson | 5cae5e5 | 2013-07-10 19:41:20 -0700 | [diff] [blame] | 35 | } |
| 36 | #endif |
| 37 | |
| 38 | #endif |