because he refused to hand over the local passwords for his devices.
I am not saying what the CBSA did was legal (as the case was dropped), but not handing over local passwords is considered "obstruction of the officer's job" by the CBSA (for which he was charged).
So I'm assuming that if they did want to charge you, they could.