A white-box encryption algorithm is proposed for eliminating vulnerabilities of services composition based on mobile agents.By using multiplication of block matrix on finite fields and secure addition with input and output transformation,the key is hidden in a set of tables.Thus the algorithm controls the risk of key compromise in white-box attack context and provides an approach for encrypting data securely by computing with encrypted functions.The size of implementation of this algorithm is small and therefore suitable for non-fixed composition of services.