Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(node): implement createPrivateKey #20981

Merged
merged 14 commits into from
Nov 9, 2023

Conversation

littledivy
Copy link
Member

Towards #18455

@littledivy littledivy marked this pull request as ready for review November 4, 2023 11:56
@littledivy littledivy changed the title fix(node): implement createPrivateKey (PEM) fix(node): implement createPrivateKey Nov 4, 2023
@@ -202,3 +203,28 @@ for (const primeLength of [1024, 2048, 4096]) {
},
});
}

const rsaPrivateKey = Deno.readTextFileSync(
new URL("../testdata/rsa_private.pem", import.meta.url),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be import.meta.resolve("../testdata/rsa_private.pem");

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deno.readTextFileSync does not support the file:// scheme

// openssl ecparam -name secp256r1 -genkey -noout -out a.pem
// openssl pkcs8 -topk8 -nocrypt -in a.pem -out b.pem
const ecPrivateKey = Deno.readTextFileSync(
new URL("./ec_private_secp256r1.pem", import.meta.url),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed offline, we'll enable more native tests once KeyObject support in sign and verify is added (in a follow up).

ext/node/ops/crypto/mod.rs Show resolved Hide resolved
}

export(_options: unknown) {
notImplemented("crypto.PrivateKeyObject.prototype.export");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you open an issue about missing support for PrivateKeyObject.export?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@littledivy littledivy merged commit c4029f6 into denoland:main Nov 9, 2023
13 checks passed
@littledivy littledivy deleted the node-crypto-createPrivateKey branch November 9, 2023 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants