@@ -467,6 +467,10 @@ def verify_signature(fname, sfname, public_crt='public.crt', ca_crt='ca-root.crt
467
467
return STATUS.VERIFIED if both the signature and the CA sig match
468
468
"""
469
469
log_level = log .debug
470
+ if fname is None or sfname is None :
471
+ status = STATUS .UNKNOWN
472
+ log_level ('fname=%s or sfname=%s is Nones => status=%s' , fname , sfname , status )
473
+ return status
470
474
short_fname = fname .split ('/' )[- 1 ]
471
475
try :
472
476
with open (sfname , 'r' ) as fh :
@@ -477,7 +481,7 @@ def verify_signature(fname, sfname, public_crt='public.crt', ca_crt='ca-root.crt
477
481
if check_verif_timestamp (verif_key ):
478
482
log_level = log .error
479
483
log_level ('%s | file "%s" | status: %s ' , short_fname , fname , status )
480
- return STATUS . UNKNOWN
484
+ return status
481
485
x509 = X509AwareCertBucket (public_crt , ca_crt )
482
486
hasher , chosen_hash = hash_target (fname , obj_mode = True )
483
487
digest = hasher .finalize ()
@@ -535,8 +539,14 @@ def verify_files(targets, mfname='MANIFEST', sfname='SIGNATURE', public_crt='pub
535
539
return a mapping from the input target list to the status values (a dict of filename: status)
536
540
"""
537
541
542
+ if mfname is None :
543
+ mfname = 'MANIFEST'
544
+ if sfname is None :
545
+ sfname = 'SIGNATURE'
546
+
538
547
log .debug ("verifying: files: %s | mfname: %s | sfname: %s | public_crt: %s| ca_crt: %s" ,
539
548
targets , mfname , sfname , public_crt , ca_crt )
549
+
540
550
ret = OrderedDict ()
541
551
ret [mfname ] = verify_signature (mfname , sfname = sfname , public_crt = public_crt , ca_crt = ca_crt )
542
552
# ret[mfname] is the strongest claim we can make about the files we're
0 commit comments