def verify_certificate(certificate_model, options=None): if options is None: options = {} try: is_issued_on_smartcontract = certificate_model.certificate_json[ "signature"]["anchors"][0]["type"] == "ETHSmartContract" except (TypeError, KeyError): is_issued_on_smartcontract = False messages = [] if is_issued_on_smartcontract: verification_steps = create_verification_steps( certificate_model, is_issued_on_smartcontract=is_issued_on_smartcontract) verification_steps.execute() verification_steps.add_detailed_status(messages) else: # lookup issuer-hosted information issuer_info = connectors.get_issuer_info(certificate_model) # lookup transaction information connector = connectors.createTransactionLookupConnector( certificate_model.chain, options) transaction_info = connector.lookup_tx(certificate_model.txid) # create verification plan verification_steps = create_verification_steps(certificate_model, transaction_info, issuer_info, certificate_model.chain) verification_steps.execute() verification_steps.add_detailed_status(messages) printer.print_issuer_information(certificate_model.certificate_json) printer.print_verification_information(messages) return messages
def verify_certificate(certificate_model): # lookup issuer-hosted information issuer_info = connectors.get_issuer_info(certificate_model) # lookup transaction information chain = parse_chain_from_address(issuer_info.issuer_keys[0].public_key) connector = connectors.createTransactionLookupConnector(chain) transaction_info = connector.lookup_tx(certificate_model.txid) # create verification plan verification_steps = create_verification_steps(certificate_model, transaction_info, issuer_info, chain) verification_steps.execute() messages = [] verification_steps.add_detailed_status(messages) for message in messages: print(message['name'] + ',' + str(message['status'])) return messages
def verify_certificate(certificate_model, options={}): # lookup issuer-hosted information issuer_info = connectors.get_issuer_info(certificate_model) # lookup transaction information connector = connectors.createTransactionLookupConnector( certificate_model.chain, options) transaction_info = connector.lookup_tx(certificate_model.txid) # create verification plan verification_steps = create_verification_steps(certificate_model, transaction_info, issuer_info, certificate_model.chain) verification_steps.execute() messages = [] verification_steps.add_detailed_status(messages) for message in messages: print(message['name'] + ',' + str(message['status'])) return messages