Commit 0107af7
authored
[PM-28845] Add PureCrypto functions to replace webcrypto RSA entirely (#592)
## 🎟️ Tracking
<!-- Paste the link to the Jira or GitHub issue or otherwise describe /
point to where this change is coming from. -->
bitwarden/clients#17742
https://bitwarden.atlassian.net/browse/PM-28845
## 📔 Objective
<!-- Describe what the purpose of this PR is, for example what bug
you're fixing or new feature you're adding. -->
Preparing to nuke webcrypto's RSA implementation out of orbit. It is
unreliable and we have reproduced around 50% of all private keys keys
are generated by rustcrypto that are not parseable on webcrypto on
Safari (but parseable on chrome / firefox). It is unclear why, most
likely safari has some stricter condition for the keys (RSA ASN1 has
many conditions that may apply here), or has a bug. We also suspect keys
generated on old Xamarin PCLCrypto to be parseable by rust, or at least
deliver good error messages on rust, but be unparseable on all of
webcrypto. This changes the functions to be exactly the same as
webcrypto so that they can be dropped in without refactoring anything
else.
Note: Usually, implementing crypto directly in the wasm crate would not
be a good idea, *however* is is justifiable here because we DO NOT WANT
these to be public functions consumeable by any other crate, so they do
not belong in the crypto crate. They are also only used by the wasm
clients.
## 🚨 Breaking Changes
<!-- Does this PR introduce any breaking changes? If so, please describe
the impact and migration path for clients.
If you're unsure, the automated TypeScript compatibility check will run
when you open/update this PR and provide feedback.
For breaking changes:
1. Describe what changed in the client interface
2. Explain why the change was necessary
3. Provide migration steps for client developers
4. Link to any paired client PRs if needed
Otherwise, you can remove this section. -->
## ⏰ Reminders before review
- Contributor guidelines followed
- All formatters and local linters executed and passed
- Written new unit and / or integration tests where applicable
- Protected functional changes with optionality (feature flags)
- Used internationalization (i18n) for all UI strings
- CI builds passed
- Communicated to DevOps any deployment requirements
- Updated any necessary documentation (Confluence, contributing docs) or
informed the documentation
team
## 🦮 Reviewer guidelines
<!-- Suggested interactions but feel free to use (or not) as you desire!
-->
- 👍 (`:+1:`) or similar for great changes
- 📝 (`:memo:`) or ℹ️ (`:information_source:`) for notes or general info
- ❓ (`:question:`) for questions
- 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry
that's not quite a confirmed
issue and could potentially benefit from discussion
- 🎨 (`:art:`) for suggestions / improvements
- ❌ (`:x:`) or 1 parent 868dace commit 0107af7
File tree
3 files changed
+83
-24
lines changed- crates/bitwarden-wasm-internal
- src
3 files changed
+83
-24
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
| 37 | + | |
36 | 38 | | |
| 39 | + | |
37 | 40 | | |
38 | 41 | | |
39 | 42 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | | - | |
| 10 | + | |
| 11 | + | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
13 | 18 | | |
14 | 19 | | |
15 | 20 | | |
| |||
319 | 324 | | |
320 | 325 | | |
321 | 326 | | |
322 | | - | |
323 | | - | |
324 | | - | |
325 | | - | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
334 | 332 | | |
335 | | - | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
336 | 370 | | |
337 | 371 | | |
338 | 372 | | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
339 | 382 | | |
340 | 383 | | |
341 | 384 | | |
| |||
697 | 740 | | |
698 | 741 | | |
699 | 742 | | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
700 | 753 | | |
0 commit comments