Commit 01ec471
committed
fix: implement AES-KW (RFC 3394) for wrapKey/unwrapKey operations
Fixes wrapKey/unwrapKey operations with AES-KW algorithm that were failing
in e2e tests on both iOS and Android.
C++ changes (HybridCipher.cpp):
- Add EVP_CIPHER_CTX_FLAG_WRAP_ALLOW flag for wrap ciphers (required in OpenSSL 3.x)
- Disable padding for AES-KW ciphers
- Add error checking to EVP_CipherUpdate to catch OpenSSL failures
TypeScript changes (subtle.ts):
- Use RFC 3394 default IV (0xa6a6a6a6a6a6a6a6) instead of empty IV
- Fix JWK format padding calculation to account for null terminator
- Add input validation for AES-KW (8-byte alignment, minimum 16 bytes)
- Fix cipher type naming to match Node.js (aes*-wrap)
- Handle null terminator when unwrapping JWK format
All wrapKey/unwrapKey tests now passing.1 parent e2c1c80 commit 01ec471
File tree
4 files changed
+77
-17
lines changed- example/src
- hooks
- tests/subtle
- packages/react-native-quick-crypto
- cpp/cipher
- src
4 files changed
+77
-17
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
31 | | - | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1483 | 1483 | | |
1484 | 1484 | | |
1485 | 1485 | | |
1486 | | - | |
1487 | | - | |
1488 | | - | |
1489 | | - | |
1490 | | - | |
1491 | 1486 | | |
1492 | 1487 | | |
1493 | 1488 | | |
| |||
Lines changed: 17 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
89 | 97 | | |
90 | 98 | | |
91 | 99 | | |
| |||
100 | 108 | | |
101 | 109 | | |
102 | 110 | | |
103 | | - | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
104 | 120 | | |
105 | 121 | | |
106 | 122 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
380 | 380 | | |
381 | 381 | | |
382 | 382 | | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
383 | 401 | | |
384 | 402 | | |
385 | | - | |
386 | | - | |
387 | | - | |
388 | | - | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
389 | 414 | | |
390 | | - | |
391 | | - | |
392 | 415 | | |
393 | 416 | | |
394 | 417 | | |
395 | 418 | | |
396 | 419 | | |
397 | 420 | | |
398 | | - | |
399 | | - | |
| 421 | + | |
| 422 | + | |
400 | 423 | | |
401 | 424 | | |
402 | 425 | | |
| |||
1625 | 1648 | | |
1626 | 1649 | | |
1627 | 1650 | | |
1628 | | - | |
| 1651 | + | |
| 1652 | + | |
| 1653 | + | |
| 1654 | + | |
| 1655 | + | |
| 1656 | + | |
| 1657 | + | |
| 1658 | + | |
| 1659 | + | |
| 1660 | + | |
| 1661 | + | |
| 1662 | + | |
| 1663 | + | |
| 1664 | + | |
1629 | 1665 | | |
1630 | 1666 | | |
1631 | 1667 | | |
| |||
1670 | 1706 | | |
1671 | 1707 | | |
1672 | 1708 | | |
1673 | | - | |
| 1709 | + | |
| 1710 | + | |
| 1711 | + | |
| 1712 | + | |
| 1713 | + | |
| 1714 | + | |
| 1715 | + | |
| 1716 | + | |
| 1717 | + | |
| 1718 | + | |
| 1719 | + | |
| 1720 | + | |
| 1721 | + | |
| 1722 | + | |
1674 | 1723 | | |
1675 | 1724 | | |
1676 | 1725 | | |
| |||
0 commit comments