MatthiasValvekens / pyHanko

pyHanko: sign and stamp PDF files
MIT License
486 stars 71 forks source link

Make it easier to load keys and certificates from non-file contexts #164

Closed MatthiasValvekens closed 1 year ago

MatthiasValvekens commented 1 year ago

Description of the changes

Exposes the internals of the convenient certificate & key deserialisation functions to allow loading keys/certs from bytes objects. Fixes #160.

Caveats

Issue #160 originally specified allowing binary IO instead of just files. Replaced that with bytes for expediency (all these uses are really about small files anyhow).

Checklist

For new features

codecov-commenter commented 1 year ago

Codecov Report

Base: 98.72% // Head: 98.72% // Increases project coverage by +0.00% :tada:

Coverage data is based on head (ebc9f49) compared to base (768959d). Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #164 +/- ## ======================================= Coverage 98.72% 98.72% ======================================= Files 78 78 Lines 11939 11943 +4 ======================================= + Hits 11787 11791 +4 Misses 152 152 ``` | Flag | Coverage Δ | | |---|---|---| | unittests | `98.72% <100.00%> (+<0.01%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Matthias+Valvekens#carryforward-flags-in-the-pull-request-comment) to find out more. | [Impacted Files](https://codecov.io/gh/MatthiasValvekens/pyHanko/pull/164?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Matthias+Valvekens) | Coverage Δ | | |---|---|---| | [pyhanko/sign/general.py](https://codecov.io/gh/MatthiasValvekens/pyHanko/pull/164/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Matthias+Valvekens#diff-cHloYW5rby9zaWduL2dlbmVyYWwucHk=) | `100.00% <100.00%> (ø)` | | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Matthias+Valvekens). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Matthias+Valvekens)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.