def generate_public_and_private(scheme='<STR_LIT>'):
<EOL>securesystemslib.formats.ECDSA_SCHEME_SCHEMA.check_match(scheme)<EOL>public_key = None<EOL>private_key = None<EOL>if scheme == '<STR_LIT>':<EOL><INDENT>private_key = ec.generate_private_key(ec.SECP256R1, default_backend())<EOL>public_key = private_key.public_key()<EOL><DEDENT>else: <EOL><INDENT>raise securesystemslib.exceptions.UnsupportedAlgorithmError('<STR_LIT>'<EOL>'<STR_LIT>' + repr(scheme) + '<STR_LIT>'<EOL>'<STR_LIT>' + repr(_SUPPORTED_ECDSA_SCHEMES))<EOL><DEDENT>private_pem = private_key.private_bytes(encoding=serialization.Encoding.PEM,<EOL>format=serialization.PrivateFormat.TraditionalOpenSSL,<EOL>encryption_algorithm=serialization.NoEncryption())<EOL>public_pem = public_key.public_bytes(encoding=serialization.Encoding.PEM,<EOL>format=serialization.PublicFormat.SubjectPublicKeyInfo)<EOL>return public_pem.decode('<STR_LIT:utf-8>'), private_pem.decode('<STR_LIT:utf-8>')<EOL>
<Purpose>
  Generate a pair of ECDSA public and private keys with one of the supported,
  external cryptography libraries.  The public and private keys returned
  conform to 'securesystemslib.formats.PEMECDSA_SCHEMA' and
  'securesystemslib.formats.PEMECDSA_SCHEMA', respectively.

  The public ECDSA public key has the PEM format:
  TODO: should we encrypt the private keys returned here?  Should the
  create_signature() accept encrypted keys?

  '-----BEGIN PUBLIC KEY-----

  ...

  '-----END PUBLIC KEY-----'



  The private ECDSA private key has the PEM format:

  '-----BEGIN EC PRIVATE KEY-----

  ...

  -----END EC PRIVATE KEY-----'

  >>> public, private = generate_public_and_private()
  >>> securesystemslib.formats.PEMECDSA_SCHEMA.matches(public)
  True
  >>> securesystemslib.formats.PEMECDSA_SCHEMA.matches(private)
  True

<Arguments>
  scheme:
    A string indicating which algorithm to use for the generation of the
    public and private ECDSA keys.  'ecdsa-sha2-nistp256' is the only
    currently supported ECDSA algorithm, which is supported by OpenSSH and
    specified in RFC 5656 (https://tools.ietf.org/html/rfc5656).

<Exceptions>
  securesystemslib.exceptions.FormatError, if 'algorithm' is improperly
  formatted.

  securesystemslib.exceptions.UnsupportedAlgorithmError, if 'scheme' is an
  unsupported algorithm.

<Side Effects>
  None.

<Returns>
  A (public, private) tuple that conform to
  'securesystemslib.formats.PEMECDSA_SCHEMA' and
  'securesystemslib.formats.PEMECDSA_SCHEMA', respectively.