aboutsummaryrefslogtreecommitdiffstats
path: root/src/cryptography/x509/extensions.py
Commit message (Collapse)AuthorAgeFilesLines
* Removed deprecated behavior in AKI.from_issuer_subject_key_identifier (#5182)Alex Gaynor2020-04-051-15/+1
|
* Use dict literals. (#5080)Mads Jensen2019-12-021-1/+1
|
* Simplify implementing sequence methods (#4987)Alex Gaynor2019-09-101-94/+31
| | | | | | * Simplify implementing sequence methods * flake8
* Make DER reader into a context manager (#4957)Alex Gaynor2019-07-281-9/+9
| | | | | | | | * Make DER reader into a context manager * Added another test case * flake8
* Remove asn1crypto dependency (#4941)David Benjamin2019-07-281-3/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Remove non-test dependencies on asn1crypto. cryptography.io actually contains two OpenSSL bindings right now, the expected cffi one, and an optional one hidden in asn1crypto. asn1crypto contains a lot of things that cryptography.io doesn't use, including a BER parser and a hand-rolled and not constant-time EC implementation. Instead, check in a much small DER-only parser in cryptography/hazmat. A quick benchmark suggests this parser is also faster than asn1crypto: from __future__ import absolute_import, division, print_function import timeit print(timeit.timeit( "decode_dss_signature(sig)", setup=r""" from cryptography.hazmat.primitives.asymmetric.utils import decode_dss_signature sig=b"\x30\x2d\x02\x15\x00\xb5\xaf\x30\x78\x67\xfb\x8b\x54\x39\x00\x13\xcc\x67\x02\x0d\xdf\x1f\x2c\x0b\x81\x02\x14\x62\x0d\x3b\x22\xab\x50\x31\x44\x0c\x3e\x35\xea\xb6\xf4\x81\x29\x8f\x9e\x9f\x08" """, number=10000)) Python 2.7: asn1crypto: 0.25 _der.py: 0.098 Python 3.5: asn1crypto: 0.17 _der.py: 0.10 * Remove test dependencies on asn1crypto. The remaining use of asn1crypto was some sanity-checking of Certificates. Add a minimal X.509 parser to extract the relevant fields. * Add a read_single_element helper function. The outermost read is a little tedious. * Address flake8 warnings * Fix test for long-form vs short-form lengths. Testing a zero length trips both this check and the non-minimal long form check. Use a one-byte length to cover the missing branch. * Remove support for negative integers. These never come up in valid signatures. Note, however, this does change public API. * Update src/cryptography/hazmat/primitives/asymmetric/utils.py Co-Authored-By: Alex Gaynor <alex.gaynor@gmail.com> * Review comments * Avoid hardcoding the serialization of NULL in decode_asn1.py too.
* fix from_issuer_subject_key_identifier to take the right type (#4864)Paul Kehrer2019-05-041-1/+15
| | | | | | | | | | * fix from_issuer_subject_key_identifier to take the right type deprecate passing the old Extension wrapper object * don't use a try:except: * hilarious contortions to satisfy doc8
* fix != comparison in py2 (fixes #4821) (#4822)Mathias Ertl2019-03-251-0/+6
| | | | | | | | * fix != comparison in py2 (fixes #4821) * remove blank line b/c pep8 * move __ne__ next to __eq__ as per review request
* implement eq__, __hash__ and __repr__ for OCSPNoCheck and PrecertPoison (#4819)Mathias Ertl2019-03-251-0/+24
|
* Simplify string formatting (#4757)Alex Gaynor2019-02-201-16/+16
|
* deprecate encode_point and migrate all internal callers (#4720)Paul Kehrer2019-01-201-1/+4
|
* Add RFC 4514 Distinguished Name formatting for Name, RDN and NameAttribute ↵Marti Raudsepp2018-12-081-2/+2
| | | | (#4304)
* IssuingDistributionPoint support (parse only) (#4552)Paul Kehrer2018-11-301-0/+130
| | | | | | | | | | | | | | | | | | | | | | * IssuingDistributionPoint support h/t to Irina Renteria for the initial work here * python 2 unfortunately still exists * py2 repr * typo caught by flake8 * add docs * review feedback * reorder args, other fixes * use the alex name * add changelog
* Remove unnecessary use of six.binary_type (#4569)Jon Dufresne2018-11-111-1/+1
| | | | | All supported Pythons have type bytes. On Python 2, it is an alias of str, same as six.binary_type. Makes the code slightly more forward compatible and removes some indirection.
* Add eq/ne/hash to PrecertificateSignedCertificateTimestamps (#4534)Paul Kehrer2018-10-291-0/+15
| | | | | | | | | | | | | | * Add eq/ne/hash to PrecertificateSignedCertificateTimestamps This requires adding it to SignedCertificateTimestamps as well * slightly more consistent * right, these need to be conditional * compare by signature * don't use private API
* OCSP request extension parsing (#4464)Paul Kehrer2018-09-091-1/+29
| | | | | | | | | | * add OCSP request parsing support with OCSPNonce * add docs * reprs man * make extensions a cached property
* Fixes #4333 -- added support for precert poison extension (#4442)Alex Gaynor2018-08-311-0/+5
| | | | | | | | | | | | | | * Fixes #4333 -- added support for precert poison extension * Make work on all OpenSSL versions * fixed flake8 + docs * fix for older OpenSSLs * document this * spell
* Revert "don't allow GeneralNames to be an empty list (#4128)" (#4161)Alex Gaynor2018-03-201-3/+0
| | | | | This breaks the urllib3 tests, as well as several in-the-wild certs This reverts commit 388d1bd3e9cd953fcc948edbc152d5d140c87eb8.
* don't allow GeneralNames to be an empty list (#4128)Paul Kehrer2018-03-051-0/+3
| | | | | | * don't allow GeneralNames to be an empty list * flake8
* FreshestCRL extension support (#3937)Paul Kehrer2017-09-231-0/+41
| | | | | | | | | | * add freshest CRL support * add tests * add changelog * add tests for FreshestCRL generation
* support delta crl indicator extension (#3936)Paul Kehrer2017-09-221-0/+28
| | | This is an extension for CRLs
* implement __hash__ on DistributionPoint and CRLDistributionPoints (#3915)Paul Kehrer2017-09-131-0/+16
|
* add __hash__ to GeneralNames, SAN, IAN, and CertificateIssuer (#3916)Paul Kehrer2017-09-131-0/+12
|
* add __hash__ to PolicyConstraints and Extension (#3917)Paul Kehrer2017-09-131-0/+8
|
* implement __hash__ on KeyUsage and ExtendedKeyUsage (#3913)Paul Kehrer2017-09-131-0/+12
| | | | | | * implement __hash__ on KeyUsage and ExtendedKeyUsage * properly use private values and alter test to catch that bug
* implement __hash__ on CertificatePolicies and its child classes (#3914)Paul Kehrer2017-09-131-0/+17
|
* add aki hash (#3910)Paul Kehrer2017-09-131-0/+9
| | | | | | | | | | * Implement __hash__ on AuthorityKeyIdentifier * Adding dirname to fix build issue on AuthorityKeyIdentifier test * .authority_cert_issuer to str * use a tuple and not a str repr
* name constraints __hash__ (#3912)Paul Kehrer2017-09-131-0/+13
|
* AIA hashing (#3911)Paul Kehrer2017-09-131-0/+3
|
* [WIP] add support for the TLSFeature extension in x509 (#3899)Paul Kehrer2017-09-101-0/+56
| | | | | | | | | | | | | | | | | | * add support for the TLSFeature extension in x509 This extension is used for OCSP Must-Staple. * fix changelog link * pep8 * refactor to support the sequence properly and add status_request_v2 * update some language * add test vector, implement eq/ne/hash on TLSFeature * address review comments
* remove deprecated items (#3794)Paul Kehrer2017-07-201-4/+0
| | | | | | | | | | * remove deprecated items whirlpool, ripemd160, unsupportedextension, and the old interfaces * flake8 and remove a test generator we no longe use * make it clear we warned you about these things
* Refs #3461 -- parse SCTs from x.509 extension (#3480)Alex Gaynor2017-06-041-0/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Stub API for SCTs, feedback wanted * grr, flake8 * finish up the __init__ * Initial implementation and tests * write a test. it fails because computer * get the tests passing and fix some TODOs * changelog entry * This can go now * Put a skip in this test * grump * Removed unreachable code * moved changelog to the correct section * Use the deocrator for expressing requirements * This needs f for the right entry_type * coverage * syntax error * tests for coverage * better sct eq tests * docs * technically correct, the most useless kind of correct * typo and more details * bug * drop __eq__
* Don't raise an UnsupportedExtension for critical extensions. (#3550)Alex Gaynor2017-05-201-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | * Don't raise an UnsupportedExtension for critical extensions. Fixes #2903 Fixes #2901 Fixes #3325 * Don't link * Revert "Don't link" This reverts commit 4fe847f91d9dd45cdc28a4984c4e44aad62a5de6. * fix * Revert "Revert "Don't link"" This reverts commit 856031b5a1fbad04ac218fa94ebf37dcd402f3ed. * fix * Deprecate this * Better changelog entry
* Remove API deprecated in 1.6, clean up the legacy deprecations (#3468)Alex Gaynor2017-03-211-12/+2
| | | | | | * Remove API deprecated in 1.6, clean up the legacy deprecations * flake8, unused import
* replace pyasn1 with asn1crypto (#3361)Ofek Lev2017-02-081-21/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | * replace pyasn1 with asn1crypto * allow trailing bytes * fix x509 test * update CHANGELOG.rst * fix assert * make asn1crypto code more idiomatic * find tag * final clean-up * leave trailing byte logic unchanged * document dependency change * spelling * fix spelling
* Make DistributionPoint relative_name a set of NameAttribute (#3210)Fraser Tweedale2016-11-071-3/+16
| | | | | | | | | | | * Add RelativeDistinguishedName class * Make relative_name a RelativeDistinguishedName DistributionPoint relative_name is currently a Name but RFC 5280 defines it as RelativeDistinguishedName, i.e. a non-empty SET OF name attributes. Change the DistributionPoint relative_name attribute to be a RelativeDistinguishedName.
* Allow passing iterators where collections are expected (#3078)Marti2016-08-261-31/+41
| | | | | | | | | | | | | | Iterators can only be enumerated once, breaking code like this in Python 3 for example: san = SubjectAlternativeName(map(DNSName, lst)) This is also a slight behavior change if the caller modifies the list after passing it to the constructor, because input lists are now copied. Which seems like a good thing. Also: * Name now checks that attributes elements are of type NameAttribute * NoticeReference now allows notice_numbers to be any iterable
* Added a special case for EC as wellAlex Gaynor2016-03-271-0/+3
|
* Fixes #2856 -- add a fast path to _key_identifier_from_public_key for RSA keysAlex Gaynor2016-03-271-17/+25
|
* Add AuthorityKeyIdentifier.from_issuer_subject_key_identifierPaul Kehrer2016-03-111-0/+8
|
* add the oid required by the extensiontype interfacePaul Kehrer2016-02-261-0/+2
|
* add policy constraints classPaul Kehrer2016-02-261-0/+54
|
* Refs #2578 -- implement __hash__ on InhibitAnyPolicyEeshan Garg2016-02-011-0/+3
|
* Refs #2578 -- implement __hash__ on AccessDescriptionEeshan Garg2016-01-311-0/+3
|
* refactor the init validation of AuthorityKeyIdentifierPaul Kehrer2016-01-051-17/+20
| | | | Fixes #2640
* don't allow UnrecognizedExtension with get_extension_for_classPaul Kehrer2015-12-301-0/+7
|
* add UnrecognizedExtension classPaul Kehrer2015-12-301-0/+31
|
* Merge pull request #2598 from reaperhulk/index-cpAlex Gaynor2015-12-271-0/+3
|\ | | | | support indexing in CertificatePolicies
| * support indexing in CertificatePoliciesPaul Kehrer2015-12-271-0/+3
| |
* | Merge pull request #2597 from reaperhulk/index-cdpAlex Gaynor2015-12-271-0/+3
|\ \ | | | | | | support indexing in CDP
| * | support indexing in CDPPaul Kehrer2015-12-271-0/+3
| |/