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.
Merge pull request #1 from vincentbernat/fix/flexible-certs

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