Depends on your jurisdiction. In Canada it's allowed if you publish your keys.
https://www.rac.ca/encryption/