Граф коммитов

70 Коммитов

Автор SHA1 Сообщение Дата
JR Conlin 51d48ceafd
chore: Update for 2024-03 (#70) 2024-03-22 15:33:15 -07:00
JR Conlin 174f2d250f
Update/2023 06 (#69)
* update: Updated to latest flavor of base64
2023-06-24 14:47:56 -07:00
JR Conlin 082a9cd9be
chore: Dependency updates for Sept 2022 (#66) 2022-09-23 12:48:34 -07:00
JR Conlin 5c52b347f7
chore: 2021 Dec update (#65)
* includes latest clippy fixes
2022-01-27 15:47:35 -08:00
jrconlin da7e685563 chore: Dep update for Jul 2021 2021-08-02 10:17:58 +10:00
Ryan Kelly dc9b51a193 (cargo-release) version 2.1.0 2021-04-01 11:41:35 +11:00
Ryan Kelly dce8c39e7c
Implement record chunking for "aes128gcm" scheme. (#60)
This restores previous functionality where "aes128gcm" could chunk
large payloads into multiple records. It is using a different
algorithm than the previous implementation, but one that I think
is easier to understand (or at least, better documented 😅).
2021-03-30 15:56:44 +11:00
Ryan Kelly aaa12b106b
Decouple "aesgcm" and "aes128gcm" schemes, disable record chunking. (#59)
Decouple "aesgcm" and "aes128gcm" schemes, disable record chunking.

This is a significant refactor of the guts of the crypto code, but I think overall it
makes things easier to understand and to audit.

First, I've removed the `EceWebPush` trait that was previously used to share parts
of the encrypt/decrypt logic between the two schemes. The schemes are not that similar
in practice and on balance, I think the attempt to share code between them was
actually making both schemes harder to understand.

Second, I've cut all the record-chunking code out of "aesgcm". It now supports only
a single record on both encryption and decryption, in line with what the spec says
that a webpush client should support. We were already throwing errors when encountering
multiple records in "aesgcm"; this cleanup takes advantage of that fact to actually
remove the code without breaking the public API.

Finally, I've removed the record-chunking during encryption for "aes128gcm", instead
opting to support larger payloads by increasing the record size. I've also added
several layers of abstraction in the hope of making the code easier to understand -
for example there is a separate `Header` struct for reading/writing the header,
and a separate `PlaintextRecord` struct for reading/writing an individual record.

Of course "easier to understand" is subjective, but I think it's an improvement
(and I certainly understand things better as a result of having worked through it!).
Feedback and/or pushback on this is most welcome.

I'd like to try adding record chunking in back here, but as a separate PR building
atop these abstractions.

Connects to #55.
2021-03-25 16:58:59 +11:00
Ryan Kelly dc1c44623b Pad to multiples of 128 bytes, rather than to a random length.
This is one of the padding techniques suggested in the RFC, and while
we can't choose a default scheme that will work well for all applications,
this one at least seems easier to reason about.

Fixes #54.
2021-03-25 09:37:33 +11:00
Ryan Kelly c13172d64e (cargo-release) version 2.0.0 2021-03-22 13:20:20 +11:00
Ryan Kelly 312ddfbf34 Change version number to help cargo-release do the right thing. 2021-03-22 13:20:20 +11:00
Ryan Kelly c37b252a26
Update the public API to remove footguns, and document it. (#52)
This is a significant refactor of the public API of the crate, simplifying
the API surface and removing some of the footgun potential noted by Martin
in his review at https://github.com/mozilla/application-services/issues/1068.

In particular:

* The public `encrypt` functions no longer take a `salt` parameter. The
  right thing to do is to generate a new random `salt` for each encryption
  so we just do that for you automatically.
* Many internal implementation details are now `pub(crate)` rather than `pub`,
  to avoid potential confusion from consumers.
* We refuse to encrypt or decrypt across multiple records in the legacy
  `aesgcm` scheme, because the only consumer of that schema is webpush,
  and webpush restricts consumers to using only a single record.

We still have the code lying around to encrypt/decrypt across record
boundaries, but we don't have high confidence that it works correctly
for `aesgcm` and intend to refactor that away in a future commit.
So, may as well adjust the interface to reflect that while we're in here
making breaking changes.

To go along with the revised interface, this commit also significantly
expands to docs in order to help set consumer expectations and context.
2021-03-22 12:37:55 +11:00
Julien SOSTHENE 7945d7f3b4
New API for the `headers` function (#51)
The `headers` function now avoids moving `self`, avoids extra hashing, and saves some allocation.

Co-authored-by: John Tiesselune <jsos10@pm.me>
2021-03-18 15:56:48 +11:00
Ryan Kelly cc164fc8a9 Update owners in cargo metadata. 2021-02-10 09:14:39 +11:00
Ryan Kelly f0d43f6550 Add additional steps in the release process. Thanks, github branch protection. 2021-02-10 09:14:39 +11:00
Ryan Kelly 6ecf3a2b1c (cargo-release) version 1.3.0 2021-02-10 09:14:39 +11:00
Ryan Kelly bcb623d9b6 Add docs on release process 2021-02-10 09:14:39 +11:00
Ryan Kelly 60c17141ff Fix `cargo fmt` formatting. 2021-02-10 09:14:39 +11:00
Julien SOSTHENE 51e7fb6238
Add top-level access to AesGcm encoding scheme (#47)
* Use salt from WebPushParams if provided (Mainly for test purposes against the IETF example from draft 4)
* Implemented legacy aes public functions with first successful tests from spec
* Fixed documentation to have nice-looking parameter descriptions and remove erroneous types
* Added a documentation disclaimer to redirect to the top-level functions instead of the Encryption structs

Co-authored-by: John Tiesselune <jsos10@pm.me>
2021-02-03 15:19:50 +11:00
Ryan Kelly 64af2968eb Prepare release v1.2.1
This includes a fix for padding in the legacy aesgcm mode,
and some opportunistic dependency updates.
2020-09-10 11:13:02 -04:00
Jordandev678 e535dc4247
Fix aesgcm not accounting for padding (#45); r=rfk
* Fix aesgcm not accounting for padding
* Add check for padding being all zeros in aesgcm
2020-09-10 13:49:35 +10:00
Edouard Oger c7acb74345
Cut version 1.2.0 2020-05-25 12:08:48 -04:00
Edouard Oger 69d176ff40
Upgrade HKDF to 0.8 2020-05-25 12:07:06 -04:00
Tarik Eshaq 45b52b7946
Remove error backtracing and extra wrappers (#44) 2020-05-22 15:58:13 -04:00
Tarik Eshaq 0e175f16d7
Add derive thiserror so that Error impl std::error::Error (#42)
* replace failure with thiserror and backtrace
* adds thiserror::Error derive and uses #[from] to auto generate from impl
* adds thiserror::Error derive and uses #[from] to auto generate from impl
2020-05-20 10:55:35 -07:00
Tarik Eshaq 55f0bea806
replace failure with thiserror and backtrace (#40) 2020-05-20 10:04:37 -07:00
Edouard Oger 82a569c573 Bump version to v1.1.2 2020-04-15 19:16:26 -04:00
Edouard Oger 1a9434f855 Remove unnecessary parentheses 2020-04-15 19:16:26 -04:00
Edouard Oger 07f30f01b6 Bump base64 version 2020-04-15 19:16:26 -04:00
Edouard Oger ee23befd5f Bump version to v1.1.1 2019-09-03 09:35:09 -04:00
Ryan Kelly 26fcf64d6c Update to latest version of once_cell 2019-09-03 09:33:15 -04:00
Edouard Oger f95f28a602 Bump version to v1.1.0 2019-08-14 13:26:14 -04:00
Edouard Oger d24ab10f77 Allow trait-based dynamic crypto implementations 2019-08-14 13:26:14 -04:00
Edouard Oger 9d69d15da6
Bump version to v1.0.1 (#34) 2019-06-05 13:58:55 -04:00
Ryan Kelly f9a41d1c0a Make crypto_backend public (#28) 2019-06-05 13:54:26 -04:00
Edouard Oger 1d71e4d586 Remove openssl dev-dependency 2019-06-04 21:33:57 -04:00
Edouard Oger fb7024ee5b Fix serializable-keys feature (#33) 2019-06-04 17:02:27 -07:00
Edouard Oger 84869fc361 Bump version to v1.0.0 2019-05-29 16:44:27 -04:00
Edouard Oger 9340a53607 Add from/to_raw_components to LocalKeyPair and move some things around 2019-05-29 16:34:49 -04:00
JR Conlin d3fb5a11da
feat: Add convenience functions for encrypt/decrypt (#26)
* feat: Add convenience functions for encrypt/decrypt

Closes #25
2019-05-01 13:08:37 -07:00
Mozilla-GitHub-Standards 0c57bc6deb Add Mozilla Code of Conduct file
Fixes #22.

_(Message COC002)_
2019-03-31 13:43:14 -04:00
Edouard Oger 6d4da170c7 Bump version to 0.1.3 2019-03-12 18:05:40 -04:00
Edouard Oger 7850661b08 Add a generate keypair and auth secret helper method (#20) 2019-03-12 13:24:58 -07:00
Edouard Oger 6fb6700a3e Add security disclaimer 2019-03-06 14:51:14 -05:00
Edouard Oger 9ebfe170bd Bump version to 0.1.2 2019-02-21 15:48:40 -05:00
Edouard Oger 74e08fd731 Replace eoger Github org mentions by mozilla 2019-02-21 15:46:52 -05:00
jrconlin 95a376145b feat: Add Debug and Clone to OpenSSLLocalKeyPair
Closes #15
2019-01-22 18:57:20 -05:00
Edouard Oger d84340e650 Bump version to 0.1.1 2019-01-21 23:22:38 -05:00
Edouard Oger 93df60dedf Fix some 2018 paths 2019-01-21 23:21:43 -05:00
Edouard Oger 36e184bbe7 Prepare for publish 2019-01-21 23:06:13 -05:00