title: Use ssh key to encrypt and decrypt a password
body: <p>My python-script (Python 2.6, on Debian Linux) asks the user for a password, wich is then saved in the users home directory. </p>
  
  <p>Because i don't want to safe the password as plain text, i want to encrypt it somehow. So i thought that maybe i could use the (private) ssh-key of the user to encrypt and decrypt the password thats saved in the file, so that only one with access to the private ssh key can decrypt the saved password.</p>
  
  <p>Is it a good idea to use the private ssh key for this? How can i use the key to encrypt a string in python?</p>
  
  <p>(btw i don't want to use keyring and stuff like that)</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Okay i understand its a bad idea to use the users ssh key for stuff like that. 
  Instead i'm now just using base64 encoding, like described here: 
  <a href="https://stackoverflow.com/questions/875771/how-does-one-encode-and-decode-a-string-with-python-for-use-in-a-url">How does one encode and decode a string with Python for use in a URL?</a>
  of course its not save, when someone reads my python script. But its enough for me, not having to save the password as plain text.</p>