hynek / pem

PEM file parsing in Python.
https://pem.readthedocs.io/
MIT License
159 stars 37 forks source link

pem.parse ignores PKCS 8 keys #14

Closed ldanielburr closed 8 years ago

ldanielburr commented 9 years ago

Files which contain keys in PKCS 8 format, e.g., "BEGIN PRIVATE KEY" are not found by pem.parse. It appears that pem.parse only looks for PKCS 1 format, e.g., "BEGIN RSA PRIVATE KEY".

hynek commented 8 years ago

What should the resulting class be? Just pem.Key or am I missing something?

ldanielburr commented 8 years ago

@hynek - In my case the key is still a RSA private key, but I don't see anything in the pem package itself that cares whether the resulting class is pem.Key or pem.RSAPrivateKey, so probably changing the mapping from "RSA PRIVATE KEY": RSAPrivateKey to "PRIVATE KEY": Key would work.

hynek commented 8 years ago

Hope this does what you need.

ldanielburr commented 8 years ago

@hynek - Yes, that works nicely, thank you.