Commit graph

400 commits

Author SHA1 Message Date
Alex Gaynor
cd9cb8b488
Remind people about rust in the dev docs (#9985) 2023-12-10 17:39:06 +00:00
Alex Gaynor
0a1f26b48f
Document tests-nocoverage in our dev docs (#9984)
There's limited value in running coverage locally, since no single build produces 100% coverage
2023-12-10 11:29:29 -06:00
Alex Gaynor
61676b5b05
Update development docs (#9977)
- No special configuration is required for brew or macports OpenSSL anymore
- There's no point in documenting building local docs, it's basically never necessary
2023-12-09 08:36:46 -06:00
Paul Kehrer
d06a6a17cb
regenerate x509/custom/ca/ca.pem to expire in 2100 (#9964)
The existing cert doesn't expire until late 2038 but this simplifies
2038 checks for some downstream consumers. We shift the original
cert/key into a new pkcs12/ca directory so that we don't need to
regenerate all the PKCS12 vectors (which don't care about expiry anyway)
2023-12-05 09:21:37 -05:00
Alex Gaynor
f1817f8077
Slightly alter AEAD benchmark code to solve problem AES-GCM-SIV hit (#9948) 2023-12-01 18:42:42 -06:00
Facundo Tuesca
6359dc0e04
Add test vectors for AES-GCM-SIV (#9930) 2023-12-01 10:46:29 -06:00
Alex Gaynor
420ad4e245
Fix some warnings from ruff --preview (#9842) 2023-11-09 17:37:56 -06:00
Alex Gaynor
1cb847a597
Updates to dev docs (#9780)
- Stop talking about black
- Use type annotations in examples
2023-10-26 00:49:20 +00:00
Alex Gaynor
a8dd927f04
Fix ruff on main (#9443) 2023-08-17 14:11:09 +00:00
Facundo Tuesca
b660044dce
Add test vectors for ChaCha20 counter overflow (#9221)
* Adapt ChaCha20 test vectors to 64-bit counter

* Add ChaCha20 test vectors for counter overflow

These vectors test the behavior during counter overflow. Since
different implementations use different counter sizes (e.g. OpenSSL
uses a 64-bit counter, whereas BoringSSL uses a 32-bit counter),
it's important to ensure that the behavior during counter overflow
is consistent between implementations.

These vectors take into account both 32-bit and 64-bit overflows.
2023-08-17 08:54:35 -05:00
William Woodruff
41d89f1ae6
noxfile, docs: fix posargs handling (#9354)
* noxfile, docs: fix posargs handling

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

* Update docs/development/getting-started.rst

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

---------

Signed-off-by: William Woodruff <william@trailofbits.com>
Co-authored-by: Alex Gaynor <alex.gaynor@gmail.com>
2023-08-04 16:48:15 +00:00
Jean Paul Galea
caeafe6c4a
docs: fix broken link to https://ed25519.cr.yp.to/software.html (#9338) 2023-08-02 19:02:56 +12:00
Paul Kehrer
1b4bbea008
tolerate (with warning) invalid DSA params encoding in X.509 (#9271)
fixes #9253
2023-07-20 17:10:15 -04:00
Alex Gaynor
e949b2e15c
Prepare for new ruff release (#9227) 2023-07-12 19:40:26 -07:00
jeanluc
1ca7adc97b
Fix encoding of SSH certs with critical options (#9208)
* Add tests for issue #9207

* Fix encoding of SSH certs with critical options

* Test unexpected additional values for crit opts/exts
2023-07-10 11:50:49 -05:00
Paul Kehrer
1355c2e460
tolerate NULL params in ECDSA SHA2 AlgorithmIdentifier (#9002)
* tolerate NULL params in ECDSA SHA2 AlgorithmIdentifier

Java 11 does this incorrectly. It was fixed in Java16+ and they are
planning to do a backport, but we'll need to tolerate this invalid
encoding for a while.

* test both inner and outer
2023-05-31 23:21:28 -04:00
Paul Kehrer
93c96b777a
allow null params in AlgorithmIdentifiers with SHA hash function OIDs (#8974)
RFC 4055 section 2.1 states "All implementations MUST accept both
NULL and absent parameters as legal and equivalent encodings".

It also makes some somewhat conflicting statements after that, but
LibreSSL omits the null params for PSS, and OpenSSL parses this
without issue so tolerance it is.
2023-05-27 10:07:20 -04:00
Alex Gaynor
5b7dd82561
Fix gitlab URLs for linkcheck (#8938) 2023-05-17 00:39:18 +00:00
Paul Kehrer
cfee3c85a7
add RSA PSS SHA1 hash algorithm + SHA1 MGF1 test vector (#8906) 2023-05-11 00:29:39 +00:00
Paul Kehrer
0f2b72bb12
invalid visible string support (#8884)
* invalid visible string support

this allows utf8 in visiblestring, which is not valid DER. we raise a
warning when this happens, but allow it since belgian eIDs, among
others, have encoding errors. Belgium fixed this by 2021 (and possibly
earlier), but their eID certificates have 10 year validity.

* review comments

* clippy
2023-05-07 16:01:33 +00:00
Paul Kehrer
9425d2376b
add one more RSA PSS invalid test vector (#8798) 2023-04-23 20:22:50 +00:00
Paul Kehrer
5f3871e4df
add two RSA PSS certificate vectors that have invalid encodings (#8797)
* add two RSA PSS certificate vectors that have invalid encodings

The signatures on these vectors are not valid.

* spelling
2023-04-23 19:51:35 +00:00
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