summaryrefslogtreecommitdiff
path: root/ext/node/polyfills/internal/crypto
AgeCommit message (Collapse)Author
2024-11-19fix(node/crypto): support promisify on generateKeyPair (#26913)Marvin Hagemeister
Calling `promisify(generateKeyPair)` didn't work as expected. It requires a custom promisify implementation. This was easy to fix thanks to the excellent debugging investigation in https://github.com/denoland/deno/issues/26910 Fixes https://github.com/denoland/deno/issues/26910 Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-11-04chore: update dlint to v0.68.0 for internal (#26711)Kenta Moriuchi
2024-10-26fix(ext/node): use primordials in ↵Mayank Kumar
ext\node\polyfills\internal\crypto\_randomInt.ts (#26534) Towards #24236
2024-09-13fix(ext/node): fix Decipheriv when autoPadding disabled (#25598)Yoshiya Hinosawa
This change fixes Decipheriv behavior when autoPadding disabled and enabled. By this change, the example given in https://github.com/denoland/deno/issues/20924#issuecomment-2345931295 works in the same way as Node. closes #20924
2024-09-12feat(ext/node): expose ES modules for _ modules (#25588)Bartek Iwańczuk
Exposes following modules: - `"node:_http_agent"` - `"node:_http_common"` - `"node:_http_outgoing"` - `"node:_http_server"` - `"node:_stream_duplex"` - `"node:_stream_passthrough"` - `"node:_stream_readable"` - `"node:_stream_transform"` - `"node:_stream_writable"` - `"node:_tls_common"` - `"node:_tls_wrap"`
2024-09-11fix(ext/node): fix `Cipheriv#update(string, undefined)` (#25571)Yoshiya Hinosawa
2024-08-28fix(ext/node): import RSA JWK keys (#25267)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/24129
2024-08-28fix(ext/node): export JWK public key (#25239)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/18928 Signed-off-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-08-28fix(ext/node): import EC JWK keys (#25266)Divy Srivastava
2024-08-23fix(ext/node): import JWK octet key pairs (#25180)Divy Srivastava
Ref https://github.com/denoland/deno/issues/24129 `kty: "okp"` is defined in [rfc8037](https://www.rfc-editor.org/rfc/rfc8037.html)
2024-08-12chore: update the copyright of c, mjs, and jsx (#25005)Kenta Moriuchi
2024-08-11fix(ext/node): rewrite X509Certificate resource and add `publicKey()` (#24988)Divy Srivastava
**Changes**: - Remove unsafe usage, rewrite Rust representation with `yoke`. - Implement `X509Certificate.prototype.publicKey()` Fixes https://github.com/denoland/deno/issues/23307
2024-08-11fix(ext/node): support ieee-p1363 ECDSA signatures and pss salt len (#24981)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/22919
2024-08-09fix(ext/node): ed25519 signing and cipheriv autopadding fixes (#24957)Luca Casonato
- Return auth tag for GCM ciphers from auto padding shortcircuit - Use _ring_ for ed25519 signing --------- Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-08-08fix(ext/node): add `CipherIv.setAutoPadding()` (#24940)Divy Srivastava
Co-Authored-By: Luca Casonato <hello@lcas.dev> Fixes https://github.com/denoland/deno/issues/21804 Ref https://github.com/denoland/deno/issues/20924 --------- Signed-off-by: Divy Srivastava <dj.srivastava23@gmail.com> Co-authored-by: Luca Casonato <hello@lcas.dev>
2024-08-08fix(node/crypto): Assign publicKey and privateKey with let instead of const ↵Birk Skyum
(#24943) Because public/private key are reassigned, they should be `let` instead of `const`. Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-08-08fix(ext/node): add crypto.diffieHellman (#24938)Luca Casonato
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com> Closes #21806
2024-08-07feat(ext/node): rewrite crypto keys (#24463)Luca Casonato
This completely rewrites how we handle key material in ext/node. Changes in this PR: - **Signing** - RSA - RSA-PSS 🆕 - DSA 🆕 - EC - ED25519 🆕 - **Verifying** - RSA - RSA-PSS 🆕 - DSA 🆕 - EC 🆕 - ED25519 🆕 - **Private key import** - Passphrase encrypted private keys 🆕 - RSA - PEM - DER (PKCS#1) 🆕 - DER (PKCS#8) 🆕 - RSA-PSS - PEM - DER (PKCS#1) 🆕 - DER (PKCS#8) 🆕 - DSA 🆕 - EC - PEM - DER (SEC1) 🆕 - DER (PKCS#8) 🆕 - X25519 🆕 - ED25519 🆕 - DH - **Public key import** - RSA - PEM - DER (PKCS#1) 🆕 - DER (PKCS#8) 🆕 - RSA-PSS 🆕 - DSA 🆕 - EC 🆕 - X25519 🆕 - ED25519 🆕 - DH 🆕 - **Private key export** - RSA 🆕 - DSA 🆕 - EC 🆕 - X25519 🆕 - ED25519 🆕 - DH 🆕 - **Public key export** - RSA - DSA 🆕 - EC 🆕 - X25519 🆕 - ED25519 🆕 - DH 🆕 - **Key pair generation** - Overhauled, but supported APIs unchanged This PR adds a lot of new individual functionality. But most importantly because of the new key material representation, it is now trivial to add new algorithms (as shown by this PR). Now, when adding a new algorithm, it is also widely supported - for example previously we supported ED25519 key pair generation, but we could not import, export, sign or verify with ED25519. We can now do all of those things.
2024-08-02docs: fix typos (#24820)Andreas Deininger
This PR fixes various typos I spotted in the project.
2024-08-01fix(ext/crypto): respect offsets when writing into ab views in ↵Luca Casonato
randomFillSync (#24816)
2024-07-05fix(ext/node): rewrite digest handling (#24392)Luca Casonato
Previously we had many different code paths all handling digests in different places, all with wildly different digest support. This commit rewrites this to use a single digest handling mechanism for all digest operations. It adds various aliases for digest algorithms, like node does. For example `sha1WithRSAEncryption` is an alias for `sha1`. It also adds support for `md5-sha1` digests in various places.
2024-07-02fix(ext/node): add Symbol.toStringTag to KeyObject instances (#24377)Filip Skokan
As per https://github.com/nodejs/node/pull/46043, this adds Symbol.toStringTag getter to KeyObject.
2024-06-24fix(ext/node): rewrite crypto.Hash (#24302)Luca Casonato
Changes in this PR: - Added new fixed size hash algorithms (blake2b512, blake2s256, sha512-224, sha512-256, sha3-224, sha3-256, sha3-384, sha3-512, sm3) - Added variable size hash algorithms (the concept), with the algorithms shake128 and shake256 - Use cppgc instead of resources for the hasher - Enable Node's crypto.Hash tests and fix found bugs
2024-04-29fix(ext/node): exporting rsa public keys (#23596)Divy Srivastava
Initial support for exporting rsa public KeyObject. Current assumption is that RSA keys are stored in pkcs1 der format in key storage. Ref https://github.com/denoland/deno/issues/23471 Ref https://github.com/denoland/deno/issues/18928 Ref https://github.com/denoland/deno/issues/21124
2024-03-22fix(ext/node): handle KeyObject in `prepareAsymmetricKey` (#23026)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/20938
2024-03-21fix(ext/node): ECDH.publicKey() point encoding (#23013)Divy Srivastava
2024-03-18fix(ext/node): support public key point encoding in ECDH.generateKeys() (#22976)Satya Rohith
Towards https://github.com/denoland/deno/issues/22921 Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-03-14fix(ext/node): support `spki` format in createPublicKey (#22918)Divy Srivastava
2024-03-14fix(ext/node): crypto.getCipherInfo() (#22916)Divy Srivastava
Stub implementation of getCipherInfo(). Good enough for most cases. Note: We do not support all OpenSSL ciphers (likely never will) Fixes https://github.com/denoland/deno/issues/21805
2024-03-13fix(ext/node): initial `crypto.createPublicKey()` support (#22509)Asher Gomez
Closes #21807 Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-01-29refactor: Use virtul ops module (#22175)Bartek Iwańczuk
Follow up to #22157. This leaves us with 4 usages of `ensureFastOps()` in `deno` itself. There's also about 150 usages of `Deno.core.ops.<op_name>` left as well.
2024-01-29refactor: migrate 'ext/node' extension to virtual ops module (#22157)Bartek Iwańczuk
Follow up to https://github.com/denoland/deno/pull/22135
2024-01-10refactor: use `core.ensureFastOps()` (#21888)Kenta Moriuchi
2024-01-01chore: update copyright to 2024 (#21753)David Sherret
2023-12-27perf: remove opAsync (#21690)Matt Mastracci
`opAsync` requires a lookup by name on each async call. This is a mechanical translation of all opAsync calls to ensureFastOps. The `opAsync` API on Deno.core will be removed at a later time.
2023-12-07refactor: pull 'core', 'internals', 'primordials' from ES module (#21462)Bartek Iwańczuk
This commit refactors how we access "core", "internals" and "primordials" objects coming from `deno_core`, in our internal JavaScript code. Instead of capturing them from "globalThis.__bootstrap" namespace, we import them from recently added "ext:core/mod.js" file.
2023-12-03fix(ext/node): sign with PEM private keys (#21287)Divy Srivastava
Add support for signing with a RSA PEM private key: `pkcs8` and `pkcs1`. Fixes https://github.com/denoland/deno/issues/18972 Ref #21124 Verified fix with `npm:sshpk`. Unverfied but fixes `npm:google-auth-library`, `npm:web-push` & `oracle/oci-typescript-sdk` --------- Signed-off-by: Divy Srivastava <dj.srivastava23@gmail.com>
2023-11-09fix(node): implement createPrivateKey (#20981)Divy Srivastava
Towards #18455
2023-09-23fix(node): supported arguments to `randomFillSync` (#20637)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/20634
2023-09-07feat: support import attributes (#20342)David Sherret
2023-09-06fix(ext/node): implement AES GCM cipher (#20368)Divy Srivastava
Adds support for AES-GCM 128/256 bit keys in `node:crypto` and `setAAD()`, `setAuthTag()` and `getAuthTag()` Uses https://github.com/littledivy/aead-gcm-stream Fixes https://github.com/denoland/deno/issues/19836 https://github.com/denoland/deno/issues/20353
2023-08-26fix(node): propagate create cipher errors (#20280)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/19002
2023-08-11fix(node): object keys in publicEncrypt (#20128)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/19935
2023-07-02refactor: rename built-in node modules from ext:deno_node/ to node: (#19680)Bartek Iwańczuk
Closes https://github.com/denoland/deno/issues/19510
2023-06-27chore(ext/node): disable prefer-primordials on a per-file basis (#19553)Kenta Moriuchi
2023-06-27test(ext/node): port crypto_test.ts from deno_std (#19561)Felipe Baltor
2023-06-23fix(serde_v8): Do not coerce values in serde_v8 (#19569)Divy Srivastava
Fixes #19568 Values are not coerced to the desired type during deserialisation. This makes serde_v8 stricter. --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-06-06refactor(core): ensureFastOps is an op-generating proxy (#19377)Matt Mastracci
Startup benchmark shows no changes (within 1ms, identical system/user times).
2023-05-16feat(node/crypto): Builtin Diffie-Hellman Groups (#19137)Levente Kurusa
Towards #18455
2023-05-15feat(node/crypto): Diffie Hellman Support (#18943)Levente Kurusa
Support crypto.DiffieHellman class in ext/node/crypto