After reading this answer a while ago, I took an interest in fully homomorphic encryption. After reading the introduction of Gentry's thesis, I started wondering if his encryption scheme could be used for oblivious code execution as defined in the third paragraph.
In a fully homomorphic encryption scheme we typically encrypt some data, send it to a hostile environment where a certain function is computed on the data, the result of which is then sent back (encrypted), without the adversary finding out what the received data or the result of the function is.
With oblivious code execution I mean that we encrypt a piece of code $C$ designed to solve some problem $P$ and send it to a hostile environment. The adversary wants to use $C$ to solve $P$, but we don't want him to know how $C$ works. If he has an input $I$ for $P$, he can encrypt $I$ and then use (some encryption scheme on) $C$ with $I$, which then returns the (not encrypted) output $O$ (the solution of $P$ for the input $I$). The encryption scheme makes sure the adversary never finds out how the piece of code works, ie to him it works like an oracle does.
The main practical use (I can think of) for such an encryption scheme would be to make piracy more difficult or even impossible.
The reason I think this may be possible using a fully homomorphic encryption scheme is because we can execute arbitrary circuits on encrypted data, in particular an universal Turing machine. We could then encrypt the code as if it were data and then use the circuit for an universal Turing machine on this encrypted data to execute the code.
I pose this as a question here because I don't know whether this idea is usable: I never got much further than the introduction of Gentry's thesis, and my knowledge about cryptography is limited. Also, I don't know if there already is a often-used term for oblivious code execution: I tried searching Google for the idea but not knowing the proper term I found nothing.
There are multiple problems I can think of which may cause problems with this approach. Firstly, if we use a fully homomorphic encryption without modification, the result of the computation ($O$) would be encrypted. It would therefore be useless for the adversary who wishes to use your code to solve $P$. While this could still be useful for, say, cloud computing, this is not what I want to achieve.
Secondly, because we're using circuits and not arbitrary Turing machines, we can't use arbitrary amounts of memory: we're limited to a predetermined amount of memory. This means that if we want to run a program in this way, it's memory footprint will always be the same, namely it's peak memory usage.
Lastly, the constants involved would almost certainly kill off any practical use of such a system, but I think the idea is interesting nonetheless.