From 1f2de2fbe1322ace8b5cbcbd276946a721160e37 Mon Sep 17 00:00:00 2001 From: Alex Aubuchon Date: Tue, 28 May 2019 11:39:24 -0700 Subject: [PATCH] test: move ed25519 keypair to fixtures/keys/ PR-URL: https://github.com/nodejs/node/pull/27962 Reviewed-By: Sam Roberts Reviewed-By: Ujjwal Sharma Reviewed-By: Rich Trott --- test/fixtures/keys/.gitattributes | 4 ++++ test/fixtures/keys/Makefile | 8 ++++++++ test/fixtures/keys/ed25519_private.pem | 3 +++ test/fixtures/keys/ed25519_public.pem | 3 +++ test/fixtures/test_ed25519_privkey.pem | 3 --- test/fixtures/test_ed25519_pubkey.pem | 3 --- test/parallel/test-crypto-key-objects.js | 4 ++-- test/parallel/test-crypto-sign-verify.js | 4 ++-- 8 files changed, 22 insertions(+), 10 deletions(-) create mode 100644 test/fixtures/keys/.gitattributes create mode 100644 test/fixtures/keys/ed25519_private.pem create mode 100644 test/fixtures/keys/ed25519_public.pem delete mode 100644 test/fixtures/test_ed25519_privkey.pem delete mode 100644 test/fixtures/test_ed25519_pubkey.pem diff --git a/test/fixtures/keys/.gitattributes b/test/fixtures/keys/.gitattributes new file mode 100644 index 00000000000000..87a4fb14e41aaa --- /dev/null +++ b/test/fixtures/keys/.gitattributes @@ -0,0 +1,4 @@ +* -text + +Makefile text +*.cnf text diff --git a/test/fixtures/keys/Makefile b/test/fixtures/keys/Makefile index 81fe36a81331eb..72a0cb5718511b 100644 --- a/test/fixtures/keys/Makefile +++ b/test/fixtures/keys/Makefile @@ -43,6 +43,8 @@ all: \ rsa_pss_public_2048.pem \ rsa_pss_public_2048_sha256_sha256_16.pem \ rsa_pss_public_2048_sha512_sha256_20.pem \ + ed25519_private.pem \ + ed25519_public.pem \ # # Create Certificate Authority: ca1 @@ -598,6 +600,12 @@ rsa_pss_public_2048_sha256_sha256_16.pem: rsa_pss_private_2048_sha256_sha256_16. rsa_pss_public_2048_sha512_sha256_20.pem: rsa_pss_private_2048_sha512_sha256_20.pem openssl pkey -in rsa_pss_private_2048_sha512_sha256_20.pem -pubout -out rsa_pss_public_2048_sha512_sha256_20.pem +ed25519_private.pem: + openssl genpkey -algorithm ED25519 -out ed25519_private.pem + +ed25519_public.pem: ed25519_private.pem + openssl pkey -in ed25519_private.pem -pubout -out ed25519_public.pem + clean: rm -f *.pfx *.pem *.srl ca2-database.txt ca2-serial fake-startcom-root-serial *.print *.old fake-startcom-root-issued-certs/*.pem @> fake-startcom-root-database.txt diff --git a/test/fixtures/keys/ed25519_private.pem b/test/fixtures/keys/ed25519_private.pem new file mode 100644 index 00000000000000..f837457cbd4f23 --- /dev/null +++ b/test/fixtures/keys/ed25519_private.pem @@ -0,0 +1,3 @@ +-----BEGIN PRIVATE KEY----- +MC4CAQAwBQYDK2VwBCIEIMFSujN0jIUIdzSvuxka0lfgVVkMdRTuaVvIYUHrvzXQ +-----END PRIVATE KEY----- diff --git a/test/fixtures/keys/ed25519_public.pem b/test/fixtures/keys/ed25519_public.pem new file mode 100644 index 00000000000000..4127a471bac9f5 --- /dev/null +++ b/test/fixtures/keys/ed25519_public.pem @@ -0,0 +1,3 @@ +-----BEGIN PUBLIC KEY----- +MCowBQYDK2VwAyEAK1wIouqnuiA04b3WrMa+xKIKIpfHetNZRv3h9fBf768= +-----END PUBLIC KEY----- diff --git a/test/fixtures/test_ed25519_privkey.pem b/test/fixtures/test_ed25519_privkey.pem deleted file mode 100644 index a8b9f2f603f03a..00000000000000 --- a/test/fixtures/test_ed25519_privkey.pem +++ /dev/null @@ -1,3 +0,0 @@ ------BEGIN PRIVATE KEY----- -MC4CAQAwBQYDK2VwBCIEIHXLsXm1lsq5HtyqJwQyFmpfEluuf0KOqP6DqMgGxxDL ------END PRIVATE KEY----- diff --git a/test/fixtures/test_ed25519_pubkey.pem b/test/fixtures/test_ed25519_pubkey.pem deleted file mode 100644 index b9657c9d08d050..00000000000000 --- a/test/fixtures/test_ed25519_pubkey.pem +++ /dev/null @@ -1,3 +0,0 @@ ------BEGIN PUBLIC KEY----- -MCowBQYDK2VwAyEAEXRYV3v5ucrHVR3mKqyPXxXqU34lASwc7Y7MoOvaqcs= ------END PUBLIC KEY----- diff --git a/test/parallel/test-crypto-key-objects.js b/test/parallel/test-crypto-key-objects.js index 2a3a3ec2f0bff1..0ec7dc1d74c70d 100644 --- a/test/parallel/test-crypto-key-objects.js +++ b/test/parallel/test-crypto-key-objects.js @@ -203,8 +203,8 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem', } [ - { private: fixtures.readSync('test_ed25519_privkey.pem', 'ascii'), - public: fixtures.readSync('test_ed25519_pubkey.pem', 'ascii'), + { private: fixtures.readKey('ed25519_private.pem', 'ascii'), + public: fixtures.readKey('ed25519_public.pem', 'ascii'), keyType: 'ed25519' }, { private: fixtures.readSync('test_ed448_privkey.pem', 'ascii'), public: fixtures.readSync('test_ed448_pubkey.pem', 'ascii'), diff --git a/test/parallel/test-crypto-sign-verify.js b/test/parallel/test-crypto-sign-verify.js index 062c2d08377cfe..2da2a91655cfdd 100644 --- a/test/parallel/test-crypto-sign-verify.js +++ b/test/parallel/test-crypto-sign-verify.js @@ -418,8 +418,8 @@ common.expectsError( } [ - { private: fixtures.readSync('test_ed25519_privkey.pem', 'ascii'), - public: fixtures.readSync('test_ed25519_pubkey.pem', 'ascii'), + { private: fixtures.readKey('ed25519_private.pem', 'ascii'), + public: fixtures.readKey('ed25519_public.pem', 'ascii'), algo: null, sigLen: 64 }, { private: fixtures.readSync('test_ed448_privkey.pem', 'ascii'),