mirror of https://github.com/lukechilds/node.git
Browse Source
Strings are treated as UTF8 instead of one-byte strings when names are processed and when OpenSSL's ..._print functions are used. This commit fixes simple/test-tls-peer-certificate-encoding test. fix #8366v0.11.14-release
Adam Lippai
10 years ago
committed by
Fedor Indutny
8 changed files with 170 additions and 12 deletions
@ -0,0 +1,16 @@ |
|||
-----BEGIN CERTIFICATE----- |
|||
MIICgzCCAeygAwIBAgIJAO6+LOUhGhL4MA0GCSqGSIb3DQEBBQUAMHoxCzAJBgNV |
|||
BAYTAlVTMQswCQYDVQQIEwJDQTELMAkGA1UEBxMCU0YxDzANBgNVBAoTBkpveWVu |
|||
dDEQMA4GA1UECxMHTm9kZS5qczEMMAoGA1UEAxMDY2EyMSAwHgYJKoZIhvcNAQkB |
|||
FhFyeUB0aW55Y2xvdWRzLm9yZzAeFw0xNDA5MTMyMjM0MThaFw00MjAxMjgyMjM0 |
|||
MThaMHQxCzAJBgNVBAYTAkhVMREwDwYDVQQHDAhCdWRhcGVzdDERMA8GA1UECgwI |
|||
VHJlc29yaXQxFjAUBgNVBAMMDcOBZMOhbSBMaXBwYWkxJzAlBgkqhkiG9w0BCQEW |
|||
GGFkYW0ubGlwcGFpQHRyZXNvcml0LmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAw |
|||
gYkCgYEAtrYJnvw24liDRWrfRDp/aBRwAK3xoaJ99YBCj7U8955GJvsoN21q6ZiD |
|||
gT+/7K+HA5gxLXTngrSCTzbk8qfGTD+Gco5WoOK7ubm5R4ePlGrT+yCMaUQBKzX7 |
|||
3s3f0rxuAI5F2qCtIJAS/K6Nk3v6C60DyK/rudnY/+d8dFQf2gECAwEAAaMXMBUw |
|||
EwYDVR0lBAwwCgYIKwYBBQUHAwIwDQYJKoZIhvcNAQEFBQADgYEAC+QBFRXhCWq3 |
|||
BLogUKBPl9TWeu13aPkhMFo29ZZB4G2KCoKWUgHZyJ3Q/Dx40QA+PCrqmKxNHyUx |
|||
oEzol97MwB8Q4puv4BC3m8Zkgu/7z7CFH5LMh/shIjDT+kveGFUscqPzjHykeBhP |
|||
2/4042bED6KYhNw+f3DlN+Y1mBYKEuk= |
|||
-----END CERTIFICATE----- |
@ -0,0 +1,12 @@ |
|||
-----BEGIN CERTIFICATE REQUEST----- |
|||
MIIB2TCCAUICAQAwdDELMAkGA1UEBhMCSFUxETAPBgNVBAcMCEJ1ZGFwZXN0MREw |
|||
DwYDVQQKDAhUcmVzb3JpdDEWMBQGA1UEAwwNw4Fkw6FtIExpcHBhaTEnMCUGCSqG |
|||
SIb3DQEJARYYYWRhbS5saXBwYWlAdHJlc29yaXQuY29tMIGfMA0GCSqGSIb3DQEB |
|||
AQUAA4GNADCBiQKBgQC2tgme/DbiWINFat9EOn9oFHAArfGhon31gEKPtTz3nkYm |
|||
+yg3bWrpmIOBP7/sr4cDmDEtdOeCtIJPNuTyp8ZMP4Zyjlag4ru5ublHh4+UatP7 |
|||
IIxpRAErNfvezd/SvG4AjkXaoK0gkBL8ro2Te/oLrQPIr+u52dj/53x0VB/aAQID |
|||
AQABoCUwIwYJKoZIhvcNAQkHMRYMFEEgY2hhbGxlbmdlIHBhc3N3b3JkMA0GCSqG |
|||
SIb3DQEBBQUAA4GBAAoVh5wdSi58RJrwy4xaXeZwrRUeCEfNf66AhAr16fa7AxMZ |
|||
7XCMGVYTCcPxsFaagYptWYigYOP3vC89i1dm29PjUwRvyTvkSQ+o/8Cjs+BESeG2 |
|||
HrmK7b7xQjXCUwUXfHW7bnqVsTXcX1QfSztWKZANgETITD0MsGjh6Cdv+6ze |
|||
-----END CERTIFICATE REQUEST----- |
@ -0,0 +1,15 @@ |
|||
-----BEGIN RSA PRIVATE KEY----- |
|||
MIICXQIBAAKBgQC2tgme/DbiWINFat9EOn9oFHAArfGhon31gEKPtTz3nkYm+yg3 |
|||
bWrpmIOBP7/sr4cDmDEtdOeCtIJPNuTyp8ZMP4Zyjlag4ru5ublHh4+UatP7IIxp |
|||
RAErNfvezd/SvG4AjkXaoK0gkBL8ro2Te/oLrQPIr+u52dj/53x0VB/aAQIDAQAB |
|||
AoGAbB+X2/THifT1YhwXmenAQdhuW4iUSKG/RowrV53aQXLxctoId5yRu0Ec+Vy/ |
|||
eBJ7pJ3o5EydQFUQFE6Y+BxfFPogncoTu7U8I5S38aBDaL5teX8DzaDqLvcqU7GF |
|||
s+nOACcCErQ2BcpasTkKBFzzrpJtAes2jVzpsfa48JZtc70CQQDe0uUtlKR7tatL |
|||
sugU7OfRoeV1c/tHWp/5HODY0ZeMYvbNw6SqebKeBts26rJNGn4b4LgJs/TTT3qz |
|||
ux6a0ex3AkEA0eo22zaBVjZcygfIfEW9tyfGT1eHgfE/DHcaPHekwgwltoo2gEkU |
|||
hzWy7n09MTkM2Zw6RBz6yvbdJ80/T8UjRwJBALfPJPqauazLSgjiBozseLb3ZD+l |
|||
c02DNp/a8KgrDWbjZFCM6VMvnOa7JS6CIJ92ET2R/H8UkguWbtPAshhovzUCQQC8 |
|||
uU8SbQGBKiToOnEkUWtMhMUFRlN9HxEpOtdqr8J/933cjIyNb6a2HTA+vHhMjdcg |
|||
uhWkcU2FNscEZsJaDIo3AkAOnbQTW1w4WjkV92B+EH6dQfS3wdCFVDUYM+POcwfQ |
|||
7HNtjmk1XeMTkGLlyinyFe2nARfXXzMmyRYP8o2m9uCf |
|||
-----END RSA PRIVATE KEY----- |
@ -0,0 +1,21 @@ |
|||
[ req ] |
|||
string_mask = utf8only |
|||
utf8 = yes |
|||
default_bits = 1024 |
|||
days = 999 |
|||
distinguished_name = req_distinguished_name |
|||
attributes = req_attributes |
|||
prompt = no |
|||
|
|||
[ req_distinguished_name ] |
|||
C = HU |
|||
L = Budapest |
|||
O = Tresorit |
|||
CN = Ádám Lippai |
|||
emailAddress = adam.lippai@tresorit.com |
|||
|
|||
[ req_attributes ] |
|||
challengePassword = A challenge password |
|||
|
|||
[ ext_key_usage ] |
|||
extendedKeyUsage = clientAuth |
@ -1 +1 @@ |
|||
EEBE2CE5211A12F7 |
|||
EEBE2CE5211A12F8 |
|||
|
@ -0,0 +1,62 @@ |
|||
// Copyright Joyent, Inc. and other Node contributors.
|
|||
//
|
|||
// Permission is hereby granted, free of charge, to any person obtaining a
|
|||
// copy of this software and associated documentation files (the
|
|||
// "Software"), to deal in the Software without restriction, including
|
|||
// without limitation the rights to use, copy, modify, merge, publish,
|
|||
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|||
// persons to whom the Software is furnished to do so, subject to the
|
|||
// following conditions:
|
|||
//
|
|||
// The above copyright notice and this permission notice shall be included
|
|||
// in all copies or substantial portions of the Software.
|
|||
//
|
|||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|||
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
|
|||
if (!process.versions.openssl) { |
|||
console.error('Skipping because node compiled without OpenSSL.'); |
|||
process.exit(0); |
|||
} |
|||
|
|||
var common = require('../common'); |
|||
var assert = require('assert'); |
|||
var tls = require('tls'); |
|||
var fs = require('fs'); |
|||
var util = require('util'); |
|||
var join = require('path').join; |
|||
var spawn = require('child_process').spawn; |
|||
|
|||
var options = { |
|||
key: fs.readFileSync(join(common.fixturesDir, 'keys', 'agent5-key.pem')), |
|||
cert: fs.readFileSync(join(common.fixturesDir, 'keys', 'agent5-cert.pem')), |
|||
ca: [ fs.readFileSync(join(common.fixturesDir, 'keys', 'ca2-cert.pem')) ] |
|||
}; |
|||
var verified = false; |
|||
|
|||
var server = tls.createServer(options, function(cleartext) { |
|||
cleartext.end('World'); |
|||
}); |
|||
server.listen(common.PORT, function() { |
|||
var socket = tls.connect({ |
|||
port: common.PORT, |
|||
rejectUnauthorized: false |
|||
}, function() { |
|||
var peerCert = socket.getPeerCertificate(); |
|||
|
|||
common.debug(util.inspect(peerCert)); |
|||
assert.equal(peerCert.subject.CN, 'Ádám Lippai'); |
|||
verified = true; |
|||
server.close(); |
|||
}); |
|||
socket.end('Hello'); |
|||
}); |
|||
|
|||
process.on('exit', function() { |
|||
assert.ok(verified); |
|||
}); |
Loading…
Reference in new issue