Skip to content

Commit

Permalink
Make some changes
Browse files Browse the repository at this point in the history
  • Loading branch information
saarons committed May 18, 2015
1 parent e649dea commit aa18276
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
3 changes: 2 additions & 1 deletion doc/api/tls.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,8 @@ Example:
valid_from: 'Nov 11 09:52:22 2009 GMT',
valid_to: 'Nov 6 09:52:22 2029 GMT',
fingerprint: '2A:7A:C2:DD:E5:F9:CC:53:72:35:99:7A:02:5A:71:38:52:EC:8A:DF',
serialNumber: 'B9B0D332A1AA5635' }
serialNumber: 'B9B0D332A1AA5635',
subjectPublicKeyInfo: < SPKI DER buffer > }

If the peer does not provide a certificate, it returns `null` or an empty
object.
Expand Down
2 changes: 1 addition & 1 deletion src/env.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ namespace node {
V(priority_string, "priority") \
V(processed_string, "processed") \
V(prototype_string, "prototype") \
V(public_key_string, "publicKey") \
V(raw_string, "raw") \
V(rdev_string, "rdev") \
V(readable_string, "readable") \
Expand Down Expand Up @@ -194,6 +193,7 @@ namespace node {
V(status_string, "status") \
V(stdio_string, "stdio") \
V(subject_string, "subject") \
V(subject_public_key_info_string, "subjectPublicKeyInfo") \
V(subjectaltname_string, "subjectaltname") \
V(sys_string, "sys") \
V(syscall_string, "syscall") \
Expand Down
2 changes: 1 addition & 1 deletion src/node_crypto.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1225,7 +1225,7 @@ static Local<Object> X509ToObject(Environment* env, X509* cert) {
unsigned char* pkey_serialized = reinterpret_cast<unsigned char*>(
Buffer::Data(pkey_buff));
i2d_PUBKEY(pkey, &pkey_serialized);
info->Set(env->public_key_string(), pkey_buff);
info->Set(env->subject_public_key_info_string(), pkey_buff);
}

if (rsa != nullptr) {
Expand Down
12 changes: 6 additions & 6 deletions test/parallel/test-tls-peer-certificate.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ var options = {
};
var verified = false;

var expectedBase64PublicKey = 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC46ze' +
'FbysX7vHHmIH3COYiB34dOpEVR4rEb6ZZXfkeXoDe7NgZfBbOeqw6iavhr9SRmvFs8ank' +
'DCpr2DvY0X3uDdLKyrYNbhrfJxdYB5hhwdKVHGokZdOPH68b/ScMJcsGGgMo7TTMRxx2M' +
'ZLzESOOJ5BCv4p4BKYibSRCa43lhwIDAQAB';
var expectedBase64SubjectPublicKeyInfo = 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCB' +
'iQKBgQC46zeFbysX7vHHmIH3COYiB34dOpEVR4rEb6ZZXfkeXoDe7NgZfBbOeqw6iavhr' +
'9SRmvFs8ankDCpr2DvY0X3uDdLKyrYNbhrfJxdYB5hhwdKVHGokZdOPH68b/ScMJcsGGg' +
'Mo7TTMRxx2MZLzESOOJ5BCv4p4BKYibSRCa43lhwIDAQAB';

var server = tls.createServer(options, function(cleartext) {
cleartext.end('World');
Expand All @@ -42,8 +42,8 @@ server.listen(common.PORT, function() {
common.debug(util.inspect(peerCert));
assert.equal(peerCert.subject.emailAddress, '[email protected]');
assert.equal(peerCert.serialNumber, '9A84ABCFB8A72AC0');
assert.equal(peerCert.publicKey.toString('base64'),
expectedBase64PublicKey);
assert.equal(peerCert.subjectPublicKeyInfo.toString('base64'),
expectedBase64SubjectPublicKeyInfo);
assert.deepEqual(peerCert.infoAccess['OCSP - URI'],
[ 'http://ocsp.nodejs.org/' ]);

Expand Down

0 comments on commit aa18276

Please sign in to comment.