guys, I think you are not talking about the same thing.
@kb1sph1, you seem to have symmetric encryption in mind, which relies on a shared key between the sender and receiver for both encryption and decryption. Without sharing the key, symmetric encryption and decryption become challenging.
However, and I assume this is not what @Delta_G has in mind. There are methods that can achieve encryption and decryption without directly sharing the key such as the Diffie-Hellman key exchange which lets you establish a shared secret key over an insecure channel without explicitly sharing the key or you could use an Asymmetric Encryption (Public Key Cryptography) for key exchange. In this method, each party has a public-private key pair. The public keys can be freely shared, while the private keys are kept secret. One party can encrypt data with the recipient's public key, and the recipient can decrypt it with their private key and then you have all in between with Hybrid Encryption where you can combine symmetric and asymmetric encryption.
plenty of options to choose from and it's true that having to rely on side loading the keys is adding complexity and risks - as is of course storing the key in EEPROM or SPIFFS (unencrypted keys at rest are a low hanging target)