Skip to content

fix: replace certutil invocation with node native pfx parsing#32

Open
Agritite wants to merge 1 commit into
electron-userland:mainfrom
Agritite:issue-26
Open

fix: replace certutil invocation with node native pfx parsing#32
Agritite wants to merge 1 commit into
electron-userland:mainfrom
Agritite:issue-26

Conversation

@Agritite

@Agritite Agritite commented Apr 14, 2026

Copy link
Copy Markdown

fixes #26

Apparently node already has the ability to parse pkcs12 (tls.createServer accepts pfx) but doesn't export such method in node:crypto. Luckily we can still make use of it by creating dummy tls connections.

Comment thread test/unit/bin.spec.ts
});

it('should return the publisher from the cert', async () => {
it('should return stdout when process succeeds', async () => {

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

need to replace all tests of run because previously those were covered by testing certutil but now it's not.

Comment thread src/bin.ts
})
}

export const exportedRunForVitest = run;

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

suggestions welcome. I'm not a fan of this.

@Agritite

Copy link
Copy Markdown
Author

rebased and signed

Comment thread src/bin.ts
const pfx = await fs.promises.readFile(pfxPath);
return new Promise((resolve, reject) => {
// Windows pipe which is not persistent and will be deleted when process exits. See https://nodejs.org/api/net.html#identifying-paths-for-ipc-connections
const pipePath = path.win32.join('\\\\?', 'pipe', 'electron-windows-msix', crypto.randomUUID());

@Agritite Agritite Apr 15, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

If electron-windows-msix would support cross building in the future, this will have to switch to domain socket path on posix

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sign certificate failed because child_process.spawn get wrong result

1 participant