security: be more liberal in what kind of PEM files are accepted

PEM decoding can lead to different kind of objects whose interfaces to
get the public or private key may differ. Try to accommodate for common
cases.
superflous str