My impression is that giving the password to an electronic device to a customs officer is basically giving the officer permission to search that device.
In terms of security, I feel that the technology that countries have today allows them to search our personal information anyway. In reality, they are just asking for permission pro forma. If they actually have any real doubt, they are going to find a way to search the information about us, whether it is in the cloud or elsewhere.