def create_ecdsa_public_and_private_from_pem(pem, password=None):
<EOL>securesystemslib.formats.PEMECDSA_SCHEMA.check_match(pem)<EOL>if password is not None:<EOL><INDENT>securesystemslib.formats.PASSWORD_SCHEMA.check_match(password)<EOL>password = password.encode('<STR_LIT:utf-8>')<EOL><DEDENT>else:<EOL><INDENT>logger.debug('<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>public = None<EOL>private = None<EOL>try:<EOL><INDENT>private = load_pem_private_key(pem.encode('<STR_LIT:utf-8>'), password=password,<EOL>backend=default_backend())<EOL><DEDENT>except (ValueError, cryptography.exceptions.UnsupportedAlgorithm) as e:<EOL><INDENT>raise securesystemslib.exceptions.CryptoError('<STR_LIT>'<EOL>'<STR_LIT>' + str(e))<EOL><DEDENT>public = private.public_key()<EOL>private = private.private_bytes(encoding=serialization.Encoding.PEM,<EOL>format=serialization.PrivateFormat.TraditionalOpenSSL,<EOL>encryption_algorithm=serialization.NoEncryption())<EOL>public = public.public_bytes(encoding=serialization.Encoding.PEM,<EOL>format=serialization.PublicFormat.SubjectPublicKeyInfo)<EOL>return public.decode('<STR_LIT:utf-8>'), private.decode('<STR_LIT:utf-8>')<EOL>
<Purpose>
  Create public and private ECDSA keys from a private 'pem'.  The public and
  private keys are strings in PEM format:

  public: '-----BEGIN PUBLIC KEY----- ... -----END PUBLIC KEY-----',
  private: '-----BEGIN EC PRIVATE KEY----- ... -----END EC PRIVATE KEY-----'}}

  >>> junk, private = generate_public_and_private()
  >>> public, private = create_ecdsa_public_and_private_from_pem(private)
  >>> securesystemslib.formats.PEMECDSA_SCHEMA.matches(public)
  True
  >>> securesystemslib.formats.PEMECDSA_SCHEMA.matches(private)
  True
  >>> passphrase = 'secret'
  >>> encrypted_pem = create_ecdsa_encrypted_pem(private, passphrase)
  >>> public, private = create_ecdsa_public_and_private_from_pem(encrypted_pem, passphrase)
  >>> securesystemslib.formats.PEMECDSA_SCHEMA.matches(public)
  True
  >>> securesystemslib.formats.PEMECDSA_SCHEMA.matches(private)
  True

<Arguments>
  pem:
    A string in PEM format.  The private key is extracted and returned in
    an ecdsakey object.

  password: (optional)
    The password, or passphrase, to decrypt the private part of the ECDSA key
    if it is encrypted.  'password' is not used directly as the encryption
    key, a stronger encryption key is derived from it.

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

  securesystemslib.exceptions.UnsupportedAlgorithmError, if the ECDSA key
  pair could not be extracted, possibly due to an unsupported algorithm.

<Side Effects>
  None.

<Returns>
  A dictionary containing the ECDSA keys and other identifying information.
  Conforms to 'securesystemslib.formats.ECDSAKEY_SCHEMA'.