Programmable and active networking principles provide a basis for a flexible and extensible network element architecture. Such architecture enables provision of various services in the network for its users but raises many security concerns and security becomes a key issue in such system. Based on description of the system, possible threats, high level security architecture goals and issues we propose a flexible and general security architecture which was designed and implemented in the context of the Future Active Ip Networks [FAIN project home page. URL http://www.ist-fain.org] project. Initial evaluation shows that strong security in such system is possible and that we have achieved most of our goals. The security architecture itself is general; we have applied it to three types of nodes developed and to one pure active networking approach.