Most countries have key disclosure laws[1] which require you to provide keys or passwords to law enforcement. Not being able to remember the password is not a defense unless you can somehow prove it (which is impossible), and people can and have gone to prison for this[2].
[1]: https://en.wikipedia.org/wiki/Key_disclosure_law [2]: https://www.reuters.com/article/uk-britain-security-password...