BCCLA has written a clear, easy-to-understand guide for Canadians about issues that are far from clear or easy to understand:
The first thing to remember if you’re a Canadian travelling to the United States is that you do not have a free-standing right to enter the US. Many Canadians have been crossing the Canada-US border regularly and without incident for years, but it’s important to remember that US officials have no obligation to let you into the country and can deny you entry for all sorts of reasons that may seem arbitrary and unfair.
[ . . . ]
Until another case comes along, we simply do not know whether the CBSA’s powers include compelling people to provide passwords (though we certainly know that CBSA acts as if they have this power), or whether it is constitutional to arrest someone for refusing (though we know that people have been arrested in these circumstances).
In short: We have very limited privacy at the border, even coming back into Canada. This is an issue that hasn’t been clearly decided by the courts yet. Until then, there are fuzzy guidelines, which may or may not offer some degree of protection. But, if in doubt, leave your devices at home.
And, memo to the federal government: We need to do better. Please address this through legislation, rather than waiting for it to end up in court.