Browse Source

Fix style issues with ext_key_usage patch

Closes GH-586.
v0.7.4-release
Greg Hughes 14 years ago
committed by Ryan Dahl
parent
commit
1a5e513084
  1. 9
      src/node_crypto.cc
  2. 8
      test/simple/test-tls-ext-key-usage.js

9
src/node_crypto.cc

@ -696,17 +696,18 @@ Handle<Value> Connection::GetPeerCertificate(const Arguments& args) {
info->Set(fingerprint_symbol, String::New(fingerprint));
}
STACK_OF(ASN1_OBJECT) *eku = (STACK_OF(ASN1_OBJECT) *)X509_get_ext_d2i(peer_cert, NID_ext_key_usage, NULL, NULL);
STACK_OF(ASN1_OBJECT) *eku = (STACK_OF(ASN1_OBJECT) *)X509_get_ext_d2i(
peer_cert, NID_ext_key_usage, NULL, NULL);
if (eku != NULL) {
Local<Array> ext_key_usage = Array::New();
for (int i = 0; i < sk_ASN1_OBJECT_num(eku); i++) {
memset(buf, 0, sizeof(buf));
OBJ_obj2txt(buf, sizeof(buf) - 1, sk_ASN1_OBJECT_value(eku, i), 1);
ext_key_usage->Set(Integer::New(i), String::New(buf));
}
sk_ASN1_OBJECT_pop_free(eku, ASN1_OBJECT_free);
info->Set(ext_key_usage_symbol, ext_key_usage);
}

8
test/simple/test-tls-ext-key-usage.js

@ -110,11 +110,11 @@ function startClient() {
console.log('client: connected+secure!');
console.log('client pair.cleartext.getPeerCertificate(): %j',
pair.cleartext.getPeerCertificate());
// "TLS Web Client Authentication"
assert.equal(pair.cleartext.getPeerCertificate().ext_key_usage.length, 1)
assert.equal(pair.cleartext.getPeerCertificate().ext_key_usage[0], '1.3.6.1.5.5.7.3.2')
assert.equal(pair.cleartext.getPeerCertificate().ext_key_usage.length, 1);
assert.equal(pair.cleartext.getPeerCertificate().ext_key_usage[0], '1.3.6.1.5.5.7.3.2');
console.log('client pair.cleartext.getCipher(): %j',
pair.cleartext.getCipher());
setTimeout(function() {

Loading…
Cancel
Save