From: Klas Lindfors Date: Fri, 7 Jun 2013 11:22:09 +0000 (+0200) Subject: set protection in the exported json if the meta-property is set X-Git-Tag: v1.14.0~7 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5cdececc92ad7f2c163a28a1da779d7b2d833a9d;p=yubikey-personalization set protection in the exported json if the meta-property is set --- diff --git a/ykpers-json.c b/ykpers-json.c index 9e683c9..c64e8d9 100644 --- a/ykpers-json.c +++ b/ykpers-json.c @@ -46,6 +46,8 @@ int _ykp_json_export_cfg(const YKP_CONFIG *cfg, char *json, size_t len) { int mode = MODE_OTP_YUBICO; struct map_st *p; json_object *target_config = NULL; + json_object *prot_obj = NULL; + int protection = ykp_get_acccode_type(cfg); if((ycfg.tktFlags & TKTFLAG_OATH_HOTP) == TKTFLAG_OATH_HOTP){ if((ycfg.cfgFlags & CFGFLAG_CHAL_HMAC) == CFGFLAG_CHAL_HMAC) { @@ -77,6 +79,17 @@ int _ykp_json_export_cfg(const YKP_CONFIG *cfg, char *json, size_t len) { json_object_object_add(yprod_json, "targetConfig", target_config); } + if(protection == YKP_ACCCODE_NONE) { + prot_obj = json_object_new_string("none"); + } else if(protection == YKP_ACCCODE_RANDOM) { + prot_obj = json_object_new_string("random"); + } else if(protection == YKP_ACCCODE_SERIAL) { + prot_obj = json_object_new_string("id"); + } + if(prot_obj) { + json_object_object_add(yprod_json, "protection", prot_obj); + } + json_object_object_add(jobj, "yubiProdConfig", yprod_json); json_object_object_add(yprod_json, "options", options_json);