Reimplement the SSH key management.

Cherry-picked from essex version.
Merge pull request #35 from alvarolopez/stable/folsom

Reimplement the SSH key management.