Sign files unattended in batch mode while having an eToken (no password popup!) (updated)

Expanding on answers already in this thread, it is possible to provide the token password using the standard signtool program from microsoft.

1. Export your public certificate to a file from the SafeNet Client 

2. Find your private key container name

 

3. Find your reader name 

4. Format it all together

The eToken CSP has hidden (or at least not widely advertised) functionality to parse the token password out of the container name.

The format is one of the following

[]=name
[reader]=name
[{{password}}]=name
[reader{{password}}]=name

Where:

  • reader is the “Reader name” from the SafeNet Client UI
  • password is your token password
  • name is the “Container name” from the SafeNet Client UI

Presumably you must specify the reader name if you have more than one reader connected – as I only have one reader I cannot confirm this.

5. Pass the information to signtool

  • /f certfile.cer
  • /csp "eToken Base Cryptographic Provider"
  • /k "<value from step 4>"
  • any other signtool flags you require

Example signtool command as follows

signtool sign /f mycert.cer /csp "eToken Base Cryptographic Provider" /k "[{{TokenPasswordHere}}]=KeyContainerNameHere" myfile.exe




Update:
This doesn't work after updating the key.
Check this thread for more details:
https://stackoverflow.com/questions/17927895/automate-extended-validation-ev-code-signing

© Copyright 2019 Sorin Mustaca, All rights Reserved. Written For: Sorin Mustaca on Cybersecurity


Check www.endpoint-cybersecurity.com for seeing the consulting services we offer.

Visit www.itsecuritynews.info for latest security news in English
Besuchen Sie de.itsecuritynews.info für IT Sicherheits News auf Deutsch