# # # patch "cmd_key_cert.cc" # from [b387e85629c90f024be92027c867cabc74221afb] # to [021cf48c042e2d81a3d8211697e8adc3d7ab6a04] # # patch "keys.cc" # from [ec4af127472843e3211cf3aa1857ff7fb4f5eec7] # to [c57e3f6a336fcfcd4aec579147269a9ec1a0f279] # # patch "keys.hh" # from [d0e0528c82f6d621c14e3dfb2e140a34bdf98464] # to [b70145327a961277459565f4a510cba802fa75af] # ============================================================ --- cmd_key_cert.cc b387e85629c90f024be92027c867cabc74221afb +++ cmd_key_cert.cc 021cf48c042e2d81a3d8211697e8adc3d7ab6a04 @@ -131,7 +131,7 @@ CMD(ssh_agent_export, N_("key and cert") app.keys.get_key_pair(id, key); shared_ptr priv = get_private_key(app.lua, id, key.priv); utf8 new_phrase; - get_passphrase(app.lua, id, new_phrase, true, true, "enter new passphrase"); + get_passphrase(app.lua, id, new_phrase, true, true); Pipe p; p.start_msg(); if (new_phrase().length()) ============================================================ --- keys.cc ec4af127472843e3211cf3aa1857ff7fb4f5eec7 +++ keys.cc c57e3f6a336fcfcd4aec579147269a9ec1a0f279 @@ -80,7 +80,7 @@ get_passphrase(lua_hooks & lua, utf8 & phrase, bool confirm_phrase, bool force_from_user, - string prompt_beginning) + bool generating_key) { // we permit the user to relax security here, by caching a passphrase (if @@ -113,8 +113,12 @@ get_passphrase(lua_hooks & lua, memset(pass1, 0, constants::maxpasswd); memset(pass2, 0, constants::maxpasswd); ui.ensure_clean_line(); - read_password(prompt_beginning + " for key ID [" + keyid() + "]: ", - pass1, constants::maxpasswd); + string prompt1 = ((confirm_phrase && !generating_key + ? F("enter new passphrase for key ID [%s]: ") + : F("enter passphrase for key ID [%s]: ")) + % keyid()).str(); + + read_password(prompt1, pass1, constants::maxpasswd); if (confirm_phrase) { ui.ensure_clean_line(); @@ -163,7 +167,7 @@ generate_key_pair(lua_hooks & lua, keypair & kp_out) { utf8 phrase; - get_passphrase(lua, id, phrase, true, true); + get_passphrase(lua, id, phrase, true, true, true); generate_key_pair(kp_out, phrase); } @@ -345,7 +349,7 @@ change_key_passphrase(lua_hooks & lua, shared_ptr priv = get_private_key(lua, id, encoded_key, true); utf8 new_phrase; - get_passphrase(lua, id, new_phrase, true, true, "enter new passphrase"); + get_passphrase(lua, id, new_phrase, true, true); Pipe p; p.start_msg(); ============================================================ --- keys.hh d0e0528c82f6d621c14e3dfb2e140a34bdf98464 +++ keys.hh b70145327a961277459565f4a510cba802fa75af @@ -77,7 +77,7 @@ get_passphrase(lua_hooks & lua, utf8 & phrase, bool confirm_phrase = false, bool force_from_user = false, - std::string prompt_beginning = "enter passphrase"); + bool generating_key = false); shared_ptr get_private_key(lua_hooks & lua,