Commit graph

378 commits

Author SHA1 Message Date
Paul Kehrer
45bddbfb19
add support for aes256-gcm@openssh.com decryption for SSH keys (#8738)
* add support for aes256-gcm@openssh.com decryption for SSH keys

* review feedback

* skip when bcrypt isn't present
2023-04-15 04:05:11 +00:00
Paul Kehrer
f724c9b2fd
Support msCertificateTemplate extension (#8695)
* support ms certificate template

* contortions for rust coverage

* review feedback
2023-04-10 03:10:41 +00:00
Paul Kehrer
5fef27733c
update docs for macOS dev with rust openssl (#8653) 2023-04-02 09:01:31 -04:00
Alex Gaynor
1e49cb9c13
Switch from tox to nox (#8651) 2023-04-02 16:28:22 +09:00
Alex Gaynor
89228a9deb
Added support for OCSP AcceptableResponses extension (#8617)
fixes #8589
2023-03-27 00:51:04 +00:00
Alex Gaynor
d05a8ac6cd
Update to the new wycheproof (#8403) 2023-02-28 05:07:54 +00:00
Paul Kehrer
957524e02e
add CRL vector with an inner/outer signature OID mismatch (#8163) 2023-01-29 22:00:59 +00:00
Alex Gaynor
5d3db676cf
Use the ruff 'pyupgrade' checks (#8104) 2023-01-20 05:36:01 +08:00
Alex Gaynor
796ebf6702
fixes #8035 -- added a test for loading a cert with another PEM block containing headers (#8045) 2023-01-12 04:07:33 +00:00
Paul Kehrer
587eb98e7e
mismatched inner/outer signature algorithm x509 cert (#8038) 2023-01-10 22:00:35 -05:00
Paul Kehrer
c4deff5537
more test vectors for ssh certs (#7993) 2023-01-06 04:25:56 +00:00
Paul Kehrer
3a23d4674d
another ssh cert vector (#7991) 2023-01-05 13:26:16 +00:00
Paul Kehrer
2aaa272c12
add ssh certificate test vectors (#7984) 2023-01-05 07:41:22 -05:00
Alex Gaynor
07d76445e6
Pin python dev dependencies in CI with a pip constraints file (#7962) 2023-01-03 08:47:06 +07:00
Alex Gaynor
7ff729ecf2
Switch from flake8 to ruff (#7920)
It's more than 60x faster.
2022-12-21 09:44:47 +07:00
William Woodruff
7b79a46df1
x509: add load_pem_x509_certificates (#7878)
* x509: add `load_pem_x509_certificates`

This behaves similarly to `load_pem_x509_certificate`, except that it
returns a list of loaded certificates instead of just the first X.509
certificate.

It raises if the input contains no PEM-encoded certificates, or if PEM
or certificate parsing fail.

Signed-off-by: William Woodruff <william@trailofbits.com>

* tests/x509: blacken

Signed-off-by: William Woodruff <william@trailofbits.com>

* Update docs/x509/reference.rst

Co-authored-by: Alex Gaynor <alex.gaynor@gmail.com>

* tests/x509: assert each item in the list is actually a certificate

Signed-off-by: William Woodruff <william@trailofbits.com>

* bindings: expose `load_pem_x509_certificates` in `x509.pyi`

Signed-off-by: William Woodruff <william@trailofbits.com>

* tests/x509: test the structure of each cert a bit

This has the transitive effect of establishing a fixed order.

Signed-off-by: William Woodruff <william@trailofbits.com>

* CHANGELOG: record changes

Signed-off-by: William Woodruff <william@trailofbits.com>

* docs: add PEM to spellcheck allowlist

Signed-off-by: William Woodruff <william@trailofbits.com>

* docs/x509: document expected param

Signed-off-by: William Woodruff <william@trailofbits.com>

Signed-off-by: William Woodruff <william@trailofbits.com>
Co-authored-by: Alex Gaynor <alex.gaynor@gmail.com>
2022-12-05 02:20:11 +00:00
Paul Kehrer
d518a18368
fix parsing for CRLs with TLVs > 65535 bytes (#7575)
* add CRL test vector with 9,999 revoked items

* bump rust-asn1

* add large CRL test

this tests CRLs larger than 65535 bytes in size. rust-asn1 supports up
to 4GiB TLVs now, but we'll avoid putting a test vector that big for now
2022-09-07 11:51:25 +00:00
Alex Gaynor
0c88afb12d
Added OCB vectors from openssl (#7401) 2022-07-05 15:30:02 +00:00
Alex Gaynor
0f81490c7f
Added vectors for long form tags (#7396) 2022-07-04 16:56:07 +00:00
William Woodruff
c1b7307a3e
X.509/Certificate: Add tbs_precertificate_bytes property (#7279)
* Add `tbs_precertificate_bytes` property

* docs/x509: document `tbs_precertificate_bytes`

Signed-off-by: William Woodruff <william@trailofbits.com>

* tests/x509: add two trivial tests

Signed-off-by: William Woodruff <william@trailofbits.com>

* x509/base: fix lint

Signed-off-by: William Woodruff <william@trailofbits.com>

* oid: add CERTIFICATE_TRANSPARENCY (1.3.6.1.4.1.11129.2.4.4)

Signed-off-by: William Woodruff <william@trailofbits.com>

* hazmat/oid: rehome CERTIFICATE_TRANSPARENCY under ExtendedKeyUsageOID

Signed-off-by: William Woodruff <william@trailofbits.com>

* docs/x509: fix link, help the spellchecker

Signed-off-by: William Woodruff <william@trailofbits.com>

* x509: Raise ValueError when we can't filter SCT list extension

* tests: Expect a `ValueError` when accessing `tbs_precertificate_bytes`
in default example

* tests, vectors: Add TBS precert vector for test comparison

* docs/x509: document the `CERTIFICATE_TRANSPARENCY` OID

Signed-off-by: William Woodruff <william@trailofbits.com>

* docs/x509: elaborate `tbs_precertificate_bytes`

Signed-off-by: William Woodruff <william@trailofbits.com>

* rust/x509: remove unused OID

Signed-off-by: William Woodruff <william@trailofbits.com>

* x509/certificate: tweak error

Signed-off-by: William Woodruff <william@trailofbits.com>

* tests/x509: reorganize

Signed-off-by: William Woodruff <william@trailofbits.com>

* Update src/rust/src/x509/certificate.rs

Co-authored-by: Alex Gaynor <alex.gaynor@gmail.com>

* tests/x509: more reorg, rename

Signed-off-by: William Woodruff <william@trailofbits.com>

* docs: document new testvector

Signed-off-by: William Woodruff <william@trailofbits.com>

* docs: coax the spellchecker

Signed-off-by: William Woodruff <william@trailofbits.com>

* tests/x509: use a cert that doesn't require SHA-1

Signed-off-by: William Woodruff <william@trailofbits.com>

* tests/x509: test for no extensions at all

Signed-off-by: William Woodruff <william@trailofbits.com>

Co-authored-by: Alex Cameron <asc@tetsuo.sh>
Co-authored-by: Alex Gaynor <alex.gaynor@gmail.com>
2022-05-31 22:51:32 +00:00
Alex Gaynor
1407dd6339
Added vectors for invalid CSR/CRL versions (#7247)
* Added vectors for invalid CSR/CRL versions

* Update docs/development/test-vectors.rst

Co-authored-by: Paul Kehrer <paul.l.kehrer@gmail.com>

Co-authored-by: Paul Kehrer <paul.l.kehrer@gmail.com>
2022-05-22 22:52:32 +00:00
Alex Gaynor
bf56c57c44
Remove vestiges of doc8 (#7233)
We don't use it since 1eccc52b63
2022-05-18 00:15:36 +00:00
William Woodruff
6fe0aaf95a
docs, vectors: add two more x509 SCT testvectors (#7215)
Signed-off-by: William Woodruff <william@yossarian.net>
2022-05-12 17:40:47 -04:00
David Benjamin
1cc43f1886
Fix test CRLs and CSRs with invalid versions (#7216)
CRL versions only go up to v2 (numeric value 1) and CSRs only define v1
(numeric value 0). See
https://www.rfc-editor.org/rfc/rfc5280.html#section-5.1 and
https://www.rfc-editor.org/rfc/rfc2986.html#section-4. Some of the
inputs used in tests were misissued.

Unfortunately, the corresponding private keys for these test vectors
weren't provided, so I've just editted the inputs with der-ascii and
left the signatures invalid. The tests in question don't seem to rely on
valid signatures.
2022-05-12 19:50:43 +00:00
Paul Kehrer
895a07abf2
add x509 pss certificate and public key (#7161)
* add x509 pss certificate and public key

the cert is signed using rsa_pss_2048.pem and the public key is the
public components of that private key

* Update docs/development/test-vectors.rst

Co-authored-by: Alex Gaynor <alex.gaynor@gmail.com>

Co-authored-by: Alex Gaynor <alex.gaynor@gmail.com>
2022-04-30 21:04:37 +00:00
Robert Coup
2c3404b56b
docs: fix linting tox env name (#7117) 2022-04-26 18:09:12 +00:00
Paul Kehrer
3b9a11b6d2
add RSA PSS test vectors (#7086) 2022-04-17 08:20:32 -05:00
Paul Kehrer
0724c5f1ee
check for invalid keys that RSA_check_key misses (#7080)
* check for invalid keys that RSA_check_key misses

RSA_check_key checks for primality but that fails to catch this case
since 2 is prime. Instead we fetch p and q and verify that they are odd
and if not reject the key as invalid.

* circleci sucks
2022-04-16 13:55:01 +00:00
Paul Kehrer
00c61b9537
update pkcs7 test vectors (#7030)
* update pkcs7 test vectors

* this is a word
2022-04-03 09:11:54 -04:00
Paul Kehrer
4a4f4d94ce
OCB3 test vectors for 104, 112, and 120-bit nonces (#7009) 2022-03-29 07:09:07 -04:00
Alex Gaynor
7513197fc6
fixes #6804 -- improve error message quality with invalid characters in name attributes (#6843) 2022-02-06 21:42:56 -06:00
Alex Gaynor
02783d2297
Remove explicit subclassing of object now that all classes are new-style (#6830)
As someone who first with Python in 2.4 or so, this habit is going to be hard to break.
2022-01-30 16:29:24 +00:00
Paul Kehrer
75be92de8e
support parsing bitstring values in DNs (#6629)
* support bitstring values in DNs

parsing is limited to x500UniqueIdentifier only

* Update src/cryptography/x509/name.py

Co-authored-by: Alex Gaynor <alex.gaynor@gmail.com>

Co-authored-by: Alex Gaynor <alex.gaynor@gmail.com>
2021-11-28 23:47:44 +00:00
Paul Kehrer
5bd0c10d50
allow parsing of nonstandard country name and jurisdiction country name (#6641)
The spec requires both of these to be exactly two characters to
correspond with ISO country codes. Reality is sometimes messier, so this
allows parsing (but not encoding) of this invalid data. Parsing will
raise a UserWarning if incorrect lengths are detected.
2021-11-21 03:16:43 +00:00
Paul Kehrer
78c2dd8a04
add AES SIV vectors (#6608) 2021-11-15 07:19:44 -05:00
Paul Kehrer
c451c1df4e
add AES OCB3 test vectors (#6606) 2021-11-15 01:50:13 +00:00
Alex Gaynor
4da2a68118
Allow parsing CSR extensions with the critical bit having an explicitly encoded default (#6600)
* Allow parsing CSR extensions with the critical bit having an explicitly encoded default

* Poke for zuul
2021-11-14 05:42:10 +08:00
Paul Kehrer
bb05d4b5e6
allow multiple identical pem blocks (#6551)
this matches our behavior to OpenSSL and allows users to pass a chain to
our PEM loaders. To make this a little less magical it is now
documented.
2021-11-05 07:07:36 -04:00
Paul Kehrer
e333fa3279
deprecate backend part 4 of n (#6522) 2021-11-02 17:49:25 -04:00
Paul Kehrer
ae1e4a4bc4
deprecate backend part 1 of n (#6517)
* update all custom vector generation scripts to not use backends
* remove references to backends in test-vectors.rst
2021-11-02 07:05:24 -04:00
Paul Kehrer
f4871a218d
add accvraiz1 bmpstring test vector (#6503) 2021-10-31 07:46:48 -04:00
Felix Fontein
667e7a5f4c
Add new PKCS12 test vectors (#6383)
* Add new PKCS12 test vectors for #6348.

* Re-create test certs without DSA.

* Forgot to adjust the docs.
2021-10-06 12:44:38 +08:00
Maximilian Hils
703de3afa0
Accept combined PEM files with multiple sections (#6365)
* accept combined PEM files with multiple sections

* pass error messages into `find_in_pem`
2021-10-03 13:26:44 -04:00
Paul Kehrer
51221b2c48
support legacy PEM headers for certificate and CSR (#6356) 2021-10-02 09:52:54 -04:00
Paul Kehrer
ee5c05cfe7
add new x509 request vector (#6313) 2021-09-27 07:06:48 -04:00
Paul Kehrer
cabcc465fc
add several OCSP response vectors (#6298)
* add several OCSP response vectors

* fix naming
2021-09-23 08:09:41 -04:00
Alex Gaynor
b1002451c0
Don't internal error on CRL with no nextUpdate value (#6282)
* Don't internal error on CRL with no nextUpdate value

* Fix typing

* docs
2021-09-19 09:57:38 +08:00
Paul Kehrer
88e8058088
add vector omitting optional ASN.1 SEQUENCE for an empty CRL (#6279) 2021-09-18 19:50:12 -04:00
match man
e493406486
Make OAEP test vector generating works on python3 (#6255)
Use always string as output format

Co-authored-by: Baofeng Wang <baofeng.wang67@gmail.com>
2021-09-06 16:53:29 -04:00
Alex Gaynor
50d51933b2
Correct the documentation on crl_invalid_time.der (#6191) 2021-08-08 10:23:55 -04:00