That’s more or less how iMessage works when you send a file. It encrypts the file on your device, uploads it to iCloud, and then sends a link and the decryption key as an iMessage (so it’s E2EE) to the recipient.