{'fraction_non_alphanumeric': 0.02672160094173043, 'fraction_numerical': 0.005532666274278988, 'mean_word_length': 4.596398770311814, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
A Practical Searchable Symmetric Encryption Scheme for Smart Grid Data

Outsourcing data storage to the remote cloud can be an economical solution to enhance data management in the smart grid ecosystem. To protect the privacy of data, the utility company may choose to encrypt the data before uploading them to the cloud. However, while encryption provides confidentiality to data, it also sacrifices the data owners' ability to query a special segment in their data. Searchable symmetric encryption is a technology that enables users to store documents in ciphertext form while keeping the functionality to search keywords in the documents. However, most state-of-the-art SSE algorithms are only focusing on general document storage, which may become unsuitable for smart grid applications. In this paper, we propose a simple, practical SSE scheme that aims to protect the privacy of data generated in the smart grid. Our scheme achieves high space complexity with small information disclosure that was acceptable for practical smart grid application. We also implement a prototype over the statistical data of advanced meter infrastructure to show the effectiveness of our approach.


I. INTRODUCTION
The legacy power grid is in its way to become smart with diverse data-driven approaches. Smart grid, which introduces advancement in sensing, monitoring, control and communication to legacy grids, is considered to be the next generation power grid that can provide high-quality service to the public [1]. Moreover, as one of the most critical infrastructures in modern society, power grids are also complex and consist of enormous components. A well-known conceptual model of the smart grid is proposed by the U.S National Institute of Standards and Technology (NIST) in 2010 [2]. The model separates the smart grid into seven domains, namely generation, transmission, distribution, customers, markets, operations, and service provider. All these subsystems and components can become the sources of the large volume miscellaneous data in future smart grid systems. Some data sources in the smart grid are shown in Fig. 1.
However, due to the divergence in structure, type and generation rate, how to integrate, store, and manage the data is still one of the active research fields in the smart grid community. Recently, research on remote cloud-based storage and management of smart grid data is becoming popular [3]. Arenas-Martinez et al. [4] presented and compared a series of cloud-based architectures to store and process smart meter reading data. Based on the specific characteristics of smart grid data, Rusitschka et al. [5] proposed a cloud computing model of ubiquitous data storage and access. In fact, outsourcing the data storage to the cloud can be an effective solution and has advantages in scalability, performance, and interoperability.

Fig. 1: Data Sources in Smart Grid
The cloud frameworks in [4] [5] work well when the smart grid data owners own private cloud servers and or the cloud service is completely trusted. However, due to economic reasons, the utility company who owns the smart grid data may choose to outsource the data storage to third-party cloud service providers (CSP). In this scenario, the cloud in the models becomes untrusted, and there is a privacy concern about the smart grid data. Technically speaking, since the data are stored in the CSP's server, the provider can obtain full access to all the sensitive data easily. Moreover, it is reasonable to assume that the CSP may be interested in these data for many reasons. For example, the advanced metering infrastructure (AMI) data in the smart grid can contain customers' personal information, such as hourly measured power consumption, home location, and payment record. By launching side-channel attacks, such as Non-intrusive load monitoring [24], it is possible for the CPS to learn the customer's habits and customs, which may bring profit to CPS in many ways.
One straightforward approach to prevent storage CPS from accessing sensitive data in the smart grid is encrypting the data before uploading them to the cloud. While encryption provides confidentiality to the data, it also sacrifices the functionalities of processing the data. One of the most critical functions of processing data stored in the remote server is searching. For example, a utility company wants to query the billing statement of a specific customer. If the documents are encrypted with the concern of privacy, the CPS can no longer provide the search function to the utility company. In fact, this is a common problem that not only exists in the smart grid field but also in all cloud storage applications that require privacy enhancement.
With the development of privacy-preserving technology, Searchable Symmetric Encryption (SSE) was proposed to address the above problem. SSE is technology that enables users to store documents in ciphertext form while keeping the functionality to search keywords in their documents. In recent years, a series of secure and efficient SSE schemes are proposed [6]- [15]. However, most of them are only focusing on general circumstances in which user's documents are collections of random keyword combination, and can become inefficient or over-protect when directly applying them to smart grid applications.
There are two characteristics that make smart grid data special. Firstly, the smart grid data are believed to be frequently updated and have high generation rate. This also implies there are always new data/keywords generated, which will lead to an increasing keyword dictionary. Furthermore, a large portion of smart grid data are well regulated and have specific structures. In practice, smart grid data may contain multiple attributes that will be searched as keywords. For example, although two utility companies may have different implementations of storing customer billing statement, it is reasonable to assume both implementations should have keywords such as user identity, electricity price, smart meter reading in each record. The two characteristics make the state-of-the-art SSE schemes inappropriate to be applied to smart grid application. The typical SSE schemes together with their disadvantages with the above two characteristics will be discussed in Section II.
In this paper, we present a practical searchable symmetric scheme that aims to protect the privacy of smart grid data. By taking advantage of the two characteristics, our scheme can achieve higher space efficiency with a sacrifice of a little information disclosure which was acceptable for smart grid system in practice. Our main contributions can be summarized as follow: • We review and analyze the typical state-of-the-art SSE schemes and show why they are inappropriate for smart grid data. • According to the characteristics of smart grid data, we design a simple, practical SSE scheme that provides higher space efficiency with tolerant information leakage in real applications. • We implement a prototype based on the statistic data of advanced metering infrastructure (AMI) provided by U.S. Energy Information Administration (EIA) to show the effectiveness of our scheme. We claim the scheme can also be applied to other types of data in the smart grid, such as metering data, customer billing statement, and PMU/PDC data. The rest of paper is organized as follow. Section II gives the introduction of related work on SSE. Section III introduces the threat model and notations we use. The detailed description of our scheme will be presented in Section IV. After that, section V introduces the implementation of the prototype and smart grid data we use. Future work will be discussed in Section VI. Finally, Section VII summarizes the paper.

II. RELATED WORK
Currently, the fundamental SSE constructions can be classified into three categories, namely construction without indexes, construction with direct index, and construction with inverted indexes.
The first practical SSE scheme without index construction was proposed by Song et al.in 2000 [6]. They considered a document as a list of words with the same length and used a specially designed stream cipher to encrypt the document. However, this scheme requires the server to traverse each document word by word, which leads to a search complexity linear to the document size. Furthermore, SSE scheme without index usually requires specially developed encryption algorithms, making it unscalable to current power grid communication and control system. After that, several high impact indexbased SSE schemes were proposed. Secure Indexes by Goh [7] built Bloom Filters as the direct index. By adjusting the parameters of the Bloom Filter, secure indexes can achieve efficient search complexity. However, one inherent problem of Bloom Filter is that it will bring false-positive rate, and this can be unacceptable for critical infrastructure like the smart grid. Another direct index based scheme was presented by Chang et al. [8], and they built a large index table for all documents to enable efficient search. However, their scheme assumes that there is a dictionary mapping all keywords to associate identifiers. As discussed in Section I, the number of keywords in smart grid data can be large and keep increasing. Therefore, a scheme in [8] is also not appropriate for smart grid applications. One of the most famous inverted index based SSE schemes were proposed by Curtmola et al. [9]. They presented an index scheme which achieves the highest timeefficient search function by using a uniquely designed linked list data structure. However, an inverted index construction scheme has an inherent problem, namely directly updating is difficult. Although a well-designed file management system can mitigate the problem, inverted indexes are still not efficient for smart grid which has new data generated all the time. The latest research work on SSE including dynamic searchable encryption [10]- [13], forward secure searchable encryption [14], and fuzzy keyword searchable encryption [15].
Besides the theoretical of SSE scheme, research on applying SSE to solve real-world problems is also active. In general, the SSE scheme can be used to all systems which include storage outsourcing. Tong et al. [16] employed a modified SSE scheme of Secure Index [7] and designed a secure data sharing mechanism for situational awareness in the power grid. Their approach is also used to protect the privacy of e-health data [17]. The problem of health data' privacy is drawing more and more attention. Li et al. [18] leveraged a secure K-nearest neighbor (KNN) and attribute-based encryption to build a dynamic SSE scheme for e-health data and achieves both forward and backward security. Other applications of SSE can be found in [19]. Our scheme interacts between two parties. As shown in Fig. 2, we refer the party who owns the data and wants to outsource the storage of data as the client, and the party who provides the storage service as the server. The client uploads the encrypted data, and associated search index to the server and sends query afterward. For simplicity, our scheme only considers the case that there is one keyword contained in the query. We note that query that contains boolean operation on multiple keywords can be regarded as the operation on query results of multiple single keywords, which will be briefly discussed at the end of this section. After receiving query contains keyword information from the client, the server should run the SSE algorithms and return a list of the identifier of documents that contain the keyword.
Same as most state-of-the-art SSE schemes, in our threat model we also assume that the third party server is a curious but honest attacker, which means the cloud server should provide normal cloud service but will try to learn the content of data. More specifically, the server is not allowed to delete or modify the client's data or share the data with other parties. However, different from SSE schemes which assume that the client's data is a collection of random keyword combination, our scheme makes practical assumptions on the client's data based on the characteristics of smart grid data discussed in Section I.
First, we assume the smart grid data to be stored in the cloud should be a collection of records that have the same data structure and contain the same number of keywords. For example, the customer billing statement record should have attributes like customer identifier, date, house location, smart meter readings, and additional notes. Another example can be the PMU data. One of the most widely used standards of PMU data is IEEE C37.118.2 [20]. The standard gives the format of application layer data structure of PMU data that contains several attributes, such as data stream ID number, time stamp, and measurement data. Moreover, as presented in [16], the data owner can also design a hierarchical data structure to store the smart grid data. Therefore, we believe this assumption is practical in real power grid applications and is easy to meet. In the rest of the paper, we will use record and document interchangeably for simplicity.
Second, we assume the total number of records to be stored in the cloud is much larger than the number of keywords in each record. In practice, a record may contain up to tens of attributes, but it is normal for a utility company to maintain millions of customer data records or billions of measurement data records.
One widely used security requirement of searchable symmetric encryption is IND2-CKA secure proposed in [7]. In brief, IND2-CKA secure requires that the server cannot learn anything more of the plaintext message except for the search result. According to IND2-CKA, the number of keywords in each document should also be kept secret. However, our scheme allows the number of keywords in each record to be known to the attacker (server). There are mainly two practical reasons for this privacy sacrifice. First, SSE schemes follow IND2-CKA secure consider the case that the client stores general documents which contain keywords with random numbers. As we discussed above, since all smart grid data records are assumed to contain the same number of keywords, it is not reasonable to assume that the attacker cannot learn the number in the real working scenario, like by social engineering or just randomly guessing. Second, we will show that our scheme can achieve high space efficiency by loosing the restriction on this privacy leakage issue. This compromise should be acceptable for a utility company or government department in practice.
Finally, the scheme is only used for constructing secure search index. How to protect the privacy of the plaintext data will not be discussed in this paper. The client can use popular security schemes like CBC or CTR block cipher to protect the confidentiality and schemes like HMAC to protect the integrity of data.

B. Notations
We use ∆ = {R 1 , R 2 ...R 2 d } to indicate a collection of records. N is defined to be the total number of possible keywords in a record while n is the number of desired keywords in a record that the client want to search, where n ≤ N . We use w i,j to denote the jth desired keyword in record R j where 1 ≤ i ≤ 2 d and 1 ≤ j ≤ n.

IV. PRACTICAL SSE SCHEME DESIGN FOR SMART GRID A. Construction
Secure Indexes presented in [7] gives a framework of trapdoor based searchable symmetric encryption scheme which was widely used by the follow-up research. In general, an SSE should consist of four polynomial time algorithms: • Keygen(s) is run by the client to generate a master private key M K where s is a security parameter. • Trapdoor(M K, w) is run by the client by taking the master key M K and a keyword w as the input, and outputs the trapdoor T w of word w.
The input is a record R i and the master key M K The client: create an n elements array I Ri and initialize all elements to zero create an set U : The input is the trapdoor T w of keyword w and the index I R of record R The server: master key M K and a record R as the input, and outputs the index I R for record R. • SearchIndex(T w , I R ) is run by the server by taking a trapdoor T w and a document's index I R as the input, and outputs 1 if w ∈ R or 0 otherwise. In general SSE scheme, the encrypted documents together with the associated indexes will be kept by the server. When searching, the client generates the trapdoor T w for word w and send T w to the server. For each record R, the server runs the SearchIndex(T w , I R ) function and determine whether R contains w. The server will finally return to the client a list of the identifiers of records which contain w. The framework requires that only the client who holds the private master key M K can generate the trapdoor T w for each word w, such that the server cannot learn related information from the index. Our scheme also follows this framework and is built in the direct index structure.
Our scheme uses a codeword array as the index for a record. For the keyword w, the Trapdoor function computes the hash value h(w) of w, where h : {0, 1} * → {0, 1} r , and outputs the r is a pseudo-random function. To build the index I Ri of record R i , the BuildIndex function calls Trapdoor and computes the codeword r is another pseudo-random function. Each codeword X i,j should be randomly written into an n element array I Ri , and this step can be done with a pseudo-random generator in implementation. The detailed design of our scheme can be found in Fig. 3.
As discussed early in this section, we assume the smart grid data ∆ to be a collection of records with each record R i contains N keywords. Considering the scenario that not all types of keywords in the data are necessary for searching, and the data owner only wants to query records by several specific types of keywords. For example, based on the standard IEEE C37.118.2, the utility company may want to search PMU data records by ID number or timestamp, and there may be no need to search by synchronization word. Therefore, our scheme firstly allows the data owner to select the n (n ≤ N ) types of keywords she wants to query based on specific applications.
After determining n types of keywords, the client should run function Keygen to obtain a k bits master key M K and keep it secret. Subsequently, for each record R i in ∆, the client runs the BuildIndex function to obtain the index I Ri of record R. Finally, the index I Ri should be attached to the encrypted record R i and uploaded to the server.
To search for a keyword w, the client needs to compute the trapdoor T w = f M K (h(w)) and sends T w to the server. After receiving the T w , the server computes X i,w = f Tw (h(id(R i ))) for each ciphertext record R i (1 ≤ i ≤ 2 d ), and checks whether X i,w is contained in I Ri . If so, the server returns id(R i ) to the client.

B. Analysis and Comparison
As stated at the beginning of Section III, our scheme aims to protect the data privacy such that the adversary cannot learn any other information about the plaintext record from the index except for the search result and the number of desired keywords in the record. We analyze the security of our scheme  [6] special no no easy O(2 d · N ) none Z-IDX [7] general direct yes easy from two aspects. First, considering a simple scenario that only one index of a record is given, a polynomial time attacker can not learn the original keywords from the index. This is correct because if the attacker can learn the keyword from the codeword, she will be able to break the pseudo-random function, which is contradictory to the assumptions. Second, we consider the unlinkability of our scheme, which means the attacker is not able to learn whether two records have the same keyword w from their indexes without the trapdoor T w . This is achieved by introducing the identifier of records to build the codeword. The same keyword in two records will have different codewords in two indexes. We refer the reader to [7] for the mathematical proof.
In general, the main methodology of our scheme is increasing the space efficiency of the SSE scheme with permission of few information leakages based on the characteristics of smart grid data. Our scheme was built based on direct index structure, so it is dynamic and easy-updating. We use the codeword array as the index of each record, which leads to a small index size compared with schemes that involve keyword dictionary. Since the codewords are randomly inserted, the searching complexity of our scheme becomes O(2 d · n). However, since the number of desired keywords n is believed to be a very small constant in practical application, the search algorithm will still be efficient. Our scheme is similar to the PPSED scheme described in [8]. Both schemes used direct index structure and an array as the index. However, since there is always new keywords (e.g. timestamps) generated in smart grid data, the index size of the PPSED scheme will become extremely large. Table I gives a detailed comparison between our design and the widespread SSE schemes.

C. Extension
It is obvious to see that updating new record and associated index to the server is straightforward. The client just needs to run the BuildIndex function of the new record to obtain the index, and appends the (encrypted record, index) pair to the records and indexes stored in the server.
The plain scheme considers the scenario that only one keyword is searched in a round. In practice, the client may want to search for records that meet specific keyword requirements. One simple example can be a government department who wants to query a dataset of utility companies. A meaningful query can be (State: TN andEstablish Year: 1998 or 1999). The boolean operations on multiple keywords can be easily applied to the codewords matching process when the server runs Search function. The public dataset we used to test the effectiveness of our scheme is the statistical AMI data provided by the U.S. Energy Information Administration (EIA) [21]. The AMI data are derived from EIA-861M form, which stands for Monthly Electric Power Industry Report. The report collects sales of electricity and revenue each month from a statistically chosen sample of electric utilities in the United States. EIA started to collect monthly green pricing, net metering, and advanced metering data since 2011. We choose the CSV file of advanced metering data of the year 2016 as the dataset for our implementation.

A. Smart Grid Data
As shown in Table II, the CSV contains 31 columns, including year, month, utility name, state, residential AMI, and so on. In our experiment, we select all features except Year from Utility Characteristics and all features from AMI related categories as our desired types of keywords. The CSV file contains 4819 records in total, and the data types include string and unsigned integer.

B. Prototype
For simplicity, we use Python 2.7 as the programming language for the prototype. We claim that a low-level language like C can be used in practice with the consideration of speed. We build the encryption scheme with the help of Pycrypto [22], which is a widely used cryptography library for python. Generally, the ciphers and hash functions in Pycrypto are written in C and provide Python API. We use Advanced Encryption Standard (AES) block cipher with 128 bits key as the pseudo-random function and the MD5 as the hash function described in our scheme. We note that MD5 has been severely compromised and is no longer secure for integrity protection. However, the MD5 in our prototype is only used to generate a unique identifier for record and keyword, similar to the building dictionary process in other schemes.
Since the original ciphertext usually contains unprintable characters that will destroy CSV format, we store the ciphertext as the hexadecimal string to maintain a clear CSV format for demonstration. However, the hexadecimal string will lead to larger index size. Therefore, we suggest that an efficient file-index management system is needed for realworld applications.
The source code is tested on a Mac OS X machine with a 1.6 GHz Intel Core i5 processor and 8GB memory. Our experiment result shows that 4819 indexes can be searched in around 0.15 second. The source code of the prototype is available on Github [23].

VI. FUTURE WORK
Our scheme only considers the one client scenario. In practice, it is common for the data owner to grant access permission to a group of people. Attribute-based encryption may be used to address this problem in the future. Meanwhile, same as the PPSED scheme in [8], our scheme also suffers forward information leakage, which means the attacker can learn the information of the plaintext from newly added indexes based on previous queries. More information about the SSE forward security can be found in [14].

VII. CONCLUSION
In this paper, we firstly review and give a comparison of the state-of-the-art searchable symmetric encryption schemes, and analyze why these schemes are not appropriate for smart grid application. After that, we present a practical scheme based on the characteristics of smart grid data. We show that space efficient and easy update SSE scheme is available by allowing a little information leakage which is acceptable in practice. Finally, we implement a prototype based on statistical AMI data to show the effectiveness of our scheme.