@certchip/signer 0.1.11 → 0.1.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -12,6 +12,7 @@ Cross-platform code and document signing CLI tool with SSH key authentication.
12
12
  - **Text/Source Signing** - JS, Python, Go, Rust, and more
13
13
  - **Hash-based Signing** - Default mode: only hash sent to server, not the file
14
14
  - **Windows KSP** - Native Windows crypto integration (Windows only)
15
+ - **Structured Output** - JSON, table, or CSV output for scripting and automation
15
16
 
16
17
  ## Installation
17
18
 
@@ -47,11 +48,13 @@ signercli -logout
47
48
  # Login (certificate is installed to Windows certificate store)
48
49
  signer -login https://signer.example.com username
49
50
 
50
- # Sign using Windows signtool.exe
51
- signtool sign /n "Your Certificate CN" /fd sha256 /tr http://timestamp.digicert.com /td sha256 myapp.exe
51
+ # Sign directly with signer (same options as signercli)
52
+ signer myapp.exe # Default: hash-only mode
53
+ signer myapp.exe -o myapp_signed.exe # Specify output file
54
+ signer myapp.exe -file-upload -save-signed # Upload file, save with _signed suffix
52
55
 
53
- # Or sign directly with signer
54
- signer myapp.exe
56
+ # Or use Windows signtool.exe (after login)
57
+ signtool sign /n "Your Certificate CN" /fd sha256 /tr http://timestamp.digicert.com /td sha256 myapp.exe
55
58
 
56
59
  # Logout (removes certificate from store)
57
60
  signer -logout
@@ -75,10 +78,10 @@ This package provides two CLI tools with different purposes:
75
78
 
76
79
  | | signercli | signer |
77
80
  |---|-----------|--------|
78
- | **Purpose** | Direct file signing | Windows signtool integration |
81
+ | **Purpose** | Direct file signing | Direct signing + Windows signtool integration |
79
82
  | **Platform** | Windows, Linux, macOS | Windows only |
80
- | **How it works** | Signs files directly via server API | Provides certificates to Windows crypto system |
81
- | **Best for** | CI/CD, cross-platform, simple signing | Windows developers using signtool.exe |
83
+ | **How it works** | Signs files directly via server API | Signs files directly OR provides certificates to Windows crypto system |
84
+ | **Best for** | CI/CD, cross-platform, simple signing | Windows developers, signtool.exe integration |
82
85
 
83
86
  ### When to use which tool?
84
87
 
@@ -86,7 +89,8 @@ This package provides two CLI tools with different purposes:
86
89
  |----------|-------------|
87
90
  | CI/CD pipeline (any platform) | signercli |
88
91
  | Linux/macOS development | signercli |
89
- | Simple file signing | signercli |
92
+ | Simple file signing | signercli or signer |
93
+ | Windows direct signing | signer or signercli |
90
94
  | Using Windows signtool.exe | signer |
91
95
  | Windows certificate store integration | signer |
92
96
  | Visual Studio post-build signing | signercli or signer |
@@ -167,6 +171,28 @@ signercli -codesign-cert -o cert.pem # Save to file
167
171
  signercli -codesign-set <password>
