This question already has an answer here:
I know about the general open / trustless protocol of storing transactions. How would I approach a scenario here where I want to store some data in a contract on deployment, to later be retrieved by someone unknown at the time of deployment?
The main problem here is that the receiver of the secret data is not known in advance / when providing the secret data. Therefore simply encrypting the data with buyers public key is not a valid approach
E.g. I have a contract which stores secret number and other users can interact with the Dapp and bid on these numbers, only the highest bidder shall receive the true secret number in the end.