The security that resides in the public-key cryptosystems relies on the presumed computational hardness of mathematical problems behind the systems themselves (e.g. the semiprime factorization problem in the RSA cryptosystem), that is because there is not known any polynomial time (classical) algorithm to solve them. The paper focuses on the computing paradigm of virus machines within the area of Unconventional Computing and Natural Computing. Virus machines, which incorporate concepts of virology and computer science, are considered as number computing devices with the environment. The paper designs a virus machine that solves a generalization of the semiprime factorization problem and verifies it formally.