Secure environments can be used to protect software application programs from piracy and to enforce licensing and operating conditions. To achieve these protections, a component should be selected and executed inside the secure environment. For maximum protection, the selected component should be one which performs a required or desirable part of the functionality of the application and not be easily emulated by patches as may be employed by software pirates.