summaryrefslogtreecommitdiff
path: root/src/cryptography/x509/extensions.py
Commit message (Collapse)AuthorAgeFilesLines
* Support msCertificateTemplate extension (#8695)Paul Kehrer2023-04-101-0/+59
| | | | | | | * support ms certificate template * contortions for rust coverage * review feedback
* Use from __future__ import annotations everywhere (#8643)Alex Gaynor2023-03-311-20/+21
|
* Added support for OCSP AcceptableResponses extension (#8617)Alex Gaynor2023-03-271-0/+29
| | | fixes #8589
* Make Union type aliases a documented public API (#8168)Marti Raudsepp2023-03-071-15/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Rename Union type aliases to CamelCase Many `typing.Union` type aliases were previously using `UPPER_SNAKE_CASE`, but Python's convention is `CamelCase` for these (e.g. https://docs.python.org/3/library/typing.html#type-aliases) * Add utils.deprecated for the old non-underscore type aliases * Added documentation for new type aliases & minor tweaks * Use 'versionadded:: 40.0.0' * Fix CertificatePublicKeyTypes vs CertificateIssuerPublicKeyTypes. Rename CertificatePrivateKeyTypes to CertificateIssuerPrivateKeyTypes * Fix imports (ruff) * Fix one more versionadded * Tweak docs & Reorder: CertificateIssuerPublicKeyTypes before CertificateIssuerPrivateKeyTypes * Fix test mypy errors using cast() * Fix black, oops * Revert "Fix black, oops" This reverts commit 85344e231d697bdc0940e105f7aed729445f9743. * Revert "Fix test mypy errors using cast()" This reverts commit b272d8ca95fbbbc62060663f9e8930a139a7a43e. * Revert type of SubjectKeyIdentifier.from_public_key arg * Changelog tweak
* Disallow wildcards in DNSName for name constraints (#8272)gbansaghi2023-02-121-2/+15
| | | | | | | * Disallow wildcards in DNSName for name constraints As discussed in #8253, wildcards are unnecessary according to RFC 5280, and cause issues with at least Firefox. * update changelog
* Use the ruff 'pyupgrade' checks (#8104)Alex Gaynor2023-01-201-24/+24
|
* Switch from flake8 to ruff (#7920)Alex Gaynor2022-12-211-4/+4
| | | It's more than 60x faster.
* Make sure that one of full_name, relative_name or crl_issuer is set in ↵Mathias Ertl2022-10-151-6/+5
| | | | distribution points (#7710)
* Move _CRLREASONFLAGS to be in a sensible place (#7167)Alex Gaynor2022-05-011-0/+11
|
* make ExtensionTypeVar covariant (#7033)Mathias Ertl2022-04-031-1/+3
|
* enforce that GeneralSubtrees for NameConstraints must be None or non-empty ↵Alex Gaynor2022-03-201-0/+8
| | | | (#6983)
* Don't explicitly define __ne__ any longer (#6908)Alex Gaynor2022-02-271-105/+0
| | | At some point it gained a default that was the same as what we were implementing.
* Remove explicit subclassing of object now that all classes are new-style (#6830)Alex Gaynor2022-01-301-7/+7
| | | As someone who first with Python in 2.4 or so, this habit is going to be hard to break.
* consistently use object for other in eq/ne types (#6756)Paul Kehrer2021-12-261-70/+70
| | | | this appears to be best practice and also makes the mypy type-coverage analysis happier
* improvements to public/private key types and misc backend typing (#6734)Paul Kehrer2021-12-231-5/+5
|
* more typing (#6616)Paul Kehrer2021-11-171-3/+13
|
* Allow to serialize extension values as DER bytes strings (#6346)Felix Fontein2021-11-121-0/+95
| | | | | * Allow to serialize extension values as DER bytes string. * Prepare test for SignedCertificateTimestamps.
* oxidize issuing distribution point (#6108)Paul Kehrer2021-06-111-0/+24
| | | | | | | * oxidize issuing distribution point * cleanup * clippy
* Use well-defined enum representation (#6042)Christian Heimes2021-05-121-3/+3
| | | | | | | | | Python 3.10 changed enum's object and string representation. PyCA cryptography now uses a custom subclass of enum.Enum() will well-defined __repr__ and __str__ from Python 3.9. Related: https://bugs.python.org/issue40066 Fixes: https://github.com/pyca/cryptography/issues/5995 Signed-off-by: Christian Heimes <cheimes@redhat.com>
* make PRIVATE/PUBLIC_KEY_TYPES a public API (#6001)Mathias Ertl2021-04-241-4/+4
|
* Converted DER parsing of SPKIs to rust (#5963)Alex Gaynor2021-04-111-25/+2
|
* make get_extension_for_class a generic function (#5923)Mathias Ertl2021-03-201-2/+2
|
* Bugfix/issue 5889 typehint get values for types (#5900)Mathias Ertl2021-03-071-11/+229
| | | | | | | | | | | | | | | | | | | | | * add type alias for IP addresses * Re-export module attributes in cryptography.x509.oid Without exporting attributes via `__all__` mypy will consider typehints of classes imported from `cryptography.x509.oid` as type Any. Example: from cryptography.x509.oid import ObjectIdentifier oid = ObjectIdentifier("1.2.3") # Any, if we do not re-export Note that while the canonical location of ObjectIdentifier is in `crytography.x509`, it is imported many times from `crytography.x509.oid` instead * add return type annotiations to constructors * overload GeneralNames.get_values_for_type * overload all implementations
* Generic extension value/typehint x509.Name (#5897)Mathias Ertl2021-03-061-1/+1
| | | | | | | * make value property return the generic value * typehint x509.Name * also ignore overloaded functions
* consistently typecast to list (#5873)Mathias Ertl2021-02-271-3/+6
|
* Strict typehints for extensions and OIDs (#5870)Mathias Ertl2021-02-271-219/+256
| | | | | | | | | | | | | | | | | | | | | | | | | * add typehint for name * strictly type ObjectIdentifier * explicit reexport for mypy * type (most) of extensions.py * minor cleanup * more consistently return None in constructors * revert explicit reexport, as requested * use _make_sequence_methods for now (#5870) * mark oid as normal type-hinted property so that classes can access it * fix spelling (upper case) use short form for reference * annotate as ClassVar * add type ignore for special extension class
* Add key_identifier property to SubjectKeyIdentifier (#5849)Arnaud Durand2021-02-211-0/+4
| | | Fix #5848
* make Extension a generic class (fixes #5830) (#5831)Mathias Ertl2021-02-201-5/+9
|
* add typehints for read only properties (#5826)Mathias Ertl2021-02-151-49/+152
| | | | | | | | | | | | | | | | | | | | | | | | | | | * add typehints for read only properties * fix typing in test cases * fix last missing assertion * add typehints to all read_only_properties where type hints are already available * check for isnot None instead, as per PR suggestion * convert read_only_property to @property decorators * remove unused import * use List instead of Iterable for return values * use @property instead of read_only_property * fix type errors * remove last occurance of annotated read_only_property * use is not None check (works because we now return list) * fix unused import
* part 2 of typing x509 extensions (#5815)Alex Gaynor2021-02-111-30/+67
|
* Start typing a bunch of stuff from x509 extensions (#5812)masterAlex Gaynor2021-02-111-22/+38
|
* type updates from turning on unchecked-defs on tests (#5720)Paul Kehrer2021-01-311-62/+34
| | | test changes themselves will be in a separate PR
* Apply type annotations to x509 ct and ocsp (#5712)Alex Gaynor2021-01-301-4/+5
|
* Complete removal of py2 (#5533)Alex Gaynor2020-12-091-13/+9
| | | | | * Drop Python 2 * Black everything
* Remove __future__ import from our code (#5610)Alex Gaynor2020-12-091-1/+0
|
* Switch black to py36 as the minimum version (#5608)Alex Gaynor2020-12-081-5/+5
|
* new black, actually slightly different than the old black (#5429)Paul Kehrer2020-08-261-1/+2
|
* Paint it Black by the Rolling Stones (#5324)Alex Gaynor2020-07-201-157/+185
|
* change KeyUsage repr to be less confusing (#5314)Paul Kehrer2020-07-181-2/+5
| | | fixes #5127
* Support parsing SCTs in OCSPResponse (#5298)Paul Kehrer2020-07-051-0/+43
| | | | | | | | | * Support parsing SCTs in OCSPResponse * s/typically/only and pep8 * remove unused vector Co-authored-by: Szilárd Pfeiffer <szilard.pfeiffer@balasys.hu>
* add SubjectInformationAccess extension support (#5295)Paul Kehrer2020-07-021-0/+32
| | | | | * add SubjectInformationAccess extension support * fixes
* 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
|