A method is developed for exact treatment of the general pairing problem in a finite Fermi-system. The method is based on SU(2) quasispin algebras that are present in the problem. We show examples of practical applications of the method and its comparison with approximate treatments.