GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — doc: add steps about signing the binary in single-executable docs · nodejs/node@15280fb

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • doc/api
    • single-executable-applications.md
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎doc/api/single-executable-applications.md‎

Copy file name to clipboardExpand all lines: doc/api/single-executable-applications.md
+38-2Lines changed: 38 additions & 2 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,24 @@ tool, [postject][]:
3939
$ cp $(command -v node) hello
4040
```
4141

42-
3. Inject the JavaScript file into the copied binary by running `postject` with
42+
3. Remove the signature of the binary:
43+
44+
* On macOS:
45+
46+
```console
47+
$ codesign --remove-signature hello
48+
```
49+
50+
* On Windows (optional):
51+
52+
[signtool][] can be used from the installed [Windows SDK][]. If this step is
53+
skipped, ignore any signature-related warning from postject.
54+
55+
```console
56+
$ signtool remove /s hello
57+
```
58+
59+
4. Inject the JavaScript file into the copied binary by running `postject` with
4360
the following options:
4461

4562
* `hello` - The name of the copy of the `node` executable created in step 2.
@@ -67,7 +84,24 @@ tool, [postject][]:
6784
--macho-segment-name NODE_JS
6885
```
6986

70-
4. Run the binary:
87+
5. Sign the binary:
88+
89+
* On macOS:
90+
91+
```console
92+
$ codesign --sign - hello
93+
```
94+
95+
* On Windows (optional):
96+
97+
A certificate needs to be present for this to work. However, the unsigned
98+
binary would still be runnable.
99+
100+
```console
101+
$ signtool sign /fd SHA256 hello
102+
```
103+
104+
6. Run the binary:
71105
```console
72106
$ ./hello world
73107
Hello, world!
@@ -138,9 +172,11 @@ to help us document them.
138172
[ELF]: https://en.wikipedia.org/wiki/Executable_and_Linkable_Format
139173
[Mach-O]: https://en.wikipedia.org/wiki/Mach-O
140174
[PE]: https://en.wikipedia.org/wiki/Portable_Executable
175+
[Windows SDK]: https://developer.microsoft.com/en-us/windows/downloads/windows-sdk/
141176
[`process.execPath`]: process.md#processexecpath
142177
[`require()`]: modules.md#requireid
143178
[`require.main`]: modules.md#accessing-the-main-module
144179
[fuse]: https://www.electronjs.org/docs/latest/tutorial/fuses
145180
[postject]: https://github.com/nodejs/postject
181+
[signtool]: https://learn.microsoft.com/en-us/windows/win32/seccrypto/signtool
146182
[single executable applications]: https://github.com/nodejs/single-executable

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.