Commit ac397f08 authored by Daniel Stan's avatar Daniel Stan

[ssh_key] better quickly delete private temp key

parent 654a7f74
......@@ -716,20 +716,18 @@ def show_file(options):
key_file.write(texte.encode('utf-8'))
key_file.flush()
pub = subprocess.check_output(['ssh-keygen', '-y', '-f', key_file.name])
# Charge en mémoire
subprocess.check_call(['ssh-add', key_file.name])
# On attend
# On attend (hors tmpfile)
print(shown.encode('utf-8'))
raw_input()
with tempfile.NamedTemporaryFile(suffix='') as pub_file:
# On met la clé publique en fichier pour suppression
pub_file.write(pub)
pub_file.flush()
# On met la clé publique en fichier puis on supprime
key_file.seek(0)
key_file.write(pub)
key_file.flush()
subprocess.check_call(['ssh-add', '-d', key_file.name])
subprocess.check_call(['ssh-add', '-d', pub_file.name])
else:
# Le binaire à utiliser
showbin = "cat" if is_hidden else "less"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment