Commit Graph

67 Commits

Author SHA1 Message Date
Brian Smith 16a2638bd0 Upgrade to *ring* 0.17 and untrusted 0.9.
untrusted 0.9 is used by *ring*. untrusted stopped providing a `PartialEq`
for `Input` in 0.9; this was the driver for all the code changes.
2023-10-02 14:24:17 -07:00
Daniel McCarney 4d0cbba617 signed_data: fix code block missing close marker 2023-09-29 20:21:44 -07:00
Brian Smith d16bafbba4 NFC: Address Clippy `needless_borrow` complaints. 2023-08-30 17:04:56 -07:00
Brian Smith 0cd0b31beb Revert main branch crate contents to the 0.22.0 release contents.
Reset the crate contents (sources, tests, etc.)
to what they were at that commit, while retaining the newer CI
configuration.

The changes since the 0.22.0 release were primarily intended to
accomplish two goals:

* Fix and improve the GitHub Actions configuration.
* Prepare a 0.21.5 release that was backward compatible with 0.21.4
  but which also contained the improvements that were in 0.22.0.

0.21.5 was never released and will not be released. Therefore all
of the noise to facilitate the 0.21.5 release can just be deleted,
as long as we leave the CI changes that are necessary for GitHub
Actions to work correctly now.

The exact commands I used were:

```
git checkout \
    6c334a2cf5 \
    -- \
    Cargo.toml \
    LICENSE \
    README.md \
    src \
    tests \
    third-party
git rm src/trust_anchor_util.rs
```

Commit 6c334a2cf5 was the commit from
which 0.22.0 was released. It is confusing because the commit
immediately prior, 0b7cbf2d32, has
commit message "0.22.0". It appears that I merged the "0.22.0"
commit, expecting to `cargo publish` from that commit, but then
`cargo publish` failed. Then I added
6c334a2cf5 to fix `cargo publish`
and did the `cargo publish` from that commit. That's why I added
the `package` CI step at that time, to prevent this confusing
situation from happening again.

`trust_anchor_utils.rs` was not in 0.22.0; the `git checkout` didn't
delete it, so I had to do it separately.

I left the tests added subsequent to 0.22.0 in `tests/` (e.g.
`name_tests.rs`) since those tests pass with the 0.22.0 sources too.

Unfortunately, this requires disabling a bunch of Clippy lints, to
avoid modifying the contents from 0.22.0.

(I know it is confusing. It took me a while to figure it out myself
today.)
2023-08-30 08:31:51 -07:00
Brian Smith 97507d40ab Appease the newest stable Clippy. 2021-12-13 21:44:26 -08:00
Brian Smith 17d9189981 Temporarily undo some renaming that can't be alised, to get back webpki 0.21.4 compat.
Make it easier to maintain support for Rustls 0.19.1 by restoring the webpki main branch to a
state compatible with webpki 0.21.4.
2021-05-07 15:12:11 -07:00
Brian Smith 5b67fb92da Rename error variants according to Rust conventions. 2021-04-09 15:58:41 -07:00
Brian Smith 9cf9f45923 Don't use libstd, and specifically avoid file I/O, in tests.
Previously, the `signed_data` tests could not be run on platforms without libstd.
Now they can be run as long as liballoc is available.
2021-01-13 15:57:41 -08:00
Brian Smith 28951a0d46 Don't enable *ring*'s `alloc` feature by default; Require `alloc` for RSA.
Only use *ring*'s `alloc` feature if webpki's `alloc` feature is enabled. This
disables RSA by default.

Adjust some tests that return different results depending on whether RSA is
available.
2021-01-07 13:08:30 -08:00
Brian Smith 2deeb79c74 Refactor features.
Test all feature configurations in CI.

Remove the `trust_anchor_utils` feature flag.

Guard all features that directly require allocation with a new `alloc` feature.
The RSA features will be handled separately.

Document the features. Tell docs.rs to document all features.

