'Generate a new private key on the named curve.'

def generate_elliptic_curve_private_key(self, curve):

    if self.elliptic_curve_supported(curve):
        curve_nid = self._elliptic_curve_to_nid(curve)
        ec_cdata = self._lib.EC_KEY_new_by_curve_name(curve_nid)
        self.openssl_assert((ec_cdata != self._ffi.NULL))
        ec_cdata = self._ffi.gc(ec_cdata, self._lib.EC_KEY_free)
        res = self._lib.EC_KEY_generate_key(ec_cdata)
        self.openssl_assert((res == 1))
        res = self._lib.EC_KEY_check_key(ec_cdata)
        self.openssl_assert((res == 1))
        evp_pkey = self._ec_cdata_to_evp_pkey(ec_cdata)
        return _EllipticCurvePrivateKey(self, ec_cdata, evp_pkey)
    else:
        raise UnsupportedAlgorithm('Backend    object    does    not    support    {0}.'.format(curve.name), _Reasons.UNSUPPORTED_ELLIPTIC_CURVE)
