-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add from_pem_private_key
/from_pem_public_key
methods
#109
Add from_pem_private_key
/from_pem_public_key
methods
#109
Conversation
pycose/keys/cosekey.py
Outdated
:return: An initialized COSE Key object. | ||
""" | ||
|
||
for key_type in cls._key_types.values(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Iterating over _key_types
is not wrong, but I find it a bit weird, especially considering that _key_types
actually have three entries per key-type. On the other hand I'm not sure I can think of a much cleaner solution other than having just a list of key types? Or a separate map from cryptography types to pycose types. None of these are particularly elegant either, so maybe it's fine to keep this as is.
We also discussed offline whether accepting objects from the |
from_cryptography_key
methodfrom_pem_private_key
/from_pem_public_key
methods
I've switched over to accepting PEM as key format as that is more universal and avoids forcing a specific crypto library. |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
1 similar comment
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Co-authored-by: Paul Liétar <lietarp@gmail.com>
38313d8
to
b9b8f22
Compare
Quality Gate passedKudos, no new issues were introduced! 0 New issues |
Addresses one half of #44.
Note on tests: The existing tests are a bit inconsistent between key types and I didn't want to change that in this PR which is why the new tests keep the existing style within each test file but may look a bit odd as a set.