Adjust some tests so that tests are run in more configurations.
2021-01-07 00:36:28 -08:00
Brian Smith 0486ea10f6 `cargo fmt`. 2020-12-29 13:09:55 -08:00
Brian Smith 6e2462ad18 Clippy: Address `clippy::single-component-path-imports` warnings. 2020-12-07 17:57:08 -08:00
Brian Smith 8f8ef9e2f3 Documentation: Fix links to be compatible with Nightly rustdoc. 2020-12-01 20:15:24 -08:00
Brian Smith 0d2699a389 Remove use of `untrusted` from the public API. 2019-07-15 21:25:11 -10:00
Brian Smith 892e7e2bd6 `cargo +nightly fix`. 2019-07-09 18:34:33 -10:00
Brian Smith 6031d9fc9b Sync with latest *ring* API changes. 2019-04-05 17:26:45 -10:00
Brian Smith f1264202da Update for latest `untrusted` prerelease. 2019-04-05 10:30:30 -10:00
Brian Smith 8c73c9c9f1 `cargo +nightly fmt.` 2019-03-28 15:26:38 -10:00
Brian Smith 0d8a27161a Switch to Rust 2018 Edition. 2019-03-28 15:26:38 -10:00
Brian Smith b3bcccc38d Eliminate unnecessary `'static` lifetime annotations. 2019-03-28 15:19:47 -10:00
Brian Smith 003f503124 Update dependencies to in-development versions. 2019-03-28 15:19:47 -10:00
Brian Smith f2f2f13811 Revert "Revert "Remove support for SHA-1.""
This reverts commit db0c6cbd1e, i.e.
it removes SHA-1 support again.
2019-03-22 11:35:33 -10:00
Andy Russell dba79f5894 convert doc comment to regular comment 2019-02-20 03:57:50 -10:00
Brian Smith faa7f2b88b Revert "`cargo +nightly fmt`."
This reverts commit 7379d6062b. We'll merge
some outstanding PRs before doing the reformat.
2019-01-29 17:06:47 -10:00
Brian Smith 7379d6062b `cargo +nightly fmt`. 2019-01-29 17:03:53 -10:00
Sebastian Hahn d139e98815 Add support for Ed25519 certificates
This adds support for verification of ed25519 certificates according to
RFC 8410. Implements #49.

The test certificate was generated using OpenSSL 1.1.1a, using the
following commands (CA.pl is distributed with OpenSSL):

openssl genpkey -algorithm ed25519 -outform pem -out root_key.pem
openssl req -new -x509 -days 9999 -extensions v3_ca -key root_key.pem \
-inform pem -outform pem -out root_ed25519.pem
echo root_ed25519.pem | CA.pl -newca

openssl genpkey -algorithm ed25519 -outform pem -out client_key.pem
openssl req -new -key client_key.pem -inform pem -outform pem \
-out client_ed25519_csr.pem
openssl ca -keyfile ./root_key.pem -days 999 -notext -in \
client_ed25519_csr.pem -out client_ed25519.pem

I agree to license my contributions to each file under the terms given
at the top of each file I changed.
2019-01-18 15:20:58 -10:00
Brian Smith db0c6cbd1e Revert "Remove support for SHA-1."
This reverts commit 97d336003e.

This will be done later.
2019-01-07 12:25:14 -10:00
Brian Smith 97d336003e Remove support for SHA-1.
All major browsers have removed support for SHA-1-signed certificates
from their Web PKI implementations. Let's do the same.
2018-11-28 13:41:41 -10:00
Brian Smith 5a739cd967 Replace `try!(...)` with `...?`. 2017-08-25 09:00:43 -10:00
Brian Smith 7268db54cb Use new field init shorthand syntax. 2017-04-27 12:53:26 -10:00
Joseph Birr-Pixton 62da34656b Use base64 crate instead of rustc-serialize.
This is also now a dev-dependency, since it's only used in tests.
2017-04-24 11:04:49 -10:00
Brian Smith 2419bb730d Remove outdated and wrong comment. 2017-02-07 10:29:04 -10:00
Brian Smith d2169004c0 Simplify AlgorithmIdentifier parsing & matching.
Simplify the way algorithm identifiers are parsed. Simplify the tests
to account for the new simpler parsing.

Simplify how algorithm identifiers are matched against known algorithm
identifiers by using just bytewise comparison.

