Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5ac6ddd

Browse filesBrowse files
reasonablytallBridgeAR
authored andcommitted
test: move spkac certs to fixtures/keys/
PR-URL: #27962 Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent 03b92e9 commit 5ac6ddd
Copy full SHA for 5ac6ddd

File tree

Expand file treeCollapse file tree

7 files changed

+18
-13
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

7 files changed

+18
-13
lines changed
Open diff view settings
Collapse file

‎test/fixtures/keys/Makefile‎

Copy file name to clipboardExpand all lines: test/fixtures/keys/Makefile
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ all: \
4646
rsa_private_b.pem \
4747
I_AM_THE_WALRUS_sha256_signature_signedby_rsa_private_b.sha256 \
4848
rsa_public_b.pem \
49+
rsa_spkac.spkac \
50+
rsa_spkac_invalid.spkac \
4951
rsa_private_1024.pem \
5052
rsa_private_2048.pem \
5153
rsa_private_4096.pem \
@@ -630,6 +632,14 @@ I_AM_THE_WALRUS_sha256_signature_signedby_rsa_private_b.sha256: rsa_private_b.pe
630632
rsa_public_b.pem: rsa_private_b.pem
631633
openssl rsa -in rsa_private_b.pem -pubout -out rsa_public_b.pem
632634

635+
# openssl outputs `SPKAC=[SPKAC]`. That prefix needs to be removed to work with node
636+
rsa_spkac.spkac: rsa_private.pem
637+
openssl spkac -key rsa_private.pem -challenge this-is-a-challenge | cut -c 7- > rsa_spkac.spkac
638+
639+
# cutting characters from the start to invalidate the spkac
640+
rsa_spkac_invalid.spkac: rsa_spkac.spkac
641+
cat rsa_spkac.spkac | cut -c 5- > rsa_spkac_invalid.spkac
642+
633643
rsa_private_1024.pem:
634644
openssl genrsa -out rsa_private_1024.pem 1024
635645

Collapse file

‎test/fixtures/keys/rsa_spkac.spkac‎

Copy file name to clipboard
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
MIICUzCCATswggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC33FiIiiexwLe/P8DZx5HsqFlmUO7/lvJ7necJVNwqdZ3ax5jpQB0p6uxfqeOvzcN3k5V7UFb/Am+nkSNZMAZhsWzCU2Z4Pjh50QYz3f0Hour7/yIGStOLyYY3hgLK2K8TbhgjQPhdkw9+QtKlpvbL8fLgONAoGrVOFnRQGcr70iFffsm79mgZhKVMgYiHPJqJgGHvCtkGg9zMgS7p63+Q3ZWedtFS2RhMX3uCBy/mH6EOlRCNBbRmA4xxNzyf5GQaki3T+Iz9tOMjdPP+CwV2LqEdylmBuik8vrfTb3qIHLKKBAI8lXN26wWtA3kN4L7NP+cbKlCRlqctvhmylLH1AgMBAAEWE3RoaXMtaXMtYS1jaGFsbGVuZ2UwDQYJKoZIhvcNAQEEBQADggEBAIozmeW1kfDfAVwRQKileZGLRGCD7AjdHLYEe16xTBPve8Af1bDOyuWsAm4qQLYA4FAFROiKeGqxCtIErEvm87/09tCfF1My/1Uj+INjAk39DK9J9alLlTsrwSgd1lb3YlXY7TyitCmh7iXLo4pVhA2chNA3njiMq3CUpSvGbpzrESL2dv97lv590gUD988wkTDVyYsf0T8+X0Kww3AgPWGji+2f2i5/jTfD/s1lK1nqi7ZxFm0pGZoy1MJ51SCEy7Y82ajroI+5786nC02mo9ak7samca4YDZOoxN4d3tax4B/HDF5dqJSm1/31xYLDTfujCM5FkSjRc4m6hnriEkc=
Collapse file
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
UzCCATswggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC33FiIiiexwLe/P8DZx5HsqFlmUO7/lvJ7necJVNwqdZ3ax5jpQB0p6uxfqeOvzcN3k5V7UFb/Am+nkSNZMAZhsWzCU2Z4Pjh50QYz3f0Hour7/yIGStOLyYY3hgLK2K8TbhgjQPhdkw9+QtKlpvbL8fLgONAoGrVOFnRQGcr70iFffsm79mgZhKVMgYiHPJqJgGHvCtkGg9zMgS7p63+Q3ZWedtFS2RhMX3uCBy/mH6EOlRCNBbRmA4xxNzyf5GQaki3T+Iz9tOMjdPP+CwV2LqEdylmBuik8vrfTb3qIHLKKBAI8lXN26wWtA3kN4L7NP+cbKlCRlqctvhmylLH1AgMBAAEWE3RoaXMtaXMtYS1jaGFsbGVuZ2UwDQYJKoZIhvcNAQEEBQADggEBAIozmeW1kfDfAVwRQKileZGLRGCD7AjdHLYEe16xTBPve8Af1bDOyuWsAm4qQLYA4FAFROiKeGqxCtIErEvm87/09tCfF1My/1Uj+INjAk39DK9J9alLlTsrwSgd1lb3YlXY7TyitCmh7iXLo4pVhA2chNA3njiMq3CUpSvGbpzrESL2dv97lv590gUD988wkTDVyYsf0T8+X0Kww3AgPWGji+2f2i5/jTfD/s1lK1nqi7ZxFm0pGZoy1MJ51SCEy7Y82ajroI+5786nC02mo9ak7samca4YDZOoxN4d3tax4B/HDF5dqJSm1/31xYLDTfujCM5FkSjRc4m6hnriEkc=
Collapse file

