From: Richard Levitte Date: Wed, 26 Aug 2009 13:35:14 +0000 (+0000) Subject: Make sure the 'fixed' prefix is in modhex by default, the rest in hex. X-Git-Tag: yubikey-personalisation_1.3.5-1~4^2~91 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9d4b227d650e46b81b62c9565ec71e1f98edc1cc;p=yubikey-personalization.old Make sure the 'fixed' prefix is in modhex by default, the rest in hex. --- diff --git a/ykpers.c b/ykpers.c index ca0be7b..dd952b0 100644 --- a/ykpers.c +++ b/ykpers.c @@ -313,7 +313,9 @@ def_set_cfgflag(STRONG_PW2,vcheck_no_v1) def_set_cfgflag(MAN_UPDATE,vcheck_no_v1) -const char str_key_value_separator[] = ":"; +const char str_key_value_separator[] = ": "; +const char str_hex_prefix[] = "h:"; +const char str_modhex_prefix[] = "m:"; const char str_fixed[] = "fixed"; const char str_uid[] = "uid"; const char str_key[] = "key"; @@ -367,6 +369,9 @@ int ykp_write_config(const YKP_CONFIG *cfg, writer(str_key_value_separator, strlen(str_key_value_separator), userdata); + writer(str_modhex_prefix, + strlen(str_key_value_separator), + userdata); yubikey_modhex_encode(buffer, cfg->ykcore_config.fixed, cfg->ykcore_config.fixedSize); writer(buffer, strlen(buffer), userdata); writer("\n", 1, userdata); @@ -375,7 +380,10 @@ int ykp_write_config(const YKP_CONFIG *cfg, writer(str_key_value_separator, strlen(str_key_value_separator), userdata); - yubikey_modhex_encode(buffer, cfg->ykcore_config.uid, UID_SIZE); + writer(str_hex_prefix, + strlen(str_key_value_separator), + userdata); + yubikey_hex_encode(buffer, cfg->ykcore_config.uid, UID_SIZE); writer(buffer, strlen(buffer), userdata); writer("\n", 1, userdata); @@ -383,7 +391,10 @@ int ykp_write_config(const YKP_CONFIG *cfg, writer(str_key_value_separator, strlen(str_key_value_separator), userdata); - yubikey_modhex_encode(buffer, cfg->ykcore_config.key, KEY_SIZE); + writer(str_hex_prefix, + strlen(str_key_value_separator), + userdata); + yubikey_hex_encode(buffer, cfg->ykcore_config.key, KEY_SIZE); writer(buffer, strlen(buffer), userdata); writer("\n", 1, userdata); @@ -391,7 +402,10 @@ int ykp_write_config(const YKP_CONFIG *cfg, writer(str_key_value_separator, strlen(str_key_value_separator), userdata); - yubikey_modhex_encode(buffer, cfg->ykcore_config.accCode, ACC_CODE_SIZE); + writer(str_hex_prefix, + strlen(str_key_value_separator), + userdata); + yubikey_hex_encode(buffer, cfg->ykcore_config.accCode, ACC_CODE_SIZE); writer(buffer, strlen(buffer), userdata); writer("\n", 1, userdata);