@@ -137,12 +137,13 @@ def download_lines_with_urllib(url) -> t.Tuple[bool, t.List[str]]:
137137
138138
139139def verify_with_gpg (
140+ filename ,
140141 signature_filename ,
141142 output_filename : t .Optional [str ] = None
142143) -> t .Tuple [int , str ]:
143144 args = [
144- 'gpg' , '--yes' , '--decrypt ' , '--verify-options' , 'show-primary-uid-only' ,
145- '--output' , output_filename if output_filename else '' , signature_filename ]
145+ 'gpg' , '--yes' , '--verify ' , '--verify-options' , 'show-primary-uid-only' ,
146+ '--output' , output_filename if output_filename else '' , signature_filename , filename ]
146147
147148 env = dict (os .environ , LANGUAGE = 'en' )
148149 result = subprocess .run (args , stderr = subprocess .STDOUT , stdout = subprocess .PIPE , env = env )
@@ -332,13 +333,13 @@ def join_url(host: str) -> str:
332333 return ReturnCode .SUCCESS
333334
334335
335- def check_multisig (sigfilename : Path , args : argparse .Namespace ) -> t .Tuple [int , str , t .List [SigData ], t .List [SigData ], t .List [SigData ]]:
336+ def check_multisig (sums_file : str , sigfilename : str , args : argparse .Namespace ) -> t .Tuple [int , str , t .List [SigData ], t .List [SigData ], t .List [SigData ]]:
336337 # check signature
337338 #
338339 # We don't write output to a file because this command will almost certainly
339340 # fail with GPG exit code '2' (and so not writing to --output) because of the
340341 # likely presence of multiple untrusted signatures.
341- retval , output = verify_with_gpg (sigfilename )
342+ retval , output = verify_with_gpg (sums_file , sigfilename )
342343
343344 if args .verbose :
344345 log .info (f"gpg output:\n { indent (output )} " )
@@ -356,7 +357,7 @@ def check_multisig(sigfilename: Path, args: argparse.Namespace) -> t.Tuple[int,
356357 log .warning (f"failed to retrieve key { unsig .key } " )
357358
358359 # Reparse the GPG output now that we have more keys
359- retval , output = verify_with_gpg (sigfilename )
360+ retval , output = verify_with_gpg (sums_file , sigfilename )
360361 good , unknown , bad = parse_gpg_result (output .splitlines ())
361362
362363 return retval , output , good , unknown , bad
@@ -377,7 +378,7 @@ def verify_shasums_signature(
377378 min_good_sigs = args .min_good_sigs
378379 gpg_allowed_codes = [0 , 2 ] # 2 is returned when untrusted signatures are present.
379380
380- gpg_retval , gpg_output , good , unknown , bad = check_multisig (signature_file_path , args )
381+ gpg_retval , gpg_output , good , unknown , bad = check_multisig (sums_file_path , signature_file_path , args )
381382
382383 if gpg_retval not in gpg_allowed_codes :
383384 if gpg_retval == 1 :
0 commit comments