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
Fix BitString initialization via namedValues #32
Conversation
nekolyanich
commented
Mar 28, 2017
class KeyUsage(BitString): namedValues = NamedValues( ('digitalSignature', 0), ('nonRepudiation', 1), ('keyEncipherment', 2), ('dataEncipherment', 3), ('keyAgreement', 4), ('keyCertSign', 5), ('cRLSign', 6), ('encipherOnly', 7), ('decipherOnly', 8), ) encode(KeyUsage('keyCertSign,cRLSign')) != encode(KeyUsage("'0000011'B")) ^^ || bit etingof#5 -------------+| bit etingof#6 --------------+
Codecov Report
@@ Coverage Diff @@
## master #32 +/- ##
==========================================
+ Coverage 82.03% 82.04% +0.01%
==========================================
Files 25 25
Lines 3590 3593 +3
==========================================
+ Hits 2945 2948 +3
Misses 645 645
Continue to review full report at Codecov.
|
Hey, thank you for your PR! Would you mind explaining why do you think this Here is what happens when I run your test case over current master:
|
Thank you for quick response. Right encoded value for KeyUsage('keyCertSign,cRLSign') is b'\x03\x02\x01\x06'. For example GeoTrusts Global CA (RootCA for google.com) has this permissions in KeyUsage. |
FYI pyasn1-v0.2.2 have valid behavior |
Ah, you are right! The ordering of the bits initializer is reversed compared to hex, for example. So I'm going to merge you fix now to make pyasn1readily operational. Later on I'll look into optimizing out Thank you! |
So I refactored the fix a little. Hope to release 0.2.4 by the end of this week. Thank you! |