def generate_ec_key
      OpenSSL::PKey::EC.new.tap do |ec|
        ec.group = OpenSSL::PKey::EC::Group.new(CURVE_NAME)
        ec.generate_key
        # https://bugs.ruby-lang.org/issues/8177
        ec.define_singleton_method(:private?) { private_key? }
        ec.define_singleton_method(:public?) { public_key? }
      end
    end
def generate_ec_key
      OpenSSL::PKey::EC.new.tap do |ec|
        ec.group = OpenSSL::PKey::EC::Group.new(CURVE_NAME)
        ec.generate_key
        # https://bugs.ruby-lang.org/issues/8177
        ec.define_singleton_method(:private?) { private_key? }
        ec.define_singleton_method(:public?) { public_key? }
      end
    end
Generate an eliptic curve public/private key.

 Returns a OpenSSL::PKey::EC instance.