The progress in nanofabrication has made possible the realization of optic nanodevices able to handle single photons and to exploit the quantum nature of single-photon states. In particular, quantum cryptography (or more precisely quantum key distribution, QKD) allows unconditionally secure exchange of cryptographic keys by the transmission of optical pulses each containing no more than one photon. Additionally, the coherent control of excitonic and photonic qubits is a major step forward in the field of solid-state cavity quantum electrodynamics, with potential applications in quantum computing. Here, we describe devices for realization of single photon generation and detection based on high resolution technologies and their physical properties. Particular attention will be devoted to the description of single-quantum dot sources based on photonic crystal microcavites optically and electrically driven: the electrically driven devices is an important result towards the realization of single photon source "on demand". A new class of single photon detectors, based on superconducting nanowires, the superconducting single-photon detectors (SSPDs) are also introduced: the fabrication techniques and the design proposed to obtain large area coverage and photon number-resolving capability are described.