Also, it is very much a western thing. I have a lot of Indian friends and they happily trade salary information amongst each other. This reduces any informational asymmetry that exists in such situations.
It's not a taboo thing. In my contracts I've had always clause that all the information are confidential, including salary amount. And I can be sued by company if I break the agreement.
How can such a thing be legally binding. Did you tell your wife? Can they sue for that? What if you're not married to your partner? Your bank and every person who has seen your bank statement (a lot of people) knows what you're earning. Can they sue for that?
It's allowed to say that to your spouse. I think the regulation is just to prevent from publishing on web page or sending email with your real documents. If there is leak from the bank, the bank is responsible. In practice you talk about your salaries but in unofficial way, with a beer in a pub, but you never show the official contract.
The other interesting thing is clause about installing not approved application on your laptop. Everybody does it - your favourite editor, messenger, file manager etc. But when they want to fire you, they say that you've broken the rule and you're going to be sued unless you agree to leave company immediately without any punishment.