Is there a way to make sure the stocks I bought are really mine using some 3rd party service or governmental authority and not involving the broker which firm I used to buy shares?
At least on a day-to-day basis, probably not. But that doesn't mean there aren't protections in place (at least in large parts of the world) to mitigate the risks.
Nowadays, almost all shares bought through a broker will be held in a Nominee Account. As this Investopedia page says:
An investor's shares are legally owned by a stockbroker's non-trading subsidiary, or nominee company. The investor is the stock's beneficial owner and has rights over the shares. The stockbroker records all beneficial owners, trades according to an investor's directions, and passes cash from sales or dividends to an investor.
As far as the company that issued the shares is concerned, the stockbroker's nominee company owns the shares: they, in general, will not know of you, nor of your beneficial interest in the shares.
However, at least where strong regulation is in place, this does not mean that you are unprotected: the "nominee company" is required to be a legally separate entity from the stockbroker itself. As the same article goes on to say:
Because a non-trading company owns the shares, an investor's assets are legally separate from the stockbroker's assets and liabilities. If the broker becomes insolvent, the investor's stocks are protected from creditors.
This protects your assets from being seized by a broker's creditor, but – because the stockbroker has the power to buy and sell the shares held in the nominee account – cannot prevent out-and-out fraud by a stockbroker. To counter that threat:
Most major markets offer investor compensation, covering assets held by a stockbroker. Investors are compensated up to a set amount if assets are missing from their accounts and the broker cannot offer the difference in cash.
Obviously, relying on the records of a (potentially) fraudulent stockbroker could make proving who owns ("is the beneficial owner of") the shares in a nominee account difficult. It seems regulators/exchanges may keep their own records (but these may not be completely up to date):
Although regulators and exchanges periodically check up on nominee accounts' holdings, the process is not performed on a daily basis.
So, while I don't believe there are "public registers" of the beneficial owners of shares in nominee accounts, regulators/exchanges may have independent (albeit slightly out of date) lists that presumably can be used to verify compensation claims.
Alternatives
You could go for "old fashioned" physical, paper certificates. While these are about as safe as you can get (provided they aren't stolen, eaten by a dog or burnt in a fire), they are not as convenient when buying or selling.
In some places, it may be possible to have electronic shares held directly in your name, but this is uncommon or simply not possible in many countries:
Having stocks recorded in your own name at the central securities depository is uncommon in most countries and not possible or awkward in many. There are some exceptions, such as Singapore, where most local brokerage accounts require you to have your own account at the Central Depository (CDP), or the UK, where the process of having a personal account at CREST is simple, if rarely done by most investors.
The above is from How safe are stock broker nominee accounts? at The International Investor. That article also notes that there are two types of nominee account:
The most common is a "pooled" account: shares from many different customers are held in the same account. Only the stockbroker's records (or copies taken by the regulators) can show whose shares are whose.
Less common (at least for individual investors) are sole nominee accounts. Here there is a one-to-one mapping between the name entered on a company's share register (that of the nominee account) and the beneficial owner (you).
However, that article also goes on to note that neither of the "electronic" alternatives may – in practice – be significantly safer than a pooled account:
Some investors also feel that having shares directly registered in your name through the central securities depository (where this is possible) rather than through a nominee account is safer. Whether this is true is debatable.
Under most systems, regardless of what name the stocks are in, your stock broker still has access to them to sell them – otherwise they wouldn’t be able to carry out your trades. So that means they could choose to sell them fraudulently without your instructions, just as they could in a nominee account.
It goes on to speculate that pooled accounts may get "raided" by fraudulent broker ahead of named nominee accounts, and notes that having a named nominee account will probably speed up the process of compensation, but ends:
So there may be some limited security advantages to holding [electronic] shares in your name, in addition to other advantages being on the register of shareholders brings. But generally it won’t provide complete protection.