Simplify the storage of known algorithm identifiers by including their
binary DER-encoded values from files in src/data/. Remove most of the
macros for encoding OID values as they are no longer needed. Remove the
script for generating PSS-related AlgorithmIdentifier parts in favor of
using der-ascii in the future, as documented in src/data/README.md.
Remove the encoded PSS parts generated from the deleted script, as they
were replaced in this transition.
2016-11-21 13:19:40 -10:00
Brian Smith fff5b1c628 0.8.0: Remove support for RSA PKCS#1 1.5 signatures w/o NULL parameter.
Based on some research the Google Chrome team did, there's no strong
need to support rsaEncryption signatures where the NULL is missing
unless/until we add OCSP support.
2016-11-21 13:05:39 -10:00
Joseph Birr-Pixton 82080d02ba Add support for PSS.
This has tests generated by openssl, and integrated with
the existing chromium verify_signed_data corpus.

The PSS parameter encodings are slightly unwieldy, and
are included from files rather than embedded in the source.

There are python scripts for regenerating the parameter encodings
and tests.
2016-11-21 12:36:46 -10:00
Brian Smith c26bca4700 0.7.0: Remove NIST Open Systems Environment (OSE) SHA-1 OID.
This enables us to support exactly one OID per signature algorithm.
A Censys search found no publicly-trusted certificates using this OID:
https://censys.io/certificates?q=parsed.signature.signature_algorithm.oid%3A+1.3.14.3.2.29

This won't impact uses of RSA PKCS#1 SHA-1 for ServerKeyExchange
signatures since those signatures don't identify the algorithm using
OIDS.
2016-11-17 11:28:16 -10:00
Brian Smith a830244795 Remove ECDSA_P256_SHA512 and ECDSA_P384_SHA512.
The Chromium/BoringSSL team showed that it isn't necessary to support
ECDSA with SHA-512 for the P-256 and P-384 curves for HTTPS; see
https://groups.google.com/a/chromium.org/d/msg/security-dev/SlfABuvvQas/qOil2X4UBQAJ
and
https://groups.google.com/a/chromium.org/d/msg/security-dev/SlfABuvvQas/HXaWVhZkBQAJ,
in particular "I'd also found no ECDSA/SHA-1 or ECDSA/SHA-512
certificates in CT logs."
2016-11-05 20:47:06 -10:00
Brian Smith 7255c5537e Remove ECDSA-SHA1 support; Bump version to 0.6.0. 2016-10-27 23:31:52 -10:00
Brian Smith 272de41132 Use `use` more consistently.
Follow the way it is done in *ring* (mostly).
2016-08-12 23:08:27 -10:00
Brian Smith 011adae3af Rename {expect,read}_tag_and_get_input -> {expect,read}_tag_and_get_value.
Be consistent with the *ring* names.
2016-08-12 21:52:59 -10:00
Brian Smith 42bba83cce Add ability to verify signatures with end-entity public key. 2016-08-12 16:11:53 -10:00
Brian Smith 870654884f Refactor signed_data to prepare for verifying end-entity signatures. 2016-08-12 16:11:53 -10:00
Brian Smith 5e74d88a6f Clarify SPKI parsing by using a structure instead of a tuple. 2016-08-12 16:11:53 -10:00
Brian Smith 6fedeba29b Remove commented-out code. 2016-08-12 16:05:11 -10:00
Brian Smith 8ac95e05e3 Rename Error::BadSignature -> Error::InvalidSignatureForPublicKey.
The new name is clearer about what the actual problem is.
2016-08-11 16:40:01 -10:00
Brian Smith 83cec92588 Expose `verify_signed_data` and `SignedData`.
This is the minimum amount of support needed to support verifying
signatures using the end-entity certificate's public key.
2016-08-11 16:40:00 -10:00
Brian Smith 50357d977e Add documentation for signature algorithms. 2016-08-11 16:39:57 -10:00
Brian Smith 30c8ed1a8c Remove the unneeded concept of fatal errors.
`InvalidTrustAnchor` wasn't even used. `ImpossibleState` was replaced
with a panic.
2016-08-11 15:40:06 -10:00
Brian Smith ee2161856e Enable unused_qualifications lint. 2016-08-11 15:35:38 -10:00
Brian Smith badcafbe49 Cope with renaming of `signature::ECDSA_{*}` in *ring*. 2016-07-09 15:21:43 -10:00