168
172
  ```
169
173
 
174
+ **Alternative: `-cert` commands (compatible with signer.exe)**
175
+
176
+ ```bash
177
+ # List certificates (with purpose filter)
178
+ signercli -cert -list # List all certificates
179
+ signercli -cert -list codesign # List code signing certificates
180
+ signercli -cert -list docsign # List document signing certificates
181
+
182
+ # Get/Set certificate ID
183
+ signercli -cert -id # Show current configuration
184
+ signercli -cert -id <cert_id> # Set certificate ID
185
+ signercli -cert -id <cert_id> <label> # Set with label
186
+
187
+ # Get certificate PEM
188
+ signercli -cert -pem
189
+
190
+ # Set private key password
191
+ signercli -cert -password <password>
192
+ ```
193
+
194
+ > **Note:** The `-cert` commands use the same API endpoints as `signer.exe`, ensuring full compatibility between both tools.
195
+
170
196
  #### Configuration
171
197
 
172
198
  Profiles store connection settings. The `default` profile is used when no profile is specified. Other profiles inherit missing settings from `default`.
@@ -216,6 +242,7 @@ signercli -login -profile staging # Uses 'staging' (overrides host)
216
242
  | `-include-chain` | Include certificate chain |
217
243
  | `-timestamp-url <url>` | Timestamp server URL |
218
244
  | `-hash-algorithm <alg>` | Default hash algorithm |
245
+ | `-output-format <type>` | Default output format (classic, json, table, csv) |
219
246
 
220
247
  **Document Signing Options:**
221
248
 
@@ -249,23 +276,147 @@ signercli <file> LOG_INF # Info output
249
276
  # Available: LOG_NON, LOG_ERR, LOG_WRN, LOG_DBG, LOG_INF
250
277
  ```
251
278
 
279
+ **Version Output:**
280
+
281
+ The `-version` command displays comprehensive version information:
282
+
283
+ ```
284
+ # signercli -version
285
+ Certchip Signer CLI v0.1.18
286
+ Cross-platform code and document signing tool
287
+ Copyright (c) 2025 Certchip. All rights reserved.
288
+
289
+ DLL Versions (Local):
290
+ otpkey.dll: 0.1.18.0
291
+ Certchip.dll: 0.1.18.0
292
+
293
+ DLL Versions (System32):
294
+ otpkey.dll: 0.1.18.0
295
+ Certchip.dll: 0.1.18.0
296
+ ```
297
+
298
+ | Information | Description |
299
+ |-------------|-------------|
300
+ | CLI Version | signercli/signer executable version |
301
+ | Local DLL | DLL versions in the same directory as the executable |
302
+ | System32 DLL | DLL versions installed in Windows System32 folder |
303
+
304
+ > **Note:** DLL version information is Windows-only. On Linux/macOS, only the CLI version is displayed.
305
+
306
+ #### Output Format
307
+
308
+ Both `signercli` and `signer` support structured output formats for scripting and automation.
309
+
310
+ ```bash
311
+ # JSON format (default for scripting)
312
+ signercli -verify myapp.exe -format json
313
+ signercli -config list -format json
314
+ signercli -logout -format json
315
+
316
+ # Table format (aligned columns)
317
+ signercli -verify myapp.exe -format table
318
+
319
+ # CSV format (spreadsheet-friendly)
320
+ signercli -config list -format csv
321
+
322
+ # Classic format (default - human-readable)
323
+ signercli -verify myapp.exe
324
+ ```
325
+
326
+ **Format Options:**
327
+
328
+ | Format | Description | Best for |
329
+ |--------|-------------|----------|
330
+ | `classic` | Human-readable output (default) | Interactive use |
331
+ | `json` | JSON structured output | CI/CD, scripting, automation |
332
+ | `table` | Aligned table format | Terminal display |
333
+ | `csv` | Comma-separated values | Spreadsheets, data processing |
334
+
335
+ **Example: JSON output from verify command**
336
+
337
+ ```bash
338
+ $ signercli -verify myapp.exe -format json
339
+ ```
340
+
341
+ ```json
342
+ {
343
+ "command": "verify",
344
+ "status": "valid",
345
+ "file": "myapp.exe",
346
+ "method": "AUTHENTICODE",
347
+ "signer": "Example Company",
348
+ "serialNumber": "0123456789abcdef",
349
+ "timestamp": "2025-01-15 10:30:00",
350
+ "success": true
351
+ }
352
+ ```
353
+
354
+ **Example: JSON output from config list**
355
+
356
+ ```bash
357
+ $ signercli -config list -format json
358
+ ```
359
+
360
+ ```json
361
+ {
362
+ "command": "config-list",
363
+ "count": 3,
364
+ "profiles": ["default", "production", "staging"],
365
+ "success": true
366
+ }
367
+ ```
368
+
369
+ **Example: JSON output from login**
370
+
371
+ ```bash
372
+ $ signercli -login https://signer.example.com admin -pw secret -format json
373
+ ```
374
+
375
+ ```json
376
+ {
377
+ "command": "login",
378
+ "status": "success",
379
+ "username": "admin",
380
+ "expiresIn": 86400,
381
+ "certificate": {
382
+ "cn": "Example Company Code Signing"
383
+ },
384
+ "success": true
385
+ }
386
+ ```
387
+
388
+ > **Note:** Interactive authentication (password prompt, SSH key selection) is not available with structured output formats. Use `-user` and `-pw` options or `-key` option for non-interactive login.
389
+
252
390
  ---
