crypto: fix EdDSA support for KeyObject by mscdex · Pull Request #26319 · nodejs/node · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion doc/api/crypto.md
2 changes: 2 additions & 0 deletions src/env.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ constexpr size_t kFsStatsBufferLength = kFsStatsFieldsNumber * 2;
V(constants_string, "constants") \
V(crypto_dsa_string, "dsa") \
V(crypto_ec_string, "ec") \
V(crypto_ed25519_string, "ed25519") \
V(crypto_ed448_string, "ed448") \
V(crypto_rsa_string, "rsa") \
V(cwd_string, "cwd") \
V(data_string, "data") \
Expand Down
4 changes: 4 additions & 0 deletions src/node_crypto.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3468,6 +3468,10 @@ Local<String> KeyObject::GetAsymmetricKeyType() const {
return env()->crypto_dsa_string();
case EVP_PKEY_EC:
return env()->crypto_ec_string();
case EVP_PKEY_ED25519:
return env()->crypto_ed25519_string();
case EVP_PKEY_ED448:
return env()->crypto_ed448_string();
Comment thread
tniessen marked this conversation as resolved.
Outdated
default:
CHECK(false);
}
Expand Down
3 changes: 3 additions & 0 deletions test/fixtures/test_ed25519_privkey.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-----BEGIN PRIVATE KEY-----
MC4CAQAwBQYDK2VwBCIEIHXLsXm1lsq5HtyqJwQyFmpfEluuf0KOqP6DqMgGxxDL
-----END PRIVATE KEY-----
3 changes: 3 additions & 0 deletions test/fixtures/test_ed25519_pubkey.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-----BEGIN PUBLIC KEY-----
MCowBQYDK2VwAyEAEXRYV3v5ucrHVR3mKqyPXxXqU34lASwc7Y7MoOvaqcs=
-----END PUBLIC KEY-----
4 changes: 4 additions & 0 deletions test/fixtures/test_ed448_privkey.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-----BEGIN PRIVATE KEY-----
MEcCAQAwBQYDK2VxBDsEObxytD95dGN3Hxk7kVk+Lig1rGYTRr3YdaHjRog++Sgk
QD7KwKmxroBURtkE2N0JbQ3ctdrpGRB5DQ==
-----END PRIVATE KEY-----
4 changes: 4 additions & 0 deletions test/fixtures/test_ed448_pubkey.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-----BEGIN PUBLIC KEY-----
MEMwBQYDK2VxAzoAIESY3jnpGdB5UVJDCznrv0vmBFIzgSMu+gafsbCX1rFtsJwR
M6XUDQiEY7dk6rmm/Fktyawna5EA
-----END PUBLIC KEY-----
31 changes: 31 additions & 0 deletions test/parallel/test-crypto-key-objects.js