Something being illegal does not imply it doesn't happen though.
and recent Supreme Court decision that upheld its constitutionality:
https://www.algoodbody.com/insights-publications/password-pr...
Suing after the fact is a valid strategy and in free countries this would allow you to exclude illegally obtained evidence or evidence lacking proper chain of custody.