Refactor token parsing to keep data in a tree
Refactor token parsing to keep data in a tree of TokenItem objects.
For each data item the Claim type is stored.
Change-Id: I8bd33b51b7fb8ff86bfdce8ffe3c0c7f9bac5895
Signed-off-by: Mate Toth-Pal <mate.toth-pal@arm.com>
diff --git a/iat-verifier/scripts/check_iat b/iat-verifier/scripts/check_iat
index 80a1dfc..f8b1279 100755
--- a/iat-verifier/scripts/check_iat
+++ b/iat-verifier/scripts/check_iat
@@ -153,9 +153,9 @@
with open(args.tokenfile, 'rb') as token_file:
token = verifier.parse_token(
token=token_file.read(),
- verify=True,
check_p_header=args.check_protected_header,
lower_case_key=False)
+ token.verify()
if key_checked:
print('Signature OK')
print('Token format OK')
@@ -165,7 +165,8 @@
if args.print_iat:
print('Token:')
- json.dump(recursive_bytes_to_strings(token, in_place=True),
+ token_map = token.get_token_map()
+ json.dump(recursive_bytes_to_strings(token_map, in_place=True),
sys.stdout, indent=4)
print('')
diff --git a/iat-verifier/scripts/decompile_token b/iat-verifier/scripts/decompile_token
index c9b7f37..491263b 100755
--- a/iat-verifier/scripts/decompile_token
+++ b/iat-verifier/scripts/decompile_token
@@ -80,9 +80,8 @@
with open(args.source, 'rb') as fh:
token_map = verifier.parse_token(
token=fh.read(),
- verify=False,
check_p_header=False,
- lower_case_key=True)
+ lower_case_key=True).get_token_map()
if args.outfile:
with open(args.outfile, 'w', encoding="UTF-8") as wfh: