Skip to content

Commit

Permalink
add verify levels to verify script
Browse files Browse the repository at this point in the history
  • Loading branch information
seiya-git committed Nov 10, 2023
1 parent bd2b8db commit 88f129c
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions py/nstools/lib/Verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ def parse_name(file: str):
'version': version,
}

def verify(file: str):
def verify(file: str, vlevel: int = 3):
if vlevel not in range(1, 3, 1):
vlevel = 3

try:
filename = os.path.abspath(file)

Expand All @@ -84,13 +87,15 @@ def verify(file: str):
if check_decrypt == False:
check = False

check_sig, headerlist, vmsg = verify_sig(f, vmsg)
if check_sig == False:
check = False
if vlevel > 1:
check_sig, headerlist, vmsg = verify_sig(f, vmsg)
if check_sig == False:
check = False

check_hash, vmsg = verify_hash(f, headerlist, vmsg)
if check_hash == False:
check = False
if vlevel > 2:
check_hash, vmsg = verify_hash(f, headerlist, vmsg)
if check_hash == False:
check = False

f.flush()
f.close()
Expand Down

0 comments on commit 88f129c

Please sign in to comment.