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 a0d2862

Browse filesBrowse files
reasonablytallBridgeAR
authored andcommitted
test: move foafssl 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 af9eb96 commit a0d2862
Copy full SHA for a0d2862

File tree

Expand file treeCollapse file tree

8 files changed

+73
-72
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

8 files changed

+73
-72
lines changed
Open diff view settings
Collapse file

‎test/fixtures/foafssl.crt‎

Copy file name to clipboardExpand all lines: test/fixtures/foafssl.crt
-25Lines changed: 0 additions & 25 deletions
This file was deleted.
Collapse file

‎test/fixtures/foafssl.key‎

Copy file name to clipboardExpand all lines: test/fixtures/foafssl.key
-32Lines changed: 0 additions & 32 deletions
This file was deleted.
Collapse file

‎test/fixtures/keys/Makefile‎

Copy file name to clipboardExpand all lines: test/fixtures/keys/Makefile
+14Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ all: \
5050
rsa_private_b.pem \
5151
I_AM_THE_WALRUS_sha256_signature_signedby_rsa_private_b.sha256 \
5252
rsa_public_b.pem \
53+
rsa_cert_foafssl_b.crt \
54+
rsa_cert_foafssl_b.modulus \
55+
rsa_cert_foafssl_b.exponent \
5356
rsa_spkac.spkac \
5457
rsa_spkac_invalid.spkac \
5558
rsa_private_1024.pem \
@@ -648,6 +651,17 @@ I_AM_THE_WALRUS_sha256_signature_signedby_rsa_private_b.sha256: rsa_private_b.pe
648651
rsa_public_b.pem: rsa_private_b.pem
649652
openssl rsa -in rsa_private_b.pem -pubout -out rsa_public_b.pem
650653

654+
rsa_cert_foafssl_b.crt: rsa_private_b.pem
655+
openssl req -new -x509 -config rsa_cert_foafssl_b.cnf -key rsa_private_b.pem -out rsa_cert_foafssl_b.crt
656+
657+
# The 'modulus=' in the output must be stripped out
658+
rsa_cert_foafssl_b.modulus: rsa_cert_foafssl_b.crt
659+
openssl x509 -modulus -in rsa_cert_foafssl_b.crt -noout | cut -c 9- > rsa_cert_foafssl_b.modulus
660+
661+
# Have to parse out the hex exponent
662+
rsa_cert_foafssl_b.exponent: rsa_cert_foafssl_b.crt
663+
openssl x509 -in rsa_cert_foafssl_b.crt -text | grep -o 'Exponent:.*' | sed 's/\(.*(\|).*\)//g' > rsa_cert_foafssl_b.exponent
664+
651665
# openssl outputs `SPKAC=[SPKAC]`. That prefix needs to be removed to work with node
652666
rsa_spkac.spkac: rsa_private.pem
653667
openssl spkac -key rsa_private.pem -challenge this-is-a-challenge | cut -c 7- > rsa_spkac.spkac
Collapse file
+24Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[ req ]
2+
days = 99999
3+
distinguished_name = req_distinguished_name
4+
attributes = req_attributes
5+
prompt = no
6+
x509_extensions = v3_ca
7+
8+
[ req_distinguished_name ]
9+
C = UK
10+
ST = "FOAF+SSL Auth Certificate"
11+
L = Rhys Jones
12+
O = node.js
13+
OU = Test TLS Certificate
14+
CN = localhost
15+
emailAddress = alex@aub.dev
16+
17+
[ req_attributes ]
18+
19+
[ v3_ca ]
20+
basicConstraints = CA:FALSE
21+
subjectAltName = @alt_names
22+
23+
[ alt_names ]
24+
URI = http://example.com/\#me
Collapse file
+24Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
-----BEGIN CERTIFICATE-----
2+
MIIEEDCCAvigAwIBAgIUAhzZrkGH3j4aXirSjA6n87moF9kwDQYJKoZIhvcNAQEL
3+
BQAwgagxCzAJBgNVBAYTAlVLMSIwIAYDVQQIDBlGT0FGK1NTTCBBdXRoIENlcnRp
4+
ZmljYXRlMRMwEQYDVQQHD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QQCGU0tNQ1EFNzj6A7Mi/zSZ5wBbTi886xYztLPSjWEHt+8pShHga/Qi3alN
21+
3haN/UvyamKgmWna8s3zWrCEZwW7D+XQqWoA2EISlnIdX46agHgmU30+TalGDAzf
22+
OFwGvEfkyHTrrl6TxwdLU8fWsEcBOF6Ukg7kEc1aCBgd3cD9LI8g2N8DQdkWGGEQ
23+
innpMWv59H2v3gVMj/0/BPGthQMTHMrhKWZZ1QGjkId7tHro
24+
-----END CERTIFICATE-----
Collapse file
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0x10001
Collapse file
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
C9BD60AEB37EDBD7F179E11B4DA4848DAE932834E94FF5979EAAC5092FA1EC861C9C3A0057072C3D4E4565E50FBCB28CCE2F4D1D2277E0B402BABA87807F17F9CC34613DE07584BFEEAA10897B3ECCABFAD7935CB6D0F7C6540B71E63E370CE7A0F5F2C99C0E799AB25391E2A9BAEABBA85DAFA81062880C34B9F6371056DA919E81DEBE6463025F7FBF06D30FFFAB579ADB588D8FB284DD92AC6CF970A856A5C1E20BA5FE07BB822A8299CBEB768D4C5854A5305ABD59B8CF24A529EE54272FD4EA0C1848A610703BBFF79A17FCBECFF55D43863CF068539D537829BB6067EA3D3E8863C4B154EB655E4C02E2C54E663D029281220229F8DEBF415452EAC5EB
Collapse file

