It is absolutely legal, as long as you can prove that the funds weren’t obtained as a part of a fraudulent scheme.