Solves curl-proxy issue and adds support for encrypted private keys

see commit notes, hope that helps