Distributed Data Privacy Preservation in IoT Applications