253
391
 
254
392
  ### signer (Windows only)
255
393
 
256
- Windows-specific tool that integrates with the Windows cryptographic system via KSP (Key Storage Provider). Instead of signing files directly, it registers certificates in the Windows certificate store, allowing you to use standard Windows tools like `signtool.exe`.
394
+ Windows-specific tool that integrates with the Windows cryptographic system via KSP (Key Storage Provider). It can both sign files directly (like signercli) and register certificates in the Windows certificate store for use with `signtool.exe`.
257
395
 
258
- **How it works:**
259
- 1. Login fetches your certificate from the server
260
- 2. Certificate is registered in Windows certificate store
261
- 3. KSP provider enables private key operations via the server
262
- 4. Use `signtool.exe` or other Windows signing tools normally
396
+ **Two signing methods:**
397
+ 1. **Direct signing** - Sign files directly with `signer <file>` (same as signercli)
398
+ 2. **signtool integration** - Login to register certificate, then use Windows signtool.exe
263
399
 
264
400
  ```bash
265
401
  # Authentication (fetches certificate to Windows store)
266
402
  signer -login <url> [username] # Login and register certificate
267
403
  signer -logout # Logout and remove certificate
268
- signer -list # List available certificates
404
+
405
+ # File Signing (direct - same options as signercli)
406
+ signer <file> [options] # Sign a file directly
407
+ -o <path> # Output file path
408
+ -hash-only # Hash-based signing (default)
409
+ -file-upload # Upload entire file to server
410
+ -save-signed # Save with _signed suffix
411
+ -profile <name> # Use specific signing profile
412
+
413
+ # Certificate Management
414
+ signer -cert -list # List available certificates
415
+ signer -cert -list codesign # Filter by purpose
416
+ signer -cert -id # Show current certificate configuration
417
+ signer -cert -id <cert_id> # Set certificate ID
418
+ signer -cert -pem # Get certificate PEM
419
+ signer -cert -password <password> # Set private key password
269
420
 
270
421
  # KSP Provider Management
271
422
  signer -register # Register Certchip KSP provider
@@ -277,11 +428,46 @@ signer -container # List key containers
277
428
  signer -install # Install DLLs to System32
278
429
  signer -uninstall # Remove DLLs from System32
279
430
 
280
- # After login, use standard Windows signing tools
431
+ # Version & Help
432
+ signer -version # Show version and DLL info
433
+ signer -help # Show usage help
434
+
435
+ # After login, use standard Windows signing tools (signtool integration)
281
436
  signtool sign /n "Certificate Name" /fd sha256 myapp.exe
282
437
  signtool sign /sha1 <thumbprint> /fd sha256 /tr http://timestamp.digicert.com myapp.exe
283
438
  ```
284
439
 
440
+ **Examples:**
441
+ ```bash
442
+ # Direct signing with output path
443
+ signer myapp.exe -o myapp_signed.exe
444
+
445
+ # Upload entire file for signing
446
+ signer myapp.exe -file-upload -o myapp_signed.exe
447
+
448
+ # Hash-only signing with _signed suffix
449
+ signer myapp.exe -save-signed
450
+ ```
451
+
452
+ **Version Output:**
453
+
454
+ ```
455
+ # signer -version
456
+ Certchip Signer v0.1.18
457
+ Windows Key Storage Provider and Code Signing Tool
458
+ Copyright (c) 2025 Certchip. All rights reserved.
459
+
460
+ DLL Versions (Local):
461
+ otpkey.dll: 0.1.18.0
462
+ Certchip.dll: 0.1.18.0
463
+
464
+ DLL Versions (System32):
465
+ otpkey.dll: 0.1.18.0
466
+ Certchip.dll: 0.1.18.0
467
+ ```
468
+
469
+ The version output helps diagnose DLL version mismatches between local and system-wide installations.
470
+
285
471
  ---
