Support key import in PEM format

Currently we only support importing keys in ASN.1 DER format. It would be more convenient to (also) support PEM, as that is widely used.