it would violate law?
It would be very dependent of what your jurisdiction is and what the software does. I would expect most software that would be lawful to install at your home would be lawful to install at your company, but there may be exceptions.
To put an hyperbolic example, if you work at the CIA and you install some remote access software that allows you to access your workstation from a non-secure PC through non-secure methods, I am pretty sure that would be illegal, even if you had the best of intentions.
A recent scenario taken from real life involves some members an organization who are required to use official e-mail servers for FOIA purposes setting up their own private mail servers.
Of course, YMMV.
can I purchase it for myself, and then use at workplace
Even if the software is legal it does not mean that it is ok to use it at the workplace. Most business have rules about what software may be installed in the PCs, who may install it and how to manage it.
Your software could introduce security vulnerabilities that your IT team may need to be aware of, or incompatibilities with other software. It may introduce legal liabilities (you install a "home edition" licence in a corporate environment where that licence is invalid).
Your company may discipline you if you breaking those guidelines and install software without authorization, even if there is no harm for them for this action. On top of that, if your actions cause some damage to the company, it can sue you to get you to pay for those damages.
Before taking any action you should inquiry about your company's IT policy and, if your company does not have one or if the policy is not clear about allowing you to install the software, ask the people in charge (preferably in writting).