286
472
 
287
473
  ### DLL System Installation (Windows)
@@ -371,10 +557,16 @@ signercli -config set pdf-signing \
371
557
  -doc-font-size 12 \
372
558
  -doc-opacity 0.8
373
559
 
560
+ # Create an automation profile with JSON output
561
+ signercli -config set automation \
562
+ -host https://signer.example.com \
563
+ -output-format json
564
+
374
565
  # Use the profile
375
566
  signercli -login -profile production
376
567
  signercli myapp.exe -profile production
377
568
  signercli document.pdf -profile pdf-signing
569
+ signercli -verify myapp.exe -profile automation # Outputs JSON automatically
378
570
  ```
379
571
 
380
572
  ## Supported File Types
@@ -411,7 +603,7 @@ signercli document.pdf -profile pdf-signing
411
603
  | **Platform** | Windows, Linux, macOS | Windows only |
412
604
  | **Dependencies** | None (static build) | otpkey.dll, Certchip.dll |
413
605
  | **Size** | 9.3 MB | 420 KB + 6.9 MB DLLs |
414
- | **Signing method** | Direct (via server API) | Indirect (via Windows crypto) |
606
+ | **Signing method** | Direct (via server API) | Direct OR via Windows crypto (signtool) |
415
607
  | **Windows KSP** | No | Yes |
416
608
  | **signtool compatible** | No | Yes |
417
609
  | **UAC auto-elevation** | Yes | Yes |
@@ -425,16 +617,45 @@ signercli document.pdf -profile pdf-signing
425
617
  #!/bin/bash
426
618
  set -e
427
619
 
428
- # Login
429
- signercli -login "$SIGNER_URL" "$SIGNER_USER" -key "$SSH_KEY_PATH"
620
+ # Login with JSON output for parsing
621
+ result=$(signercli -login "$SIGNER_URL" -user "$SIGNER_USER" -pw "$SIGNER_PW" -format json)
622
+ if ! echo "$result" | jq -e '.success' > /dev/null; then
623
+ echo "Login failed: $(echo "$result" | jq -r '.error')"
624
+ exit 1
625
+ fi
430
626
 
431
627
  # Sign all executables
432
628
  for exe in dist/*.exe; do
433
629
  signercli "$exe"
434
630
  done
435
631
 
436
- # Logout
437
- signercli -logout
632
+ # Logout with JSON output
633
+ signercli -logout -format json
634
+ ```
635
+
636
+ ### CI/CD Pipeline with Verification
637
+
638
+ ```bash
639
+ #!/bin/bash
640
+ set -e
641
+
642
+ # Sign and verify with JSON output
643
+ signercli -login "$SIGNER_URL" -user "$SIGNER_USER" -pw "$SIGNER_PW" -format json
644
+
645
+ for exe in dist/*.exe; do
646
+ signercli "$exe"
647
+
648
+ # Verify and parse JSON result
649
+ verify_result=$(signercli -verify "$exe" -format json)
650
+ status=$(echo "$verify_result" | jq -r '.status')
651
+
652
+ if [ "$status" != "valid" ]; then
653
+ echo "Verification failed for $exe"
654
+ exit 1
655
+ fi
656
+ done
657
+
658
+ signercli -logout -format json
438
659
  ```
439
660
 
440
661
  ### TypeScript Usage
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@certchip/signer",
3
- "version": "0.1.11",
3
+ "version": "0.1.19",
4
4
  "description": "Cross-platform code and document signing CLI tool",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",