Scotland, Wales and Northern Ireland retain the term country or nation for historical identity reasons, not contemporary practical or relevant reasons.
But, you know, there must be legal proceedings, the court must be satisfied that the information is necessary, etc. The guy at the border can't do that, on their own initiative. But of course, they can just not let you in.
Edit: does it apply to border guards too?
There are cases of people being prosecuted under it [1], [2], [3]
[1] https://www.independent.co.uk/tech/cage-muhammad-rabbani-ant...
[2] https://www.birminghammail.co.uk/news/midlands-news/drug-sus...
[3] https://www.independent.co.uk/news/uk/crime/facebook-passwor...
Also if encryption itself is not illegal, but it is illegal to not decrypt something when asked, then encryption is effectively illegal, since you only need to convince a part of the state that you have suspicion to get it decrypted for you, a task which is really not that difficult in the modern day.
The abuse of power means they could detain him indefinitely etc (as it happens in countries where abuse of power is common). But in this case he had the right to defend himself in the court and he used it.
This is very far from the situation where encryption is illegal, all communications are transparent to the state and it can search for incriminating data without asking.