I'm going to re-phrase my question completely so it makes more general sense (and correct my blunder with AES/RSA).
Alice has a large block of data to send to Bob via a local mailbox that isn't secure. To keep her data from prying eyes, she does this:
- She generates a random 256-bit key
- She uses AES-256 encryption to encrypt the data using the key
- She uses Bob's public key to encrypt the key she's used
- She puts the encrypted data and the encrypted key in the mailbox addressed to Bob
Mike the mailman picks up the mail from the mailbox. However, he doesn't want to lug the data all the way across the internet to Bob's place if bob isn't going to be able to decrypt it.
The question is, how can Mike ascertain whether the key has actually been encrypted using Bob's public key?
In my application I need to transport sensitive data to a data centre. To achieve this, I have an upload process that accepts files (that have already been AES-encrypted with a key, then the key is encrypted with the recipient's public key) and sends them to the data centre. The corresponding private key is held at the data centre and used to decrypt the files on receipt. This is currently in the design stage so there is some flexibility on the public/private key technology to be used but it's likely to be a C# application that's doing the work.
I would like to protect against uploading files that have NOT been encrypted using the public key (because I may waste significant bandwidth and the receiving application at the datacentre will fail to decrypt them).
So, what I want to know is how can I tell at the sending end whether a file has been encrypted using a given public key?
In a nutshell, I have an encrypted file and a public key. Has the file been encrypted with that key?
Thanks in advance etc.!