def verify_signature(public_key, scheme, signature, data):
<EOL>securesystemslib.formats.PEMECDSA_SCHEMA.check_match(public_key)<EOL>securesystemslib.formats.ECDSA_SCHEME_SCHEMA.check_match(scheme)<EOL>securesystemslib.formats.ECDSASIGNATURE_SCHEMA.check_match(signature)<EOL>ecdsa_key = load_pem_public_key(public_key.encode('<STR_LIT:utf-8>'),<EOL>backend=default_backend())<EOL>if not isinstance(ecdsa_key, ec.EllipticCurvePublicKey):<EOL><INDENT>raise securesystemslib.exceptions.FormatError('<STR_LIT>'<EOL>'<STR_LIT>' + repr(public_key))<EOL><DEDENT>else:<EOL><INDENT>logger.debug('<STR_LIT>')<EOL><DEDENT>try:<EOL><INDENT>ecdsa_key.verify(signature, data, ec.ECDSA(hashes.SHA256()))<EOL>return True<EOL><DEDENT>except (TypeError, cryptography.exceptions.InvalidSignature):<EOL><INDENT>return False<EOL><DEDENT>
<Purpose>
  Verify that 'signature' was produced by the private key associated with
  'public_key'.

  >>> scheme = 'ecdsa-sha2-nistp256'
  >>> public, private = generate_public_and_private(scheme)
  >>> data = b'The quick brown fox jumps over the lazy dog'
  >>> signature, scheme = create_signature(public, private, data, scheme)
  >>> verify_signature(public, scheme, signature, data)
  True
  >>> verify_signature(public, scheme, signature, b'bad data')
  False

<Arguments>
  public_key:
    The ECDSA public key in PEM format.  The public key is needed to verify
    'signature'.

  scheme:
    The signature scheme used to generate 'signature'.  For example:
    'ecdsa-sha2-nistp256'.

  signature:
    The signature to be verified, which should have been generated by
    the private key associated with 'public_key'.  'data'.

  data:
    Byte data that was used by create_signature() to generate 'signature'.

<Exceptions>
  securesystemslib.exceptions.FormatError, if any of the arguments are
  improperly formatted.

  securesystemslib.exceptions.UnsupportedAlgorithmError, if 'scheme' is
  not one of the supported signature schemes.

<Side Effects>
  None.

<Returns>
  Boolean, indicating whether the 'signature' of data was generated by
  the private key associated with 'public_key'.