node/test/parallel/test-tls-pfx-gh-5100-regr.js
Shigeki Ohtsu dccccbbbe7 test: enable to work pkcs12 test in FIPS mode
The pfx file created by pkcs12 command of openssl causes an error in
FIPS mode because its certificate is encrypted with RC2 by default.
Adding `-descert` option resolves the error.

Fix: https://github.com/nodejs/node/pull/5144
Fix: https://github.com/nodejs/node/pull/5109
PR-URL: https://github.com/nodejs/node/pull/5150
Reviewed-By: Rich Trott <rtrott@gmail.com>
2016-02-09 13:05:48 +09:00

37 lines
830 B
JavaScript

'use strict';
const common = require('../common');
if (!common.hasCrypto) {
console.log('1..0 # Skipped: node compiled without crypto.');
return;
}
const assert = require('assert');
const tls = require('tls');
const fs = require('fs');
const path = require('path');
const pfx = fs.readFileSync(
path.join(common.fixturesDir, 'keys', 'agent1-pfx.pem'));
const server = tls.createServer({
pfx: pfx,
passphrase: 'sample',
requestCert: true,
rejectUnauthorized: false
}, common.mustCall(function(c) {
assert(c.authorizationError === null, 'authorizationError must be null');
c.end();
})).listen(common.PORT, function() {
var client = tls.connect({
port: common.PORT,
pfx: pfx,
passphrase: 'sample',
rejectUnauthorized: false
}, function() {
client.end();
server.close();
});
});