Skip to content

Commit 270714d

Browse files
committed
Add option for weak verification
Add the option to pass only an assembly path to `signcode.verify` and skip the leaf hash check. This is useful if the only goal is to check for the presence of a signature.
1 parent f483f6c commit 270714d

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

index.js

+8-3
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,16 @@ function spawnVerify (options, callback) {
134134
var args = [
135135
'verify',
136136
'-in',
137-
options.path,
138-
'-require-leaf-hash',
139-
options.hash
137+
options.path
140138
]
141139

140+
if (options.hash != null) {
141+
args.push(
142+
'-require-leaf-hash',
143+
options.hash
144+
)
145+
}
146+
142147
var signcode = ChildProcess.spawn(getSigncodePath(), args)
143148

144149
var stdout = ''

test/signcode-test.js

+7
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,13 @@ describe('signcode', function () {
214214
})
215215

216216
describe('.verify(options)', function () {
217+
it('verifies the presence of a signature on the executable', function (done) {
218+
var verifyOptions = {
219+
path: path.join(__dirname, 'fixtures', 'electron-signed.exe')
220+
}
221+
signcode.verify(verifyOptions, done)
222+
})
223+
217224
it('verifies the sha1 signature on the executable', function (done) {
218225
var verifyOptions = {
219226
hash: 'sha1:9BF51511E06FA5FFE1CE408584B9981AA4EFE7EA',

0 commit comments

Comments
 (0)