Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 47 additions & 45 deletions src/sign-with-signtool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,51 +11,53 @@ function getSigntoolArgs(options: InternalSignToolOptions) {
// https://learn.microsoft.com/en-us/dotnet/framework/tools/signtool-exe
const { certificateFile, certificatePassword, hash, timestampServer } = options;
const args = ['sign'];

// Automatically select cert
if (options.automaticallySelectCertificate) {
args.push('/a');
}

// Dual-sign
if (options.appendSignature) {
args.push('/as');
}

// Timestamp
if (hash === HASHES.sha256) {
args.push('/tr', timestampServer);
args.push('/td', hash);
} else {
args.push('/t', timestampServer);
}

// Certificate file
if (certificateFile) {
args.push('/f', path.resolve(certificateFile));
}

// Certificate password
if (certificatePassword) {
args.push('/p', certificatePassword);
}

// Hash
args.push('/fd', hash);

// Description
if (options.description) {
args.push('/d', options.description);
}

// Website
if (options.website) {
args.push('/du', options.website);
}

// Debug
if (options.debug) {
args.push('/debug');
if(!options.noDefaultParams)
{
// Automatically select cert
if (options.automaticallySelectCertificate) {
args.push('/a');
}

// Dual-sign
if (options.appendSignature) {
args.push('/as');
}

// Timestamp
if (hash === HASHES.sha256) {
args.push('/tr', timestampServer);
args.push('/td', hash);
} else {
args.push('/t', timestampServer);
}

// Certificate file
if (certificateFile) {
args.push('/f', path.resolve(certificateFile));
}

// Certificate password
if (certificatePassword) {
args.push('/p', certificatePassword);
}

// Hash
args.push('/fd', hash);

// Description
if (options.description) {
args.push('/d', options.description);
}

// Website
if (options.website) {
args.push('/du', options.website);
}

// Debug
if (options.debug) {
args.push('/debug');
}
}

if (options.signWithParams) {
Expand Down
7 changes: 7 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,13 @@ export interface OptionalSignToolOptions {
* Hash algorithms to use for signing.
*/
hashes?: HASHES[];
/**
* Do not populate parameters being passed to `signtool.exe`. Rely completely on {@link signWithParams}.
*
* @defaultValue false
*/
noDefaultParams?: boolean,

}

/**
Expand Down