Skip to content

tls: multiple PFX support in createSecureContext#14793

Closed
djphoenix wants to merge 7 commits intonodejs:masterfrom
djphoenix:tls-multi-pfx
Closed

tls: multiple PFX support in createSecureContext#14793
djphoenix wants to merge 7 commits intonodejs:masterfrom
djphoenix:tls-multi-pfx

Conversation

@djphoenix
Copy link
Contributor

Fixes: #14756

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

tls

@nodejs-github-bot nodejs-github-bot added the tls Issues and PRs related to the tls subsystem. label Aug 12, 2017
@djphoenix djphoenix force-pushed the tls-multi-pfx branch 2 times, most recently from 1d13a0b to 41ca43b Compare August 12, 2017 17:35
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should add a third case for when an object is supplied with an encrypted key and the passphrase from options is used.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK (partially). Maybe add separate case out of "multi-pfx" test?

@Trott Trott added the semver-minor PRs that contain new features and should be released in the next minor version. label Aug 13, 2017
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The copyright and license header should not be added to new files

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK, removed

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Buffer.isBuffer()

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, should this be limited to just Buffer instances? We likely should allow any Uint8Array

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the new ../common/fixtures stuff... e.g.

const fixtures = require('../common/fixtures');
/*... */
{
  buffer: fixtures.readKey('agent1-pfx.pem')
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

common.mustCall() here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jasnell in listen (L24) also? Or not necessary?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

common.mustCall() here also

@jasnell
Copy link
Member

jasnell commented Aug 23, 2017

@djphoenix
Copy link
Contributor Author

Fixed FIPS failure (actually bad fixture). @jasnell another try?

@djphoenix
Copy link
Contributor Author

ping?

@jasnell
Copy link
Member

jasnell commented Aug 29, 2017

Hey, sorry @djphoenix ... new CI here! https://ci.nodejs.org/job/node-test-pull-request/9862/

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not completely happy with the buffer check here.

I think it would be good to verify that the input is indeed a buffer and that does not happen here.

If the object attribute name would not be buffer it would be easy to distinguish the object from the buffer and you could write something like:

const raw = pfx.buf ? pfx.buf : pfx;
if (!ArrayBuffer.isView(raw))
  throw new Error("foobar");
const buf = crypto._toBuf(raw);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks as a good proposal. ACK.

doc/api/tls.md Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How come string is not supported anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PKCS12 is very rarely stored in PEM format, by default it's DER-encoded. But I forget about binary strings in JS. Will revert it, ACK.

@djphoenix
Copy link
Contributor Author

@jasnell CI failures seems like unrelated to changes.

@djphoenix
Copy link
Contributor Author

@BridgeAR fixed your picks. @jasnell seems like it's ready for another CI.

@jasnell
Copy link
Member

jasnell commented Aug 29, 2017

@jasnell jasnell requested review from indutny and shigeki August 29, 2017 17:06
Copy link
Member

@indutny indutny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, if it works.

@indutny
Copy link
Member

indutny commented Aug 31, 2017

cc @shigeki @bnoordhuis PTAL

Add support for multiple PFX files in tls.createSecureContext.
Also added support for object-style PFX pass.

Fixes: nodejs#14756
Copy link
Member

@BridgeAR BridgeAR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still LGTM

@BridgeAR
Copy link
Member

BridgeAR commented Sep 4, 2017

Copy link
Member

@indutny indutny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@djphoenix
Copy link
Contributor Author

Still waiting for @shigeki and @bnoordhuis

@BridgeAR
Copy link
Member

BridgeAR commented Sep 8, 2017

Landed in 372dc86

@BridgeAR BridgeAR closed this Sep 8, 2017
@MylesBorins
Copy link
Contributor

@BridgeAR it seems like @djphoenix was still waiting for a review from @shigeki and @bnoordhuis. Was there a reason it landed before?

@MylesBorins
Copy link
Contributor

Also fwiw I've landed this on v8.x-staging and it is on track to be released in the next 8.x release. Just wanted to confirm that this should be released before doing so

@MylesBorins MylesBorins mentioned this pull request Sep 10, 2017
@djphoenix
Copy link
Contributor Author

djphoenix commented Sep 11, 2017

@djphoenix was still waiting for a review

@MylesBorins not me, but @indutny tagged them before, so I pinged also. Not blocking for me (and for @BridgeAR also as I see).

@BridgeAR
Copy link
Member

@MylesBorins to me it looked like a trivial change that was good to go and there was no response since the review request for a week. And as it did not come from @djphoenix it felt more like a "nice to have" in this case. So I went ahead and landed it.

@MylesBorins
Copy link
Contributor

MylesBorins commented Sep 11, 2017 via email

@djphoenix djphoenix deleted the tls-multi-pfx branch September 11, 2017 23:50
@gibfahn
Copy link
Member

gibfahn commented Jan 15, 2018

Release team were -1 on landing on v6.x, if you disagree let us know.

@djphoenix
Copy link
Contributor Author

@gibfahn I’m not sure, so let NodeJS team decide. For me it’s enough to have this feature in latest versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

semver-minor PRs that contain new features and should be released in the next minor version. tls Issues and PRs related to the tls subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants