Does proxy/stub expose the interface?

2019-08-23 05:38发布

问题:

Suppose I introduced a COM interface and don't want any third party to use it. I have full control over the sources of the COM component and the IDL file that holds the interface definition. My COM component will need marshalling stuff fro that interface, so I'll need to either implement IMarshal or provide a typelib or provide a proxy/stub.

Obviously if I provide a typelib anyone can inspect it and find what my interface is and how it can be used. That's not what I want.

What if I use proxy/stub? Will it expose the interface and let anyone inspect it or will it keep the interface details covert?

回答1:

Unfortunately this is not possible. The idea of COM is that clients can discover the components and the interfaces.

In a previous job I worked on a digital rights equipped application and there we deliberately did NOT use COM just to make it more difficult for people to tap into our application. We had to build our own component infrastructure (in addition to other security measures).