‎test/fixtures/spkac.fail‎

Copy file name to clipboardExpand all lines: test/fixtures/spkac.fail
-1Lines changed: 0 additions & 1 deletion
This file was deleted.
Collapse file

‎test/fixtures/spkac.pem‎

Copy file name to clipboardExpand all lines: test/fixtures/spkac.pem
-6Lines changed: 0 additions & 6 deletions
This file was deleted.
Collapse file

‎test/fixtures/spkac.valid‎

Copy file name to clipboardExpand all lines: test/fixtures/spkac.valid
-1Lines changed: 0 additions & 1 deletion
This file was deleted.
Collapse file

‎test/parallel/test-crypto-certificate.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-crypto-certificate.js
+6-5Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,10 @@ const { Certificate } = crypto;
3030
const fixtures = require('../common/fixtures');
3131

3232
// Test Certificates
33-
const spkacValid = fixtures.readSync('spkac.valid');
34-
const spkacFail = fixtures.readSync('spkac.fail');
35-
const spkacPem = fixtures.readSync('spkac.pem');
33+
const spkacValid = fixtures.readKey('rsa_spkac.spkac');
34+
const spkacChallenge = 'this-is-a-challenge';
35+
const spkacFail = fixtures.readKey('rsa_spkac_invalid.spkac');
36+
const spkacPublicPem = fixtures.readKey('rsa_public.pem');
3637

3738
function checkMethods(certificate) {
3839

@@ -41,13 +42,13 @@ function checkMethods(certificate) {
4142

4243
assert.strictEqual(
4344
stripLineEndings(certificate.exportPublicKey(spkacValid).toString('utf8')),
44-
stripLineEndings(spkacPem.toString('utf8'))
45+
stripLineEndings(spkacPublicPem.toString('utf8'))
4546
);
4647
assert.strictEqual(certificate.exportPublicKey(spkacFail), '');
4748

4849
assert.strictEqual(
4950
certificate.exportChallenge(spkacValid).toString('utf8'),
50-
'fb9ab814-6677-42a4-a60c-f905d1a6924d'
51+
spkacChallenge
5152
);
5253
assert.strictEqual(certificate.exportChallenge(spkacFail), '');
5354
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.