Skip to content

Commit 82cf5be

Browse files
authored
feat: add AES-OCB to WebCrypto subtle API (#915)
1 parent 1e10f9b commit 82cf5be

11 files changed

Lines changed: 546 additions & 89 deletions

File tree

.docs/implementation-coverage.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ These ciphers are **not available in Node.js** but are provided by RNQC via libs
286286
| `AES-CTR` ||
287287
| `AES-CBC` ||
288288
| `AES-GCM` ||
289+
| `AES-OCB` ||
289290
| `ChaCha20-Poly1305` ||
290291

291292
## `subtle.deriveBits`
@@ -325,7 +326,7 @@ These ciphers are **not available in Node.js** but are provided by RNQC via libs
325326
| `AES-CTR` ||
326327
| `AES-CBC` ||
327328
| `AES-GCM` ||
328-
| `AES-OCB` | |
329+
| `AES-OCB` | |
329330
| `ChaCha20-Poly1305` ||
330331
| `RSA-OAEP` ||
331332

@@ -336,7 +337,7 @@ These ciphers are **not available in Node.js** but are provided by RNQC via libs
336337
| `AES-CTR` | | |||| | |
337338
| `AES-GCM` | | |||| | |
338339
| `AES-KW` | | |||| | |
339-
| `AES-OCB` | | | | | | | |
340+
| `AES-OCB` | | | | | | | |
340341
| `ChaCha20-Poly1305` | | || || | |
341342
| `ECDH` ||||| || |
342343
| `ECDSA` ||||| || |
@@ -385,7 +386,7 @@ These ciphers are **not available in Node.js** but are provided by RNQC via libs
385386
| `AES-CBC` ||
386387
| `AES-GCM` ||
387388
| `AES-KW` ||
388-
| `AES-OCB` | |
389+
| `AES-OCB` | |
389390
| `ChaCha20-Poly1305` ||
390391
| `HMAC` ||
391392

@@ -396,7 +397,7 @@ These ciphers are **not available in Node.js** but are provided by RNQC via libs
396397
| `AES-CTR` | | |||| | |
397398
| `AES-GCM` | | |||| | |
398399
| `AES-KW` | | |||| | |
399-
| `AES-OCB` | | | | | | | |
400+
| `AES-OCB` | | | | | | | |
400401
| `ChaCha20-Poly1305` | | || || | |
401402
| `ECDH` ||||| || |
402403
| `ECDSA` ||||| || |
@@ -439,7 +440,7 @@ These ciphers are **not available in Node.js** but are provided by RNQC via libs
439440
| `AES-CTR` ||
440441
| `AES-GCM` ||
441442
| `AES-KW` ||
442-
| `AES-OCB` | |
443+
| `AES-OCB` | |
443444
| `ChaCha20-Poly1305` ||
444445
| `RSA-OAEP` ||
445446

@@ -450,7 +451,7 @@ These ciphers are **not available in Node.js** but are provided by RNQC via libs
450451
| `AES-CTR` ||
451452
| `AES-GCM` ||
452453
| `AES-KW` ||
453-
| `AES-OCB` | |
454+
| `AES-OCB` | |
454455
| `ChaCha20-Poly1305` ||
455456
| `ECDH` ||
456457
| `ECDSA` ||
@@ -491,6 +492,6 @@ These ciphers are **not available in Node.js** but are provided by RNQC via libs
491492
| `AES-CTR` ||
492493
| `AES-GCM` ||
493494
| `AES-KW` ||
494-
| `AES-OCB` | |
495+
| `AES-OCB` | |
495496
| `ChaCha20-Poly1305` ||
496497
| `RSA-OAEP` ||

README.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,15 @@
1010

1111
A fast implementation of Node's `crypto` module.
1212

13-
> Note: This version `1.x` completed a major refactor, porting to OpenSSL 3.6+, New Architecture, Bridgeless, and [`Nitro Modules`](https://github.com/mrousavy/react-native-nitro). It should be at or above feature-parity compared to the `0.x` version. Status, as always, will be represented in [implementation-coverage.md](./.docs/implementation-coverage.md).
14-
15-
> Note: Minimum supported version of React Native is `0.75`. If you need to use earlier versions, please use `0.x` versions of this library.
16-
1713
## Features
1814

1915
Unlike any other current JS-based polyfills, react-native-quick-crypto is written in C/C++ JSI and provides much greater performance - especially on mobile devices.
20-
QuickCrypto can be used as a drop-in replacement for your Web3/Crypto apps to speed up common cryptography functions.
16+
QuickCrypto can be used as a drop-in replacement for your Web3/Crypto apps or CRDT-based local first databases to speed up common cryptography functions.
2117

22-
- 🏎️ Up to 58x faster than all other solutions
23-
- ⚡️ Lightning fast implementation with pure C++ and JSI, instead of JS
18+
- 🏎️ Hundreds of times faster than all JS-based solutions
19+
- ⚡️ Lightning fast implementation with Nitro Modules (pure C++ and JSI) instead of JS
2420
- 🧪 Well tested in JS and C++ (OpenSSL)
25-
- 💰 Made for crypto apps and Wallets
21+
- 💰 Made for crypto apps and wallets
2622
- 🔢 Secure native compiled cryptography
2723
- 🔁 Easy drop-in replacement for [crypto-browserify](https://github.com/browserify/crypto-browserify) or [react-native-crypto](https://github.com/tradle/react-native-crypto)
2824

@@ -33,6 +29,8 @@ QuickCrypto can be used as a drop-in replacement for your Web3/Crypto apps to sp
3329
| `1.x` | new [->](https://github.com/reactwg/react-native-new-architecture/blob/main/docs/enable-apps.md) | Nitro Modules [->](https://github.com/mrousavy/nitro) |
3430
| `0.x` | old, new 🤞 | Bridge & JSI |
3531

32+
> Note: Minimum supported version of React Native is `0.75`. If you need to use earlier versions, please use `0.x` versions of this library.
33+
3634
## Migration
3735

3836
Our goal in refactoring to v1.0 was to maintain API compatibility. If you are upgrading to v1.0 from v0.x, and find any discrepancies, please open an issue in this repo.
@@ -55,7 +53,13 @@ cd ios && pod install
5553
```
5654

5755
<h3>
58-
Expo  <a href="#"><img src="./.docs/img/expo.png" height="12" /></a>
56+
Expo  <a href="#">
57+
<picture>
58+
<source media="(prefers-color-scheme: dark)" srcset="./.docs/img/expo/dark.png" />
59+
<source media="(prefers-color-scheme: light)" srcset="./.docs/img/expo/light.png" />
60+
<img alt="Expo" src="./.docs/img/expo/light.png" height="12" />
61+
</picture>
62+
</a>
5963
</h3>
6064

6165
```sh

docs/data/coverage.ts

Lines changed: 28 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ export const COVERAGE_DATA: CoverageCategory[] = [
204204
{ name: 'generatePrime', status: 'missing' },
205205
{ name: 'getCipherInfo', status: 'missing' },
206206
{ name: 'getCiphers', status: 'implemented' },
207-
{ name: 'getCurves', status: 'missing' },
207+
{ name: 'getCurves', status: 'implemented' },
208208
{ name: 'getDiffieHellman', status: 'implemented' },
209209
{ name: 'getFips', status: 'missing' },
210210
{ name: 'getHashes', status: 'implemented' },
@@ -268,6 +268,7 @@ export const COVERAGE_DATA: CoverageCategory[] = [
268268
{ name: 'AES-CTR', status: 'implemented' },
269269
{ name: 'AES-CBC', status: 'implemented' },
270270
{ name: 'AES-GCM', status: 'implemented' },
271+
{ name: 'AES-OCB', status: 'implemented' },
271272
{ name: 'ChaCha20-Poly1305', status: 'implemented' },
272273
],
273274
},
@@ -311,24 +312,20 @@ export const COVERAGE_DATA: CoverageCategory[] = [
311312
{ name: 'AES-CTR', status: 'implemented' },
312313
{ name: 'AES-CBC', status: 'implemented' },
313314
{ name: 'AES-GCM', status: 'implemented' },
314-
{ name: 'AES-OCB', status: 'missing' },
315+
{ name: 'AES-OCB', status: 'implemented' },
315316
{ name: 'ChaCha20-Poly1305', status: 'implemented' },
316317
{ name: 'RSA-OAEP', status: 'implemented' },
317318
],
318319
},
319320
{
320321
name: 'crypto.subtle.exportKey',
321322
subItems: [
322-
{ name: 'AES-CBC', status: 'partial', note: 'jwk, raw' },
323-
{ name: 'AES-CTR', status: 'partial', note: 'jwk, raw, raw-secret' },
324-
{ name: 'AES-GCM', status: 'partial', note: 'jwk, raw, raw-secret' },
325-
{ name: 'AES-KW', status: 'partial', note: 'jwk, raw, raw-secret' },
326-
{ name: 'AES-OCB', status: 'missing', note: 'Not implemented' },
327-
{
328-
name: 'ChaCha20-Poly1305',
329-
status: 'partial',
330-
note: 'jwk, raw',
331-
},
323+
{ name: 'AES-CBC', status: 'implemented' },
324+
{ name: 'AES-CTR', status: 'implemented' },
325+
{ name: 'AES-GCM', status: 'implemented' },
326+
{ name: 'AES-KW', status: 'implemented' },
327+
{ name: 'AES-OCB', status: 'implemented' },
328+
{ name: 'ChaCha20-Poly1305', status: 'implemented' },
332329
{
333330
name: 'ECDH',
334331
status: 'partial',
@@ -341,7 +338,7 @@ export const COVERAGE_DATA: CoverageCategory[] = [
341338
},
342339
{ name: 'Ed25519', status: 'partial', note: 'spki, pkcs8, raw, jwk' },
343340
{ name: 'Ed448', status: 'partial', note: 'spki, pkcs8, raw, jwk' },
344-
{ name: 'HMAC', status: 'partial', note: 'jwk, raw, raw-secret' },
341+
{ name: 'HMAC', status: 'implemented' },
345342
{
346343
name: 'ML-DSA-44',
347344
status: 'partial',
@@ -391,20 +388,20 @@ export const COVERAGE_DATA: CoverageCategory[] = [
391388
{ name: 'AES-CBC', status: 'implemented' },
392389
{ name: 'AES-GCM', status: 'implemented' },
393390
{ name: 'AES-KW', status: 'implemented' },
394-
{ name: 'AES-OCB', status: 'missing' },
391+
{ name: 'AES-OCB', status: 'implemented' },
395392
{ name: 'ChaCha20-Poly1305', status: 'implemented' },
396393
{ name: 'HMAC', status: 'implemented' },
397394
],
398395
},
399396
{
400397
name: 'crypto.subtle.importKey',
401398
subItems: [
402-
{ name: 'AES-CBC', status: 'partial', note: 'jwk, raw, raw-secret' },
403-
{ name: 'AES-CTR', status: 'partial', note: 'jwk, raw, raw-secret' },
404-
{ name: 'AES-GCM', status: 'partial', note: 'jwk, raw, raw-secret' },
405-
{ name: 'AES-KW', status: 'partial', note: 'jwk, raw, raw-secret' },
406-
{ name: 'AES-OCB', status: 'missing' },
407-
{ name: 'ChaCha20-Poly1305', status: 'partial', note: 'jwk, raw' },
399+
{ name: 'AES-CBC', status: 'implemented' },
400+
{ name: 'AES-CTR', status: 'implemented' },
401+
{ name: 'AES-GCM', status: 'implemented' },
402+
{ name: 'AES-KW', status: 'implemented' },
403+
{ name: 'AES-OCB', status: 'implemented' },
404+
{ name: 'ChaCha20-Poly1305', status: 'implemented' },
408405
{
409406
name: 'ECDH',
410407
status: 'partial',
@@ -417,8 +414,8 @@ export const COVERAGE_DATA: CoverageCategory[] = [
417414
},
418415
{ name: 'Ed25519', status: 'partial', note: 'spki, pkcs8, raw, jwk' },
419416
{ name: 'Ed448', status: 'partial', note: 'spki, pkcs8, raw, jwk' },
420-
{ name: 'HKDF', status: 'partial', note: 'raw' },
421-
{ name: 'HMAC', status: 'partial', note: 'jwk, raw, raw-secret' },
417+
{ name: 'HKDF', status: 'implemented' },
418+
{ name: 'HMAC', status: 'implemented' },
422419
{
423420
name: 'ML-DSA-44',
424421
status: 'partial',
@@ -437,7 +434,7 @@ export const COVERAGE_DATA: CoverageCategory[] = [
437434
{ name: 'ML-KEM-512', status: 'missing' },
438435
{ name: 'ML-KEM-768', status: 'missing' },
439436
{ name: 'ML-KEM-1024', status: 'missing' },
440-
{ name: 'PBKDF2', status: 'partial', note: 'raw, raw-secret' },
437+
{ name: 'PBKDF2', status: 'implemented' },
441438
{ name: 'RSA-OAEP', status: 'partial', note: 'spki, pkcs8, jwk' },
442439
{ name: 'RSA-PSS', status: 'partial', note: 'spki, pkcs8, jwk' },
443440
{
@@ -477,10 +474,10 @@ export const COVERAGE_DATA: CoverageCategory[] = [
477474
{ name: 'AES-GCM (Wraps)', status: 'implemented' },
478475
{ name: 'AES-KW (Wraps)', status: 'implemented' },
479476
{ name: 'ChaCha20-Poly1305 (Wraps)', status: 'implemented' },
480-
{ name: 'AES-CBC (Wraps)', status: 'missing' },
481-
{ name: 'AES-CTR (Wraps)', status: 'missing' },
482-
{ name: 'AES-OCB (Wraps)', status: 'missing' },
483-
{ name: 'RSA-OAEP (Wraps)', status: 'missing' },
477+
{ name: 'AES-CBC (Wraps)', status: 'implemented' },
478+
{ name: 'AES-CTR (Wraps)', status: 'implemented' },
479+
{ name: 'AES-OCB (Wraps)', status: 'implemented' },
480+
{ name: 'RSA-OAEP (Wraps)', status: 'implemented' },
484481
],
485482
},
486483
{
@@ -503,10 +500,10 @@ export const COVERAGE_DATA: CoverageCategory[] = [
503500
{ name: 'AES-GCM', status: 'implemented' },
504501
{ name: 'AES-KW', status: 'implemented' },
505502
{ name: 'ChaCha20-Poly1305', status: 'implemented' },
506-
{ name: 'AES-CBC', status: 'missing' },
507-
{ name: 'AES-CTR', status: 'missing' },
508-
{ name: 'AES-OCB', status: 'missing' },
509-
{ name: 'RSA-OAEP', status: 'missing' },
503+
{ name: 'AES-CBC', status: 'implemented' },
504+
{ name: 'AES-CTR', status: 'implemented' },
505+
{ name: 'AES-OCB', status: 'implemented' },
506+
{ name: 'RSA-OAEP', status: 'implemented' },
510507
],
511508
},
512509
],

example/ios/Podfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2811,7 +2811,7 @@ SPEC CHECKSUMS:
28112811
MMKVCore: f2dd4c9befea04277a55e84e7812f930537993df
28122812
NitroMmkv: afbc5b2fbf963be567c6c545aa1efcf6a9cec68e
28132813
NitroModules: 11bba9d065af151eae51e38a6425e04c3b223ff3
2814-
QuickCrypto: e6f07c200580a5958c7233dbfed34e6df99b3891
2814+
QuickCrypto: 81462f9689f9ba8a6a34d0283dcfac94a958c719
28152815
RCT-Folly: 846fda9475e61ec7bcbf8a3fe81edfcaeb090669
28162816
RCTDeprecation: c4b9e2fd0ab200e3af72b013ed6113187c607077
28172817
RCTRequired: e97dd5dafc1db8094e63bc5031e0371f092ae92a

0 commit comments

Comments
 (0)