Method to transmit data in an ad hoc network or a sensor network with the
network comprising a multitude of sensor nodes to sensor data, at least
one aggregator node to aggregate the sensored data of at least a subset
of the sensor nodes, and at least one sink node to collect the data of
the aggregator node is characterized in--regarding a high level of
security against attacks from outside while transmitting data, and
regarding an economic energy consumption--that the sensored data is
encrypted at the sensor nodes, that the encrypted data is transmitted to
one of the aggregator nodes, that at the aggregator node an aggregation
function is executed on the encrypted data, and that the result of the
aggregation function is transmitted to the sink node and decrypted there.