Secure range query based on privacy-preserving function in two-tiered sensor networks