We propose here a universal algorithm indented for calculation of the optical characteristics of two-layer spherical particles with homogeneous core and cover. The algorithm allows calculating without any limitation on the radius and values of the complex refractive indices of the core and the cover, while being sufficiently accurate for simulations of the optical properties of atmospheric aerosol. The algorithm is based on the conversion of formulas for the coefficients of Mie series which allows to avoid calculations of the Riccati-Bessel functions of the complex argument, that provides its stability when computing. The asymptotic formulas have been derived for the case of big particles with strongly absorbing cover. The algorithm has been tested by comparing with independent calculations as well as using special tests for the cases of very small and very big particles.