Section 49 of the Regulation of Investigatory Powers Act 2000 requires that if you know the information required and refuse to provide it, you can be sentenced to a maximum of 2 years imprisonment.
However, the notice must be given properly in writing.
So, while these officers perhaps were deceitful in asking verbally for passwords rather than giving a written notice, the meaning of what they were saying was still correct - there is a legal requirement to hand over passwords.