From 9667cee284ca7c3557b0de4e4bb6113af99377e8 Mon Sep 17 00:00:00 2001 From: "levitte@gmail.com" Date: Wed, 26 Aug 2009 13:35:14 +0000 Subject: [PATCH] Make sure the 'fixed' prefix is in modhex by default, the rest in hex. git-svn-id: https://yubikey-personalization.googlecode.com/svn/trunk@154 b62f149e-849f-11dd-9899-c7ba65f7c4c7 --- ykpers.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) 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); -- 2.39.5