Commit graph

59 commits

Author SHA1 Message Date
Divy Srivastava bfd5f1598c
feat(ext/crypto): initial support for p521 in generateKey and importKey (#21815)
Part 1 of a potential 3 part series. Ref #13449 

The current implementation passes key material back and forth RustCrypto
group of crates and ring. ring does not implement p521 yet.

This PR adds support for P521 named curve in `generateKey` and
`importKey` where we use RustCrypto. Other parts should be moved over to
the RustGroup group of crates for consistency.
2024-01-06 16:48:31 +05:30
David Sherret 7e72f3af61
chore: update copyright to 2024 (#21753) 2024-01-01 19:58:21 +00:00
Filip Skokan 7d13d65468
fix(ext/crypto): correctly limit ECDSA and hash algorithms (#18030)
Closes #18029
2023-03-05 12:34:07 +00:00
Yiyu Lin a00e432297
chore: add copyright_checker tool and add the missing copyright (#17285) 2023-01-13 16:51:32 +09:00
Filip Skokan ec09134d8a
fix(ext/crypto): fix HMAC jwk import "use" check (#16465) 2022-10-28 19:50:38 +05:30
Filip Skokan b2d0f6e913
test(crypto): update crypto.getRandomValues calls (#16338)
[`crypto.getRandomValues`](https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues)
does not return a Promise.
2022-10-18 14:00:26 +02:00
Filip Skokan 225d516466
fix(ext/crypto): correct HMAC get key length op (#16201)
fixes #16180

`HMAC`'s `get key length` `op` uses the hash function's block size, not
output size.

refs
https://github.com/cloudflare/workerd/issues/68#issuecomment-1271189657
2022-10-15 10:53:35 +05:30
Filip Skokan 0d042d8e54
fix(ext/crypto): interoperable import/export (#16153)
This PR updates RSA key import/export to a state which is interoperable
with other implementations.

For RSA the only OID in and out is `rsaEncryption`.
For EC the only OID in and out is `id-ecpublickey` (fixed in #16152).

see https://github.com/w3c/webcrypto/issues/307#issuecomment-995813032
see https://github.com/w3c/webcrypto/issues/307
see https://github.com/w3c/webcrypto/pull/305
see https://github.com/nodejs/node/pull/42816
2022-10-04 17:37:59 +05:30
Filip Skokan aa710aac98
fix(ext/crypto): ecdh spki key import/export roundtrip (#16152) 2022-10-04 17:09:41 +05:30
Aurélien Bertron 8d20784f7a
fix(ext/crypto): deriveBits for ECDH not taking length into account (#16128)
Fixes #16047
2022-10-03 23:10:34 -07:00
李瑞丰 b3444e0d3b
fix(ext/crypto): fix importKey error when leading zeroes (#16009)
Co-authored-by: Jason <m.jason.liu@outlook.com>
2022-10-03 09:37:25 +05:30
diachedelic 2843160fc7
feat(ext/crypto): deriveBits P-384 (#15138)
This commit adds P-384 curve support for crypto.subtle.deriveBits.

Co-authored-by: James Diacono <james@diacono.com.au>
2022-07-23 22:34:37 +05:30
diachedelic ff5def9ed5
feat(ext/crypto): export elliptic keys as "raw" (#14764)
This commit adds support for the "raw" format when exporting public ECDH/ECDSA keys via
the SubtleCrypto.exportKey method.
2022-06-08 08:29:42 +05:30
EduM22 181e378032
fix(ext/crypto): check extractable in exportKey (#14222) 2022-04-07 18:28:56 +05:30
Filip Skokan f9b4d262b3
fix(ext/crypto): handle JWK import with "use" (#13912) 2022-03-11 20:26:16 +05:30
Divy Srivastava a5957f46ee
chore(ext/crypto): remove old todos (#13887) 2022-03-09 18:13:11 +05:30
Divy Srivastava 8b2989c417
feat(ext/crypto): AES-GCM support for 128bit IVs (#13805) 2022-03-02 10:56:10 +05:30
Divy Srivastava 77a9683425
fix(ext/crypto): optional additionalData in encrypt/decrypt (#13669) 2022-02-16 16:27:14 +05:30
Divy Srivastava e218d567d5
fix(ext/crypto): support EC p256 private key material in exportKey (#13547)
Co-authored-by: Luca Casonato <hello@lcas.dev>
2022-02-08 18:48:28 +05:30
Divy Srivastava efa02ffa2a
fix(ext/crypto): enforce 128bits tagLength for AES-GCM decryption (#13536) 2022-01-30 18:42:29 +05:30
Sean Michael Wykes 9139985180
feat(ext/crypto): implement pkcs8/JWK for P-384 curves (#13154) 2022-01-19 12:14:35 +05:30
Sean Michael Wykes 77e58fe7f9
feat(ext/crypto): implement pkcs8/spki/jwk exportKey for ECDSA and ECDH (#13104) 2022-01-19 09:08:35 +05:30
Divy Srivastava 919ded1a0b
feat(ext/crypto): implement AES-GCM decryption (#13319) 2022-01-14 14:18:53 +05:30
Sean Michael Wykes 91f6c5fc7e
feat(ext/crypto): implement AES-KW for wrapKey/unwrapKey (#13286) 2022-01-11 10:14:47 +05:30
Divy Srivastava c74eb7a889
feat(ext/crypto): implement AES-GCM encryption (#13119) 2022-01-05 20:42:30 +05:30
Sean Michael Wykes c4a0a43ce8
fix(ext/crypto) - exportKey JWK for AES/HMAC must use base64url (#13264)
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2022-01-05 01:00:37 +01:00
Sean Michael Wykes 340764adec
fix(ext/crypto): use forgiving base64 encoding for JWK (#13240)
Implements "forgiving" in JWK decode passing suitable config to base64::decode_config
2022-01-03 17:54:45 +05:30
Sean Michael Wykes 9a42d65fc7
feat(ext/crypto): support AES-CTR encrypt/decrypt (#13177)
Fixes #13201.
2022-01-03 12:27:28 +01:00
Sean Michael Wykes 60faf7a0ed
feat(ext/crypto): support importing ECSDA and ECDH (#13088)
Co-authored-by: Luca Casonato <hello@lcas.dev>
2021-12-16 17:28:43 +01:00
Luca Casonato b220a58d1a
feat(ext/crypto): support exporting RSA JWKs (#13081)
This commit adds support for exporting RSA JWKs in the Web Crypto API.
It also does some minor fixes for RSA JWK imports.

Co-authored-by: Sean Michael Wykes <sean.wykes@nascent.com.br>
2021-12-14 17:02:14 +01:00
Luca Casonato 6f8f1cc244
tests: deflake crypto InvalidIntializationVector (#13040)
Use fixed data that is known to error as the test intends.
2021-12-10 11:47:21 +01:00
Divy Srivastava d31378726e
feat(ext/crypto): implement unwrapKey (#12539) 2021-12-05 04:55:11 +01:00
Bartek Iwańczuk 1193d46485
tests: add 'await' to all invocations of 'assertRejects' (#12893) 2021-11-25 02:23:03 +01:00
Bartek Iwańczuk bedb2adfb0
refactor: remove "unitTest" wrapper from cli/tests/unit (#12750) 2021-11-23 17:45:18 +01:00
Luca Casonato 71ceca0ffc
fix(ext/crypto): don't panic on decryption failure (#12840) 2021-11-22 23:58:21 +01:00
upendra1997 e00bfecf96
fix(crypto): handling large key length in HKDF (#12692) 2021-11-11 10:04:17 +01:00
Divy Srivastava 58f04d8e46
feat(ext/crypto): implement deriveKey (#12117) 2021-10-12 16:09:46 +05:30
Divy Srivastava 3b2cb8e711
feat(ext/crypto): implement AES-CBC encryption & decryption (#12123)
* initial stuff

* stuff

* merge stuff

* cleanup

* fmt

* length

* update lockfile

* decrypt

* fixy

* clippy hello?

* hmm

* fixs

* fix lint

* add AesCbcParams

* fixes

* fixy

* lockfile fixy

* fix dumb assertions

* re run CI

* rerun CI

* rerun CI
2021-10-11 16:37:51 +02:00
Divy Srivastava a5d3c8b06c
feat(ext/crypto): implement deriveBits for ECDH (p256) (#11873) 2021-10-08 17:29:36 +02:00
Divy Srivastava 3aa8591595
feat(ext/crypto): export spki for RSA (#12114) 2021-10-06 11:18:12 +02:00
Divy Srivastava 8884141c3f
fix(ext/crypto): missing Aes key typings (#12307) 2021-10-03 15:24:46 +02:00
Divy Srivastava 5065c7bcd9
feat(ext/crypto): implement wrapKey (#12125) 2021-10-01 11:39:49 +02:00
Divy Srivastava c0b6c0eea5
fix(ext/crypto): decode id-RSASSA-PSS with default params (#12147) 2021-10-01 11:14:16 +02:00
Casper Beyer 830586d242
test(cli): align unit test permissions with runtime test permissions (#12189) 2021-09-23 01:50:50 +02:00
Casper Beyer 20692f3e84
chore: replace calls to assertThrowsAsync with assertRejects (#12176) 2021-09-22 09:21:11 -04:00
Divy Srivastava 9270cad67c
fix(ext/crypto): don't use core.decode for encoding jwk keys (#12088) 2021-09-16 09:12:38 +02:00
Divy Srivastava c41460ecc4
feat(ext/crypto): import RSA pkcs#8 keys (#11891) 2021-09-14 15:21:20 +02:00
Divy Srivastava 2199bdaf64
feat(ext/crypto): export RSA keys as pkcs#8 (#11880) 2021-09-13 11:33:28 +02:00
Divy Srivastava 0520ae62dd
fix(ext/crypto): add HkdfParams and Pkdf2Params types (#11991) 2021-09-12 23:02:49 +02:00
Divy Srivastava 40c63d1255
feat(ext/crypto): verify ECDSA signatures (#11739) 2021-09-11 16:49:53 -04:00