hynek / pem

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

[fixes #33] Add support for PKCS8 encrypted private keys. #34

Closed adiroiban closed 5 years ago

adiroiban commented 5 years ago

Scope

See #33

This adds support for encrypted PKCS8 file

-----BEGIN ENCRYPTED PRIVATE KEY-----
MIIBvTBXBgkqhkiG9w0BBQ0wSjApBgkqhkiG9w0BBQwwHAQIyqwWErm7rlcCAggA
MAwGCCqGSIb3DQIJBQAwHQYJYIZIAWUDBAEqBBAkVu+KRbmcfWIGKzgnjjBMBIIB
YI3aRS0ebuzb1Tq26/HAq8pplPu+96dM1SnRNXwH0ijmP3fLBjEDH4hB/X9H8arT
xWSfKQ80+FKI07DsLQKmO+cuB12MAWPSoCNBRtLwGUiwYvlMcBp6XR4NQQ+YG/Nw
OgZ1InH2w7uSnDPdxV9dZculYWzJE82IohnFVZokO2nYSEfIqr1xVQZht6lfzpx2
aRje42fpYfgkEm13w4oJKIlekzA9M4CeYku7Q4l9GDSHRmoeypMSHPI8RFV9pxub
ME3AMXGcRioJ0Ic/cpmwqFaJbTVRPsqFVEsMCz1T/CQ4oLjPTWg+zkxfsPIyGj7L
K3yLZmTA6IxSu+wuO/bsbqiM3x718AW6U0FHXd4zk+llu3mUfhTiMYPvN/cedv/M
wsT85CHM6reIBopGMqeZD965tNEcWPGMEvXXnG71dxxgrfHFv7l/o8+moVRNIQCh
EArlaXgT3MlI1jb9HoNvVNg=
-----END ENCRYPTED PRIVATE KEY-----

Changes

I have updated the test with explicit tests for PKCS5 and PKCS8 encrypted and unecrypted formats. I left the previous KEY_PEM as it is to not touch the twisted tests.

As a drive by, I tried to update the documen

How to check

Thanks for the great documentation from CONTRIBUTING.rst.

I hope I have covered everything. Editing CHANGELOG was not clear.

Not sure why setup.cfg was updated by pre-commit I have not done anyting in terms of typing and used a simple 2.7 virtualen I guess that typing is required on Py2.7

adiroiban commented 5 years ago

@hynek thanks for this lib :)

this PR should be ready for review.

I think that we have a random Travis-CI failure not related to this branch https://travis-ci.org/hynek/pem/jobs/443131595

hynek commented 5 years ago

Not sure why setup.cfg was updated by pre-commit I have not done anyting in terms of typing and used a simple 2.7 virtualen I guess that typing is required on Py2.7

I suspect this was a problem with our pre-commit configuration. It should explicitly ask for 3.6 such that this doesn’t happen.


Merging for now, thanks!