aboutsummaryrefslogtreecommitdiffstats
path: root/tests/x509
Commit message (Collapse)AuthorAgeFilesLines
* Unify X.509 signature algorithm validation (#5276)HEADmasterMarko Kreen2020-06-141-0/+55
| | | | | - Use common implementation - OCSP signing was using different validation - Check if private key is usable for signing
* Removed deprecated behavior in AKI.from_issuer_subject_key_identifier (#5182)Alex Gaynor2020-04-051-7/+0
|
* Allow NameAttribute.value to be an empty string (#5109)Andrea De Pasquale2020-03-191-4/+18
| | | | | | | | | | | | * Allow NameAttribute.value to be an empty string RFC 4514 https://tools.ietf.org/html/rfc4514 does not mention that "AttributeValue" can not be an empty (zero-length) string. Fixes #5106 * reverse order to match fix from another PR Co-authored-by: Paul Kehrer <paul.l.kehrer@gmail.com>
* Reversed the order of RDNs in x509.Name.rfc4514_string() (#5120)Thomas Erbesdobler2020-03-021-3/+3
| | | | RFC4514 requires in section 2.1 that RDNs are converted to string representation in reversed order.
* Parse single_extensions in OCSP responses (#5059)Paul Kehrer2019-11-111-0/+10
| | | | | | | | | | | | * add single_extensions to OCSPResponse (#4753) * new vector, updateed docs, more stringent parser, changelog, etc * simplify PR (no SCT for now) * add a comment * finish pulling out the sct stuff so tests might actually run
* UniversalString needs to be encoded as UCS-4 (#5000)Marko Kreen2019-10-171-0/+17
|
* one more missing branch (#4992)Paul Kehrer2019-09-091-0/+23
|
* fix coverage, small cleanups in tests (#4990)Paul Kehrer2019-09-092-30/+30
|
* Finish ed25519 and ed448 support in x509 module (#4972)Marko Kreen2019-09-094-7/+488
| | | | | | | | | | | | | | | | | | * Support ed25519 in csr/crl creation * Tests for ed25519/x509 * Support ed448 in crt/csr/crl creation * Tests for ed448/x509 * Support ed25519/ed448 in OCSPResponseBuilder * Tests for eddsa in OCSPResponseBuilder * Builder check missing in create_x509_csr * Documentation update for ed25519+ed448 in x509
* Allow FreshestCRL extension in CRL (#4975)Marko Kreen2019-09-071-0/+33
| | | Per RFC5280 it is allowed in both certificates and CRL-s.
* fix coverage by adding two artificial DSA public keys (#4984)Paul Kehrer2019-09-061-0/+32
| | | | | | | | | | * fix coverage by adding two artificial DSA public keys One key removes the optional parameters from the structure to cover a branch conditional, and the other key has its BITSTRING padding value set to a non-zero value. * lexicographic? never heard of it
* Make DER reader into a context manager (#4957)Alex Gaynor2019-07-281-37/+35
| | | | | | | | * Make DER reader into a context manager * Added another test case * flake8
* Remove asn1crypto dependency (#4941)David Benjamin2019-07-281-22/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* some test improvements (#4954)Paul Kehrer2019-07-271-1/+25
| | | | detect md5 and don't generate short RSA keys these changes will help if we actually try to run FIPS enabled
* Write a test for an uncovered line (#4940)Alex Gaynor2019-07-061-0/+24
|
* ed25519 support in x509 certificate builder (#4937)Paul Kehrer2019-07-061-3/+122
| | | | | | | | | | * ed25519 support in x509 certificate builder This adds minimal ed25519 support. More to come. * Apply suggestions from code review Co-Authored-By: Alex Gaynor <alex.gaynor@gmail.com>
* Small style cleanup (#4891)Alex Gaynor2019-05-191-1/+1
|
* add name for ExtensionOID.PRECERT_POISON (#4853)redshiftzero2019-05-191-1/+8
| | | | | | | | * test: ensure all public members of ExtensionOID have names defined * add name for ExtensionOID.PRECERT_POISON ref: https://github.com/google/certificate-transparency/blob/5fce65cb60cfe7808afc98de23c7dd5ddbfa1509/python/ct/crypto/asn1/oid.py#L338
* fix from_issuer_subject_key_identifier to take the right type (#4864)Paul Kehrer2019-05-041-2/+9
| | | | | | | | | | * 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
* 4810 bugfix: avoid UnicodeEncodeError on python 2 (#4846)redshiftzero2019-04-161-4/+19
| | | | | | | | * test: regression test for UnicodeEncodeError in x509 name in #4810 added utf8 encoding at the top of the file due to PEP 263 * bugfix: #4810 resolve UnicodeEncodeError in x509 name
* Fixes #4830 -- handle negative serial numbers (#4843)Alex Gaynor2019-04-131-0/+8
|
* fix != comparison in py2 (fixes #4821) (#4822)Mathias Ertl2019-03-251-4/+10
| | | | | | | | * 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/+44
|
* Fixes for the latest pep8-naming (#4744)Alex Gaynor2019-02-021-1/+1
|
* Fixes #4734 -- Deal with deprecated things (#4736)Alex Gaynor2019-01-232-27/+6
| | | | | | | | | | * Fixes #4734 -- Deal with deprecated things - Make year based aliases of PersistentlyDeprecated so we can easily assess age - Removed encode/decode rfc6979 signature - Removed Certificate.serial * Unused import
* allow asn1 times of 1950-01-01 and later. (#4728)Paul Kehrer2019-01-223-8/+37
| | | | | | | | * allow asn1 times of 1950-01-01 and later. * add a test * pretty up the test
* allow 32-bit platforms to encode certs with dates > unix epoch (#4727)Paul Kehrer2019-01-211-8/+13
| | | | | | | | | | | | | | | | | Previously we used unix timestamps, but now we are switching to using ASN1_TIME_set_string and automatically formatting the string based on the year. The rule is as follows: Per RFC 5280 (section 4.1.2.5.), the valid input time strings should be encoded with the following rules: 1. UTC: YYMMDDHHMMSSZ, if YY < 50 (20YY) --> UTC: YYMMDDHHMMSSZ 2. UTC: YYMMDDHHMMSSZ, if YY >= 50 (19YY) --> UTC: YYMMDDHHMMSSZ 3. G'd: YYYYMMDDHHMMSSZ, if YYYY >= 2050 --> G'd: YYYYMMDDHHMMSSZ 4. G'd: YYYYMMDDHHMMSSZ, if YYYY < 2050 --> UTC: YYMMDDHHMMSSZ Notably, Dates < 1950 are not valid UTCTime. At the moment we still reject dates < Jan 1, 1970 in all cases but a followup PR can fix that.
* add signature_hash_algorithm to OCSPResponse (#4681)Paul Kehrer2019-01-101-18/+32
| | | | | | * add signature_hash_algorithm to OCSPResponse * fix pointless asserts
* Remove spaces from RFC 4514 strings for better compliance (#4643) (#4646)Marti Raudsepp2018-12-181-4/+4
| | | | | | RFC 4514 does not explicitly allow whitespace between separators: https://tools.ietf.org/html/rfc4514 Reported-by: David Arnold <dar@xoe.solutions>
* Add RFC 4514 Distinguished Name formatting for Name, RDN and NameAttribute ↵Marti Raudsepp2018-12-082-67/+46
| | | | (#4304)
* remove idna as a primary dependency (#4624)Paul Kehrer2018-12-061-4/+22
| | | | | | | | | | * remove idna as a primary dependency * empty commit * dynamodb test fix (thanks to Matt Bullock) * review feedback
* encode IssuingDistributionPoint (#4618)Paul Kehrer2018-12-021-0/+137
|
* allow multi-valued RDNs (#4616)Paul Kehrer2018-11-301-0/+17
| | | | RDNs can have multiple values. This allows them in FreshestCRL and upcoming IssuingDistributionPoint encoding support.
* IssuingDistributionPoint support (parse only) (#4552)Paul Kehrer2018-11-301-0/+288
| | | | | | | | | | | | | | | | | | | | | | * 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
* Add eq/ne/hash to PrecertificateSignedCertificateTimestamps (#4534)Paul Kehrer2018-10-291-0/+154
| | | | | | | | | | | | | | * 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 response builder (#4485)Paul Kehrer2018-10-281-0/+382
| | | | | | | | * ocsp response builder * better prose * review changes
* next_update is not a required field on OCSP responses (#4513)Paul Kehrer2018-10-231-0/+8
|
* OCSP response serialization (#4482)Paul Kehrer2018-10-061-0/+19
| | | | | | * support OCSP response serialization * empty commit, good times
* support extensions in the OCSP request builder (#4481)Paul Kehrer2018-10-061-0/+32
| | | | | | | | | | * support extensions in the OCSP request builder * cover a missed branch * refactor to use new func * review feedback
* add OCSP basic response extension parsing (#4479)Paul Kehrer2018-10-061-0/+15
| | | | | | | | | | * add OCSP basic response extension parsing Just nonce for now. This does not support SINGLERESP extension parsing. * also raises on extensions for non-successful * empty commit
* support OCSP response parsing (#4452)Paul Kehrer2018-10-011-0/+137
| | | | | | | | | | | | * support OCSP response parsing * move the decorator to make pep8 happy * add some missing docs * review feedback * more review feedback
* OCSP request extension parsing (#4464)Paul Kehrer2018-09-092-0/+44
| | | | | | | | | | * add OCSP request parsing support with OCSPNonce * add docs * reprs man * make extensions a cached property
* don't sort the serial numbers in a parsed CRL (#4457)Paul Kehrer2018-09-041-0/+29
| | | | | | | | | | | * don't sort the serial numbers in a parsed CRL OpenSSL sorts them in place and this breaks the signature and more. fixes #4456 * cache the sorted CRL (but create it lazily) * use the cache decorator
* Fixes #4333 -- added support for precert poison extension (#4442)Alex Gaynor2018-08-311-0/+29
| | | | | | | | | | | | | | * Fixes #4333 -- added support for precert poison extension * Make work on all OpenSSL versions * fixed flake8 + docs * fix for older OpenSSLs * document this * spell
* refactor ocsp request parsing and generation to support only one cert (#4439)Paul Kehrer2018-08-311-69/+25
| | | | | | | | * refactor ocsp request parsing and generation to support only one cert * small doc change * notimplementederror
* fixed test name (#4433)Alex Gaynor2018-08-301-1/+1
| | | | | | * fixed test name * spelling is hard
* make an ocsp request (#4402)Paul Kehrer2018-08-301-0/+64
| | | | | | | | | | | | | | | | * make an ocsp request * update test, add docs * make it an OCSPRequestBuilder * review feedback and more tests * make it a class * empty commit to retrigger * type check
* OCSP request parsing (#4393)Paul Kehrer2018-08-151-0/+115
| | | | | | | | | | | | * add public_bytes to OCSPRequest * review feedback * OCSP request parsing * change some prose * add __len__ as a required method
* Use A-label strings in tests (#4374)Tim Burke2018-07-301-2/+2
| | | | | We already have coverage of the U-label deprecation warnings in test_x509_ext.py; see TestRFC822Name.test_idna and TestUniformResourceIdentifier.test_idna_no_port
* add crl.get_revoked_certificate method (#4331)Paul Kehrer2018-07-161-0/+12
| | | | | | | | * add crl.get_revoked_certificate method * lexicographic is the best ographic * rename