‎test/parallel/test-https-foafssl.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-https-foafssl.js
+9-15Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,15 @@ const https = require('https');
3333
const spawn = require('child_process').spawn;
3434

3535
const options = {
36-
key: fixtures.readSync('agent.key'),
37-
cert: fixtures.readSync('agent.crt'),
36+
key: fixtures.readKey('rsa_private.pem'),
37+
cert: fixtures.readKey('rsa_cert.crt'),
3838
requestCert: true,
3939
rejectUnauthorized: false
4040
};
4141

42-
const modulus = 'A6F44A9C25791431214F5C87AF9E040177A8BB89AC803F7E09BBC3A5519F' +
43-
'349CD9B9C40BE436D0AA823A94147E26C89248ADA2BE3DD4D34E8C289646' +
44-
'94B2047D217B4F1299371EA93A83C89AB9440724131E65F2B0161DE9560C' +
45-
'DE9C13455552B2F49CF0FB00D8D77532324913F6F80FF29D0A131D29DB06' +
46-
'AFF8BE191B7920DC2DAE1C26EA82A47847A10391EF3BF6AABB3CC40FF821' +
47-
'00B03A4F0FF1809278E4DDFDA7DE954ED56DC7AD9A47EEBC37D771A366FC' +
48-
'60A5BCB72373BEC180649B3EFA0E9092707210B41B90032BB18BC91F2046' +
49-
'EBDAF1191F4A4E26D71879C4C7867B62FCD508E8CE66E82D128A71E91580' +
50-
'9FCF44E8DE774067F1DE5D70B9C03687';
42+
const webIdUrl = 'URI:http://example.com/#me';
43+
const modulus = fixtures.readKey('rsa_cert_foafssl_b.modulus', 'ascii').replace(/\n/g, '');
44+
const exponent = fixtures.readKey('rsa_cert_foafssl_b.exponent', 'ascii').replace(/\n/g, '');
5145

5246
const CRLF = '\r\n';
5347
const body = 'hello world\n';
@@ -58,8 +52,8 @@ const server = https.createServer(options, common.mustCall(function(req, res) {
5852

5953
cert = req.connection.getPeerCertificate();
6054

61-
assert.strictEqual(cert.subjectaltname, 'URI:http://example.com/#me');
62-
assert.strictEqual(cert.exponent, '0x10001');
55+
assert.strictEqual(cert.subjectaltname, webIdUrl);
56+
assert.strictEqual(cert.exponent, exponent);
6357
assert.strictEqual(cert.modulus, modulus);
6458
res.writeHead(200, { 'content-type': 'text/plain' });
6559
res.end(body);
@@ -69,8 +63,8 @@ server.listen(0, function() {
6963
const args = ['s_client',
7064
'-quiet',
7165
'-connect', `127.0.0.1:${this.address().port}`,
72-
'-cert', fixtures.path('foafssl.crt'),
73-
'-key', fixtures.path('foafssl.key')];
66+
'-cert', fixtures.path('keys/rsa_cert_foafssl_b.crt'),
67+
'-key', fixtures.path('keys/rsa_private_b.pem')];
7468

7569
const client = spawn(common.opensslCli, args);
7670

0 commit comments

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