What a company must legally do today if they intend to mine an asteroid is:
a) Be based in either the US or Luxembourg, the only two countries with asteroid mining laws.
b) Obtain the proper licenses for launching and operating space vehicles.
c) Pray there is no international outcry regarding their mining activities.
A country cannot own an asteroid, according to Article II of the Outer Space Treaty: Outer space, including the Moon and other celestial bodies, is not subject to national appropriation by claim of sovereignty, by means of use or occupation, or by any other means.
The debate right now is whether a government can grant ownership of mined materials to one of its companies given that the government cannot own the asteroid where these materials were mined from. Those is favour of asteroid (and generally Space) mining argue that Space should be like the high seas: Nobody owns them, but there are international agreements that allow companies to fish there, and own whatever fish they pull out, thus giving them the right to profit from the high seas without an implied ownership.
It's entirely possible that this issue won't be resolved until a company actually goes out and mines an asteroid, and then the international community will have to decide whether they're OK with that company owning the material they harvested. The company's lawyers, and probably the company's government, will point to the 1958 Convention on the High Seas (since superseded and updated) and say "it's the same thing as fishing in the high seas!".
You might want to read another answer I give to a similar question:
https://space.stackexchange.com/a/26065/23624