def display_data(self, blob, title=None, indent=""): """Display the payload referenced by a single TFTF header""" # Print the title line title_string = indent if title: title_string += title title_string += "({0:d} bytes): {1:s}".format( self.section_length, self.section_name(self.section_type)) print(title_string) # Print the data blob if self.section_type == TFTF_SECTION_TYPE_SIGNATURE: # Signature blocks have a known format which we can break down # for the user sig_block = unpack_from("<LL64s", blob, 0) sig_type = tftf_signature_names[sig_block[1]] if not sig_type: sig_type = "UNKNOWN" print("{0:s} Length: {1:08x}".format(indent, sig_block[0])) print("{0:s} Sig. type: {1:d} ({2:s})". format(indent, sig_block[1], sig_type)) print("{0:s} Key name:".format(indent)) print("{0:s} '{1:4s}'".format(indent, sig_block[2])) print("{0:s} Signature:".format(indent)) display_binary_data(blob[TFTF_SIGNATURE_OFF_KEY_SIGNATURE:], True, indent + " ") else: # The default is to show the blob as a binary dump. display_binary_data(blob, False, indent + " ") print("")
def display(self, indent=""): """Display the signature block""" signature_name = get_signature_algorithm_name(self.signature_type) print("{0:s} Length: {1:08x}".format(indent, self.length)) print("{0:s} Sig. type: {1:d} ({2:s})".format( indent, self.signature_type, signature_name)) print("{0:s} Key name:".format(indent)) print("{0:s} '{1:4s}'".format(indent, self.key_name)) print("{0:s} Signature:".format(indent)) display_binary_data(self.signature, True, indent + " ")
def display(self, indent=""): """Display the signature block""" try: signature_name = tftf_signature_names[self.signature_type] except: signature_name = "INVALID" print("{0:s} Length: {1:08x}".format(indent, self.length)) print("{0:s} Sig. type: {1:d} ({2:s})".format(indent, self.signature_type, signature_name)) print("{0:s} Key name:".format(indent)) print("{0:s} '{1:4s}'".format(indent, self.key_name)) print("{0:s} Signature:".format(indent)) display_binary_data(self.signature, True, indent + " ")
def display(self, indent=""): """Display the signature block""" try: signature_name = tftf_signature_names[self.signature_type] except: signature_name = "INVALID" print("{0:s} Length: {1:08x}".format(indent, self.length)) print("{0:s} Sig. type: {1:d} ({2:s})".format( indent, self.signature_type, signature_name)) print("{0:s} Key name:".format(indent)) print("{0:s} '{1:4s}'".format(indent, self.key_name)) print("{0:s} Signature:".format(indent)) display_binary_data(self.signature, True, indent + " ")
def display_data(self, blob, title=None, indent=""): """Display the payload referenced by a single TFTF header""" # Print the title line title_string = indent if title: title_string += title title_string += "({0:d} bytes): {1:s}".format( self.section_length, self.section_name(self.section_type)) print(title_string) # Print the data blob if self.section_type == TFTF_SECTION_TYPE_SIGNATURE: # Signature blocks have a known format which we can break down # for the user signature_block = SignatureBlock(blob) signature_block.display() else: # The default is to show the blob as a binary dump. display_binary_data(blob, False, indent + " ") print("")