Online Social Networks (OSNs) are flourishing such as Facebook and Google+, where people share recent status and personal files with friends. However, security and privacy have become major concerns in existing C/S based OSNs. In this paper, we propose a novel scheme called a Community-based P2P OSNs with Security Enhancement (ComPOSE) that supports cross-platform availability and reputation mechanism in stringent privacy requirements. For the first time, we formulate the privacy issue and design goals for P2P based OSNs. We firstly introduce broadcast encryption into P2P community-based social networks together with hierarchical encryption algorithms in order to decrease the system overhead. In ComPOSE, we employ the Open Directory Project to classify and encode groups. The RESTful web-services help to ensure cross-platform availability and transmission security. As a result, thorough security analysis and performance evaluation on experiments demonstrate that the ComPOSE scheme indeed accords with our proposed design goals.