def verify_signature(uid, signed_cert_file_name, issuing_address):
    """
    Verify the certificate signature matches the expected. Double-check the uid field in the certificate and use
    VerifyMessage to confirm that the signature in the certificate matches the issuing_address.

    Raises error is verification fails.

    Raises UnverifiedSignatureError if signature is invalid

    :param uid:
    :param signed_cert_file_name:
    :param issuing_address:
    :return:
    """

    logging.info('verifying signature for certificate with uid=%s:', uid)
    with open(signed_cert_file_name) as in_file:
        signed_cert = in_file.read()
        signed_cert_json = json.loads(signed_cert)
        to_verify = uid
        signature = signed_cert_json['signature']
        verified = verify_message(issuing_address, to_verify, signature)
        if not verified:
            error_message = 'There was a problem with the signature for certificate uid={}'.format(uid)
            raise UnverifiedSignatureError(error_message)

        logging.info('verified signature')
def verify_signature ( uid , signed_cert_file_name , issuing_address ) : logging . info ( 'verifying signature for certificate with uid=%s:' , uid ) with open ( signed_cert_file_name ) as in_file : signed_cert = in_file . read ( ) signed_cert_json = json . loads ( signed_cert ) to_verify = uid signature = signed_cert_json [ 'signature' ] verified = verify_message ( issuing_address , to_verify , signature ) if not verified : error_message = 'There was a problem with the signature for certificate uid={}' . format ( uid ) raise UnverifiedSignatureError ( error_message ) logging . info ( 'verified signature' )
Verify the certificate signature matches the expected. Double-check the uid field in the certificate and use
    VerifyMessage to confirm that the signature in the certificate matches the issuing_address.

    Raises error is verification fails.

    Raises UnverifiedSignatureError if signature is invalid

    :param uid:
    :param signed_cert_file_name:
    :param issuing_address:
    :return: