Context. Our knowledge of high-mass star formation has been mainly based on follow-up studies of bright sources found by IRAS, and has thus been incomplete for its earliest phases, which are inconspicuous at infrared wavelengths. With a new generation of powerful bolometer arrays, unbiased large-scale surveys of nearby high-mass star-forming complexes now search for the high-mass analog of low-mass cores and class 0 protostars. Aims. Following the pioneering study of Cygnus X, we investigate the star-forming region NGC 6334-NGC 6357 (∼1.7 kpc). Methods. We study the complex NGC 6334-NGC 6357 in an homogeneous way following the previous work of Motte and collaborators. We used the same method to extract the densest cores which are the most likely sites for high-mass star formation. We analyzed the SIMBA/SEST 1.2 mm data presented in Munoz and coworkers, which covers all high-column density areas (A v ≥ 15 mag) of the NGC 6334-NGC 6357 complex and extracted dense cores following the method used for Cygnus X. We constrain the properties of the most massive dense cores (M > 100 M ) using new molecular line observations (as SiO, N 2 H + ,H 13 CO + , HCO + (1-0) and CH 3 CN) with Mopra and a complete cross-correlation with infrared databases (MSX, GLIMPSE, MIPSGAL) and literature. Results. We extracted 163 massive dense cores of which 16 are more massive than 200 M . These high-mass dense cores have a typical FWHM size of 0.37 pc, an average mass of M ∼ 600 M , and a volume-averaged density of ∼1.5 × 10 5 cm −3 . Among these massive dense cores, 6 are good candidates for hosting high-mass infrared-quiet protostars, 9 cores are classified as high-luminosity infrared protostars, and we find only one high-mass starless clump (∼0.3 pc, ∼4 × 10 4 cm −3 ) that is gravitationally bound. Conclusions. Since our sample is derived from a single molecular complex and covers every embedded phase of high-mass star formation, it provides a statistical estimate of the lifetime of massive stars. In contrast to what is found for low-mass class 0 and class I phases, the infrared-quiet protostellar phase of high-mass stars may last as long as their more well known high-luminosity infrared phase. As in Cygnus X, the statistical lifetime of high-mass protostars is shorter than found for nearby, low-mass star-forming regions which implies that high-mass pre-stellar and protostellar cores are in a dynamic state, as expected in a molecular cloud where turbulent and/or dynamical processes dominate.