  We present a general formalism and specific implementation of quantum gates
based on interaction of single photons with open dissipative nanocavities
containing ensembles of quantum emitters. Rich dynamics of entangled bright and
dark states of quantum emitters coupled to a nanocavity field gives rise to
efficient manipulation of the quantum state of an incident photon. In its
simplest implementation, an initial preparation of the state of quantum
emitters by a classical optical pulse controls the polarization state of the
reflected photon.
