KeyEncoder: A secure and usable EEG-based cryptographic key generation mechanism
Abstract
9 páginas, 5 figuras, 3 tablas
Full text
Pattern Recognition Letters 173 (2023) 1–9 Available online 14 July 2023 0167-8655/© 2023 The Authors. Published by Elsevier B.V. This is an open access article under the CC BY-NC-ND license (http://creativecommons.org/licenses/bync-nd/4.0/). KeyEncoder: A secure and usable EEG-based cryptographic key generation mechanism Luis Hern´ andez-´ Alvarez a , b , * , Elena Barbierato c , Stefano Caputo d , Jos´ e María de Fuentes b , Lorena Gonz´ alez-Manzano b , Luis Hern´ andez Encinas a , Lorenzo Mucchi d a Institute of Physical and Information Technologies (ITEFI), Spanish National Research Council (CSIC), Madrid, Spain b Computer Security Lab (COSEC), Universidad Carlos III de Madrid, Madrid, Spain c Department of Agriculture, Food, Environment and Forestry, University of Florence, Firenze, Italy d Department of Information Engineering, University of Florence, Firenze, Italy ARTICLE INFO Edited by: Maria De Marsico Keywords: Autoencoders Discrete wavelet transform Electroencephalogram Key generation Privacy–preserving ABSTRACT Nowadays, a rapid, easy, and convenient access to our private information is essential to carry out both personal and professional activities. In most cases, this information is sensitive and can be stolen due to its importance and the lack of security protocols. In this study we propose a time–invariant cryptographic key generation mechanism based on electroencephalogram (EEG) signals. We employed Discrete Wavelet Transform and autoencoders to extract the biometric features from the EEG signals. Using these features, we construct a scheme to generate secure seeds that can be used as inputs for secure hash functions and obtain cryptographic keys. The mechanism proposed preserves the privacy of the user, as the cryptographic key is generated for each new EEG signal received, avoiding the need of storing the key, previous EEG signals or any other information. Results show that the proposed mechanism is secure against random attacks, as a 0% of False Acceptance Rate is reported, while generating seeds with an entropy of 0.968 in less than 500 ms. 1. Introduction The technological progress experienced over the last few years have made it possible to construct complex software with high capabilities and implement it in portable devices (e.g. smartphones, tablets, smartwatches, etc.). Hence, these devices are widely used not only for social communications, but also for personal and professional activities, such as on–line shopping, e–banking, and private documents storage [9]. Despite these devices provide a convenient and rapid manner to access to this personal or professional information, they also implicate security risks [13]. Consequently, it is common to implement security protocols that guarantee the protection of the device or the information, allowing its access only to legitimate users. These protocols are authentication and identification schemes that recognize specific features of the allowed users to make a decision. These features can be based on something the user knows (e.g., password), has (e.g., physical key, token), or is (e.g., fingerprint, iris). This last group of characteristics is called biometric features and their use is usually more convenient than the first two groups: they represent the intrinsic attributes of each specific subject and do not present the problem of forgetting a code or losing a physical object [19]. Alternatively to user authentication protocols, cryptographic key generation mechanisms also offer the possibility of protecting the information in a continuous manner. In this case, the user’s biometric features are employed to produce a cryptographic key that encrypts the compromised information by means of a symmetric cryptosystem [8]. To decrypt the data, the same biometric characteristics, measured at a different time, are used to generate the same key. There are several challenges to execute this process: first, the biometric features should be consistent enough to produce the same key at different times for the same user, while being unique, so that a different subject cannot replicate the key with his own features. Moreover, the key should be generated in a reasonable period of time, making the system usable and allowing information retrieval in a timely manner. Lastly, the preservation of the user’s data privacy should also be considered, as it can be used for malicious purposes [12]. * Corresponding author at: Institute of Physical and Information Technologies (ITEFI), Spanish National Research Council (CSIC), Madrid, Spain. E-mail addresses: [email protected] (L. Hern´ andez-´ Alvarez), [email protected] (E. Barbierato), [email protected] (S. Caputo), [email protected] (J.M. de Fuentes), [email protected] (L. Gonz´ alez-Manzano), [email protected] (L.H. Encinas), [email protected] (L. Mucchi). Contents lists available at ScienceDirect Pattern Recognition Letters journal homepage: www.elsevier.com/locate/patrec https://doi.org/10.1016/j.patrec.2023.07.008 Received 6 April 2023; Received in revised form 19 June 2023; Accepted 13 July 2023
Pattern Recognition Letters 173 (2023) 1–9 2 In this study, we have developed a key generation algorithm that meets all the aforementioned requirements. To do that, we are going to extract biometric features from electroencephalogram (EEG) signals using the Discrete Wavelet Transform (DWT) and autoencoders. Certainly, the principal contribution of this work is the novel use of autoencoders to obtain EEG biometric features that can continuously generate a time–invariant cryptographic key. In addition, the experiments will be conducted with real–world data, obtained in a measurement campaign. Other important consideration is that the generation frequency of the cryptographic keys is established at 500 ms and without the need of storing any personal information of the legitimate subject. Consequently, the novelties of this proposal are the following: •The development of a universal key generation mechanism with EEG hidden biometrics using autoencoders to extract the biometric features. To our knowledge, this is the first work that explores the use of autoencoders for this application in combination with EEG signals. •The creation of a database with real–world EEG signals of 39 volunteers to test the performance of the mechanism. •A result of 0% of False Acceptance Rate (FAR) in the proposed mechanism, which implies that a potential attacker will not be able to generate the key of any user. •A key generation period of half a second, without needing to store the key or any biometric information related to the user. This ensures the usability and the privacy–preservation of the mechanism. •The publication of the experimental scripts to ensure replicability with different databases (script available at: https://github.com/lu ishalvarez/~EEG-Key-Generation). 2. Related work The suitability of EEG signals for security applications has been widely explored [16]. The most common implementation is user authentication protocols, in which Artificial Intelligence (AI) techniques are employed. These AI methods include multi–class Machine Learning and Deep Learning classifiers, such as Support Vector Machines (SVM) [27], Random Forests [24], and Convolutional Neural Networks [15, 28]. Nevertheless, the applicability of EEGs to generate cryptographic keys is not so extensively studied and, in the recent years, it has gained interest in the scientific community. In Bajwa and Dantu [1] EEG features are extracted using Discrete Fourier Transform (DFT) and DWT to define a feature vector distribution for each subject. Then, binary feature quantization was employed to compute the key bits. The outcomes validate their methodology, as the best FAR and False Rejection Rate (FRR) are, respectively, 0.27% and 8.30%. The work presented in Zeynali et al. [32] proposed an improvement of this methodology by changing the definition of the feature vector distribution. The modifications enhanced the Half Total Error Rate (HTER) from 4.78% to 0.76%. However, the signal duration needed to generate the key is not pointed out, and it is an essential parameter to establish the key generation frequency. In addition, both papers proposed the use of the hash function SHA-1 to generate the binary key, which is not recommended anymore [29]. In Nguyen et al. [18], an auto–regressive spectral analysis with Burg’s method was applied to obtain the power spectral density of the EEG signal. With these features, the best result reported for the key generation process is an Equal Error Rate (EER) of 0.18%. However, this process includes error-correction codes and the necessity to randomly assign EEG features to subjects, so that a potential attacker cannot know the information on which the key generation is based. It should be also considered that, although two databases are explored, one of them only includes three users, while the other contains data exclusively of people with genetic predisposition to alcoholism. A key generation scheme based on the Advanced Encryption Standard (AES) and a key exchange protocol based on the Diffie–Hellman one are proposed in Tuiri et al. [25]. The best results are, respectively, 4.1% and 3.4% of HTER, and the EEG features were extracted applying DFT and DWT. However, the used database only contained eight participants. Alternatively, in Wang et al. [30] a key generation scheme based on common spatial patterns or CSP feature extraction algorithm and SVM classification is proposed, obtaining an accuracy around 80%. Other examples of EEG–based key generation mechanisms employ techniques like fuzzy extractor [23], fuzzy commitment [31], and the quantization method [22]. To the best of the author’s knowledge, although existing EEG–based cryptographic key generation algorithms present good results, all of them require to store a template of the user, and the key generation frequency is hardly considered (we find it critical to evaluate the FRR). Furthermore, none of them guarantees a 0% of FAR (i.e., that an impostor will not generate the key of a concrete user). The goal of this proposal is to develop a key generation protocol in which the probability of an attacker generating the key of a given user is as close to 0% as possible, even if this implies an increase in the FRR, which is preferable from the security point of view. We want to achieve it avoiding both the use of error-correction codes and the need of storing any biometric information of the subject, using a representative database, and considering a low key generation frequency, so that the protocol remains both, secure and usable. 3. Proposed mechanism In this section, we include the objectives and a general overview of the proposed key generation mechanism. 3.1. Goals The four objectives that we want to achieve with the proposed key generation mechanism are the following: •Protocol universality. The key generation scheme should be useful for each user u. •Key uniqueness. Each user u must produce a unique cryptographic key. In other words, two users should not generate the same key. •Key unpredictability. The encryption key for user ui must be unpredictable for other user uj, ∀j∕= i. •Key consistency and time efficiency. Each user u should be able to generate his own key in a reasonable period of time (e.g. one second or less). 3.2. Overview The principal objective of this work is to generate cryptographic keys from an EEG signal, without storing any personal information of the user. This means that a user can generate a key to encrypt information and, any time after, generate the same key to decrypt it, but neither the key nor the EEG signal is stored or saved anywhere. Thus, the mechanism gives special importance to the preservation of the user’s privacy. The proposed key generation mechanism employs autoencoders to extract the latent features of the users’ EEGs [10]. Specifically, one autoencoder for each EEG channel (a total of 14 autoencoders) is trained for each participant. Consequently, the protocol is composed of two phases. The first one is the Enrollment Phase, in which the information of a subject is collected to train his/her personalized autoencoders. Once they are trained, the process in which new EEG measurements are obtained and the user’s key is produced can be regularly executed; this is the Authentication Phase. We have divided this Authentication Phase into three stages: data acquisition, which involves the correct measurement of the subject’s EEG signals and its transmission to the key generation device (e.g. the computer/smart device of the brain-computer interfaces or BCI); seed generation, the critical stage and where the novelties of this work are proposed. It covers all the processes, from the data processing L. Hern´ andez-´ Alvarez et al.
Pattern Recognition Letters 173 (2023) 1–9 3 to the latent vector discretization. The whole procedure of this stage is described in Section 4; and key generation, where we propose the use of hash functions to generate the cryptographic keys. Specifically, we suggest SHA3-256 and SHA3-512 depending on the desired final key length. Hash functions are suitable for this application, as we can take advantage of their properties: dependency on bits, resistance to the pre–image, to the second image and to collisions [17]. 4. Proposed methodology for seed generation The seed generation algorithm (Fig. 1) is composed of four steps. Hereunder we provide a brief introduction to each step, and more extensive explanations are included in the next sections. 1. Data acquisition and processing: the EEG signals are divided into segments of 240 ms, and they are used to extract the feature vectors. These are obtained by applying the DWT and calculating eight statistics on the wavelet coefficients. 2. Autoencoder: The extracted vectors are improved and reduced in dimensionality by employing LSTM (Long Short–Term Memory) autoencoders, obtaining latent vectors. 3. Latent vector discretization: The latent vectors of all channels are transformed into binary vectors. Firstly, the Walsh–Hadamard Transform (WHT) is applied, and the results are discretized according to their mean, median, medium point, and sign. 4. Seed generation: The invariant elements of the discretized latent vectors are concatenated. 4.1. Data acquisition and processing The measurement campaign was conducted at the University of Florence and consisted in a within–task, controlled experience with 39 volunteers, which is a convenient scenario [7]. They all signed an agreement before the data collection, stating that they did not suffer from any form of neurological disorder and allowed to use their EEG signals for research purposes by researchers of the University of Florence. The Emotiv Epoc+V1.1 wireless headset [5] was employed to Fig. 1. Proposed algorithm for seed generation. L. Hern´ andez-´ Alvarez et al.
Pattern Recognition Letters 173 (2023) 1–9 4 acquire the EEG signals. More details about the data acquisition can be found in Hern´ andez-´ Alvarez et al. [11]. A total of 14 continuous EEG signals were acquired per user u, one for each channel c in a time interval t: Su,c(t), 0 ≤u≤38, 0 ≤c≤13. The signals duration is, approximately, of 2 min. Each signal Su,c(t)was divided into smaller signals (samples) su,c,j(t) with a duration of 240 ms each. The index j, 1 ≤j≤mu, represents the sample, i.e., the total number of smaller signals for user u. The number of samples is different for each user due to the time acquisition variability. We decided to set the time division to 240 ms for various reasons: it was small enough to generate enough samples for the autoencoder, but sufficiently high to extract the frequency content we are interested on (brain waves), and this value gives us margin to define a protocol with a high key generation frequency. A five–level wavelet decomposition using the order 2 Daubechies wavelet was calculated for each su,c,j(t). This decomposition was performed using Matlab, version R2021b, and the wavelet coefficients D1, D2, D3, D4, D5, and A5 were acquired as real–valued vectors. The first two steps of the DWT algorithm executed by Matlab are presented in Fig. 2 (the remaining steps are homologous). We implemented DWT because: i) the implementation of the Fast WT is computationally fast, ii) it offers a simultaneous signal feature localization in time and frequency domain, iii) it is able to identify details of small parts of the signal, and iv) it has been shown to be suitable to AI models with EEG data. As final step, we calculated eight statistics for each wavelet coefficient vector D1–D5, and A5 in each su,c,j: maximum, minimum, mean, standard deviation, variance, skewness, Shannon entropy, and average power [14]. 4.2. Autoencoder Based on the previous section, 8 ×6=48 features are obtained in each channel and with the use of autoencoders this set is reduced to 16. Taking into account the 14 channels, the total dimensionality reduction is from 14 ×48 =672 to 14×16 =224. Formally, autoencoders are composed of two neural networks; the first one is called encoder, and compresses the original information from dimension m to dimension l (latent space). The decoder reconstructs, from the representation in the latent space, the input of m dimensions [2]. Mathematically, autoencoders are represented by the following functions: E:Rm→Rl, D:Rl→Rm, l<m. The problem to solve is presented in Eq. (1): recreate the original information after a non-linear compression (composition of encoder and decoder). argmin E,D‖X− (D∘E)(X) ‖2,(1) where argminE,D refers to the encoder and decoder that minimize the expression and ‖X‖is the norm of the input data X. Specifically, 14 different LSTM autoencoders are trained for each user, one for each channel. To simplify the mechanism, the structure of all autoencoders is the same and it is represented in Fig. 3: two initial LSTM layers are going to reduce the number of features from 48 to 16 considering n sequential signals, i.e. {su,c,1, …, su,c,n} (in Fig. 3 n is set to 3 and the user and channel are fixed). With these n signals, a single latent vector is obtained, which is the information used to generate the cryptographic key. The decoder is constructed by repeating the latent vector and, with other two LSTM layers, it increases the dimensionality to recover the initial signal. An important consideration in the development of the protocol is the number of signals n that should be introduced into the autoencoder. The time needed to measure each signal, ti, is 240 ms. Since we want to construct not only a secure, but also a usable scheme, we impose to reduce the number n to the smallest possible number, so that the key can be generated in a timely manner. For instance, if 4 signals should be introduced in the LSTM autoencoder, we need a signal measured during almost 1 s, while only 240 ms are required if n=1. 4.3. Latent vector discretization The discretization process, applied to all signals of all users, is the following: Firstly, a WHT [3] is applied to the latent vector. This transformation is commonly used in the time–scale analysis of data and to characterize non–linear signals [20], and it is computationally efficient [8]. The Fast WHT algorithm implementation of Python calculates the Hadamard matrix by using Eq. (2), where x and u represent the (x, u)th entry of the input sequence, bi(x)are the bits elements of x, and m is half of the matrix order. f(x,u) = 1 2m/2( − 1)∑ n−1 i=0 bi(x).bi(u),(2) The result of the WHT is another vector of the same dimension as the latent vector, which is going to be discretized following four different strategies: attending to its mean, median, medium point, and sign. The four discretizations are independent and each element of the vector is set to 0 if its value is lower than the corresponding statistic (0 in the case of the sign) and 1 if it is greater. Once the four discretizations have been performed, the obtained vectors are concatenated, generating a new vector for each channel composed by 16 ×4=64 binary values. This longer vector is computed for each n samples, in other words, the LSTM layers define how many samples are used to create these vectors. 4.4. Seed generation Applying the previous procedure to all channels of a user and concatenating the outcomes the resulting vector is of 16 ×4×14 =896 elements, that is, a seed of 896 bits. However, some of these elements are not consistent with time and, therefore, should not be used to generate the seed. Consequently, we saved only those elements that, after the discretization, keep their value constant (e.g. are always 0 or 1). To do that, we divided the samples into three sets, training, validation, and test, and identified the constant elements in the training set. Then, we analyzed if those elements are also constant in the validation set, so that the same seed can be always obtained. The final results are reported over the test set. Finally, we made sure that there are not two users that generate the Fig. 2. DWT Algorithm. L. Hern´ andez-´ Alvarez et al.
Pattern Recognition Letters 173 (2023) 1–9 5 same seed and, therefore, they do not generate the same key either. We measured the Hamming distance of all seed pairs and all key pairs. In this specific case, we will use the SHA3-256 function to generate the cryptographic keys. Considering the whole scheme, some important aspects are highlighted: •The level of usability is limited by the number of required samples in the autoencoder, n. If we manage to reduce this number to 1, we would be generating a key without needing any previous information and with a period of 240 ms. •The level of security is increased by performing four different discretizations and concatenating the results. An intruder should generate exactly the same four vectors. •New keys can be generated with new training data. The key generation procedure starts by extracting the features and training an autoencoder. Hence, new training sets can be used to generate new keys if a renewal is required. •The vector elements that are constant and, therefore, the positions that define the seed depend on the autoencoder. •The seed length varies from one user to another and it is not predefined. This is an important security fact, as a potential attacker that wants to perform a brute force attack must try all possible combinations for several seed lengths. 5. Experimental settings and results In this section, we present a detailed description of the experiments. They include the training of the autoencoder, the seed generation results, and a complementary study reducing the number of EEG channels. All experiments have been carried out using Python 3.10.4 on Intel Core i7 at 2.00 GHz and 16 GB of RAM. The performance of the key generation mechanism is evaluated through the use of FAR, FRR, and HTER. 5.1. Autoencoder training The constructed autoencoders consisted on two initial LSTM layers that reduce the input data from 48 dimensions to 16. This is performed in each channel of every user and, thus, 14 different autoencoders are defined per user, each one trained with the data of one channel. Two more LSTM layers are used to recover the initial information. Although we are only interested in the latent vector (the result of the encoder) to generate the seed, it is important to verify that both the encoder and the decoder work successfully. By doing this, we can determine that the latent vector is an appropriate representation of the data. As pointed out in Section 3, one of our principal objectives is to generate keys with a high frequency and without storing any personal information. Consequently, we set the number of samples to be introduced in the autoencoder, n, to 1. In this way, no previous information is needed and, therefore, the EEG signals should not be stored and the keys can be Fig. 3. LSTM Autoencoder structure. L. Hern´ andez-´ Alvarez et al.
Pattern Recognition Letters 173 (2023) 1–9 6 generated faster. In our design, we have used the SELU activation funcion, as they remove the problem of vanishing gradients in deep neural networks. Also, we preferred to use SELU over the ReLU activation function because they learn faster and better without needing further processing [21]. We also employed the Adam optimizer with learning rate =0.001 and values of β1=0.2 and β2=0.999, and a decay of 0. To train the autoencoders we did a train–test split of 80–20%. In other words, 80% of the data was used for training, while the remaining 20% was utilized for testing. The process consisted on 750 epochs with a batch size of 32, and the metric used was the Minimum Square Error (MSE) loss. To avoid overfitting, we added a dropout layer with a rate of 0.1% between the LSTM layers. Additionally, we performed a cross–validation process with a validation split of 0.2. All mentioned parameters were selected after exploring different possibilities with trial and error tests. 5.2. Seed generation results Once it was ensured that the latent vectors represent the user’s information, the normalization process was executed, as explained in Section 4, only on the test set. Since the training set was used to train the autoencoder, using it in the seed generation process seed would imply overfitting. For a specific user, the result of each sample is a binary vector of 16 ×4×14 =896 elements (1’s and 0’s). Similarly to the autoencoder training, binary vectors achieved from the vector discretization are also divided into three sets: training (50%), validation (25%) and testing (25%). By doing this, we pretend to use the training set to identify the elements of the vectors that are constant (always 1 or always 0), and use the validation set to verify the generalization of the identification method. Hence, the testing set was left until the final try, to obtain the final metrics. To calculate the FAR and FRR of the generated seeds, we completed the testing set with binary vectors obtained from samples of other, randomly selected users, employing the autoencoders of the legitimate user. In this way, we represent a real case scenario in which an adversary want to access to the encrypted information impersonating the authorized user, but using his own EEG signal. The final testing set consisted in a 50% of positive samples (legitimate user) and 50% of negative ones (attackers). Fig. 4 contains two heat maps of the Hamming distances of every seed and key pair. The darker the square is, the more similar two seeds/ keys are. Consequently, the diagonals (positions in which a seed/key is compared with itself) are completely black. Comparing the rest of the squares with the diagonal, we can see that there are no two users that generate the same seed (and thus, the same key). Moreover, the keys’ heat map is more homogeneous than the seeds’ heat map. In fact, the greater and lower Hamming distances are, respectively, 0.762 and 0.349 for the seeds, and 0.635 and 0.401 for the keys. As examples, Table 1 shows the generated seed and key for two users in hexadecimal format. The results of the seed generation scheme are included in Table 2. To ensure the validity of the scheme, we randomly permuted the training and testing sets of the autoencoder, creating three different cases (denoted Autoencoder 1, 2, and 3). We also randomly permuted the binary vectors sets. In this table we include the average values for each individual case. The keys change when different binary vectors training sets are defined, but also when the autoencoder is trained with different data. This means that it is possible to renew or produce several keys for a user if needed. In all cases, the FAR obtained is 0, which implies that an attacker was never able to replicate the user’s seed with his/her own EEG. Additionally, the FRR is around 50%, which means that, on average, a user will generate his key in two attempts. This might be interpreted as a bad result, but considering that it takes 240 ms to generate the signal, these outcomes indicate that the seed can be generated in less than half a second. Even in the case in which the FRR of a user decreases to 25%, he/she would still be able to generate his/her key in less than a second. These numbers are the result of using just one sample in the autoencoder, which also implies that no user biometric information should be stored. The last consideration is the length of the generated seeds and their security against a brute–force attack. The average length is around 84–85 bits, being the minimum length 31 bits and the maximum length 196 bits. The key concept against a brute–force attack is that the attacker does not know the specific seed length of each user, as it is not predefined. Therefore, if an adversary wants to make sure that he/she replicates the correct seed, he/she must try every possible binary vector of all lengths, from 31 bits to 196 bits (in the favourable case that he/she knows the minimum and maximum values). This means that he/she should try 231 +…+2196 =2197 −231 times, which is a huge number, intractable in a reasonable amount of time. For this reason, we can consider that the computed seed lengths are long enough to avoid a brute–force attack. Finally, we verified that the seeds were composed of similar percentages of 1’s and 0’s and calculated the entropy of the Fig. 4. Hamming distance heat maps. L. Hern´ andez-´ Alvarez et al.
Pattern Recognition Letters 173 (2023) 1–9 7 generated seeds, obtaining a value of 0.968. This number was calculated as: entropy = − (p(0)⋅logp(0) + p(1)⋅logp(1)), where p(0)and p(1) represent the probability of obtaining, respectively, a 0 and a 1 in the generated seed. As the range of the entropy is [0,1], 0.968 is a meaningful result. Moreover, it should be highlighted that this value was obtained for every experiment, independently of the applied training set. 5.3. Channel reduction In order to implement the developed protocol in more easily wearable sensors, it is interesting to analyze the results with a smaller number of channels. Therefore, the previous experiments were repeated excluding the channels one by one from 14 to 8 channels. The removal order was defined according to a channel contribution analysis performed with Machine Learning techniques [11]: F7, F8, T7, AF4, P7, FC6. Table 3 includes the results regarding the generated seed lengths depending on the number of applied channels. It is clear that the seed is shorter when the number of channels is reduced; this makes sense, as there are 16 ×4=64 fewer possible bits per reduced channel. In Fig. 5, we show the FAR, FRR and HTER depending on the number of channels. Observing the evolution of the curves and associating FAR with security and FRR with usability, a greater number of channels implies better security, but worse usability. In other words, when fewer fchannels are employed, the seed is shorter and, hence, the user generates it more frequently. However, it is also easier for an attacker to replicate it. This implies a trade–off between security and usability, represented by the flatness of the HTER curve. We verified that, independently of the number of channels, the entropy values are around 0.96 and in any case there are two users generating the same seed. 6. Assessment 6.1. Goals assessment Results confirm that we successfully developed a cryptographic key generation scheme based on EEG signals and with an autoencoder–based feature extraction. Furthermore, it is also confirmed the achievement of the proposed goals: •Protocol universality: the proposed mechanism works for every subject of the database. •Key uniqueness: there are not two users that generate the same key. •Key unpredictability: the FAR obtained was 0 in all cases, which means that attackers were not able to generate the authorized user’s key. •Key consistency and time efficiency: despite the FRR might be improved, the generation key frequency guarantees that, on average, a user will be able to generate his/her key in less than 500 ms. However, there are also limitations. The percentage of FRR could be improved, ensuring the correct key generation in just one attempt and, thus, improving the usability of the scheme. Certainly, with this work Table 1 Seed and key examples (in hexadecimal). User 2 Seed 0xD00CA0A03AA085C7 Key 0xDF143E2D3A3F9969DAF205EF980FCFE637521B65363418CBC5BCA2B2ADFA5F26 User 22 Seed 0x55EE73DDCCDA49549550C8655A88CCD9F56AD91CEE50C3373 Key 0xD8DF39805D427E08045C1F681B94D349A82D7C05B2B67411E8FAD5597A176EC1 Table 2 Seed generation results. Seed length (bits) FAR FRR HTER % of 1 % of 0 mean std max min mean std mean std mean std mean std mean std Autoencoder 1 87.282 33.121 196 41 0 0 0.494 0.173 0.247 0.087 0.474 0.082 0.526 0.082 81.744 31.707 196 31 0 0 0.495 0.187 0.247 0.094 0.469 0.097 0.531 0.097 82.231 34.828 196 31 0 0 0.483 0.161 0.242 0.080 0.467 0.095 0.533 0.095 Overall 1 83.752 3.067 196 31 0 0 0.491 0.006 0.245 0.003 0.470 0.004 0.530 0.004 Autoencoder 2 87.692 32.694 196 43 0 0 0.508 0.191 0.253 0.094 0.459 0.095 0.541 0.095 82.692 34.671 196 31 0 0 0.486 0.161 0.243 0.080 0.468 0.095 0.532 0.095 85.795 33.292 196 35 0 0 0.457 0.183 0.228 0.091 0.465 0.105 0.535 0.105 Overall 2 85.393 2.524 196 31 0 0 0.483 0.026 0.242 0.013 0.464 0.005 0.536 0.005 Autoencoder 3 83.513 33.685 196 43 0 0 0.450 0.179 0.225 0.089 0.476 0.103 0.524 0.103 82.205 32.697 196 39 0 0 0.468 0.170 0.234 0.085 0.480 0.083 0.520 0.083 85.795 33.292 196 35 0 0 0.457 0.183 0.228 0.091 0.465 0.105 0.535 0.105 Overall 3 83.838 1.817 196 35 0 0 0.458 0.009 0.229 0.004 0.473 0.008 0.527 0.008 Final Overall 84.328 0.924 196 31 0 0 0.477 0.017 0.238 0.009 0.469 0.005 0.531 0.005 Table 3 Seed lengths. Number of channels mean std max min 14 85.851 33.408 196 35 13 81.461 32.281 191 38 12 76.974 31.267 177 38 11 70.462 29.960 162 26 10 64.103 27.833 146 18 9 57.974 26.382 136 17 8 51.667 22.883 124 17 Fig. 5. FAR, FRR, and HTER depending on number of channels. L. Hern´ andez-´ Alvarez et al.
Pattern Recognition Letters 173 (2023) 1–9 8 the applicability of autoencoders for key generation mechanisms with EEG data is studied, but we trained autoencoders with the same structure for all users. If a specific study is performed for each user, more personalized models may be developed, improving final results. Apart from this, the data processing and feature extraction processes require the storage of the autoencoders and, therefore, a secure platform with sufficient storage and computing capacity is needed to generate the key. This, nevertheless, should not be a problem, as the use of the proposed mechanism is linked with BCI, which fulfill the commented requirements. 6.2. Threat model A potential adversary may be interested in attacking the proposed protocol in different ways. Firstly, he/she might want to steal or modify the EEG signals after their collection by the EEG sensor, during its transmission to the interface. In some cases, even this server might be non–trusted or honest–but–curious. As a result, the first security concern is related to the privacy of the biometric signals. The transmission protocols should guarantee data confidentiality, integrity, availability, and non–repudiation. Moreover, all protocol parties should be authenticated. An alternative option could be the use of encrypted data to generate the cryptographic keys, in such a way that the original information does not have to leave the original device [12]. Apart from this, an important consideration in this work is the public knowledge about the data processing, feature extraction process, and configuration of the autoencoder. It is our belief that the general process and configurations should be public, so anyone can know how the protocol works, but the specific parameters (i.e. type of wavelet decomposition, activation function, dropout rate, learning rate, etc.) should be secret. In that case, even if the adversary has access to the user’s data, he/she would not have access to the models and, thus, will not be able to generate the exact same seed. We find this essential to avoid dataset poisoning attacks, model substitution attacks [4], and stealth attacks [26], among others. Considering the case in which the attacker wants to fool the scheme, we can distinguish two scenarios [6]: a random attack and a skilled forgery attack. The first case occurs when the attacker tries to (incorrectly) generate the user’s key using his/her own EEG signal. Based on the experiments of Section 5, we can say that this case is already solved. A more complicated situation is the second one, in which the attacker is able to reproduce the user’s data as closely as possible. Compared to other examples (gesture or keystroke), it is difficult to forge an EEG signal. For this reason, Generative Adversarial Networks (GANs) can be used to replicate the statistic distribution of a specific user’s EEG. This attack is not considered in this proposal but it will be addressed in the near future. 7. Conclusion and future work In the present study, we have developed an EEG–based time- –invariant key generation mechanism with a real–world EEG database. LSTM autoencoders were employed to extract the biometric features of the signals, and results show that the generated seeds are secure against random attacks. Moreover, the key generation period was set to 480 ms on average and seeds are generated with an entropy of 0.968. This scheme was constructed without storing neither any biometric information of the user nor the cryptographic key. For future works, we want to improve the FRR by constructing more personalized autoencoders and exploring different Deep Learning techniques. The generation of a bigger database with more users and data, as well as the use of other public datasets are other future works. Additionally, one of our next goals is to study the use of GANs to execute skilled forgery attacks against EEG–based authentication/identification and key generation schemes. Declaration of Competing Interest The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper. Data availability The authors do not have permission to share data. Acknowledgment This work was supported in part by the R&D&I project P2QProMeTe, Grant PID2020-112586RBI00 funded by MCIN/AEI/10.13039/ 501100011033; in part by the Madrid (Spain) Government under the multianual agreement with UC3M (“fostering young doctor research”, DEPROFAKE-CM-UC3M) and in the context of the V PRICIT research and technological innovation regional program; in part by the European Telecommunications Standards Institute (ETSI) SmartBAN; in part by the European Union’s Horizon 2020 Research and Innovation Programme under Grants 872752 and 101017331. L.H.A. thanks CSIC Project CASDiM for its support. References [1] G. Bajwa, R. Dantu, Neurokey: towards a new paradigm of cancelable biometricsbased key generation using electroencephalograms, Comput. Secur. 62 (2016) 95–113, https://doi.org/10.1016/j.cose.2016.06.001. [2] D. Bank, N. Koenigstein, R. Giryes, Autoencoders, Comput. Res. Repos. (CoRR) (2020) 1–22, https://doi.org/10.48550/arXiv.2003.05991. [3] T. Beer, Walsh transforms, Am. J. Phys. 49 (1981) 466–472, https://doi.org/ 10.1119/1.12714. [4] M.Z. Comiter, Attacking Artificial Intelligence AI’s Security Vulnerability and What Policymakers Can Do about It. Tech. Rep., 2019.https://www.belfercenter.org/si tes/default/files/2019-08/AttackingAI/AttackingAI.pdf [5] E. Epoc+, Epoc+user manual, 2022, Last accessed 9 May 2022. [6] J. Fabregas, M. Faundez-Zanuy, On-line signature verification system with failure to enroll managing, Pattern Recognit. 42 (2009) 2117–2126, https://doi.org/ 10.1016/j.patcog.2009.01.019. [7] M. Fraschini, S.M. Pani, L. Didaci, G.L. Marcialis, Robustness of functional connectivity metrics for EEG-based personal identification over task-induced intraclass and inter-class variations, Pattern Recognit. Lett. 125 (2019) 49–54, https:// doi.org/10.1016/j.patrec.2019.03.025. [8] L. Gonz´ alez-Manzano, J.M. de Fuentes, P. Peris-Lopez, C. Camara, Encryption by heart (EbH)—using ECG for time-invariant symmetric key generation, Future Gener. Comput. Syst. 77 (2017) 136–148, https://doi.org/10.1016/j. future.2017.07.018. [9] T. Hastie, R. Tibshirani, J. Friedman, The Elements of Statistical Learning, Springer, 2009, https://doi.org/10.1007/978-0-387-71041-9. [10] R.G. Hefron, B.J. Borghetti, J.C. Christensen, C.M.S. Kabban, Deep long short-term memory structures model temporal dependencies improving cognitive workload estimation, Pattern Recognit. Lett. 94 (2017) 96–104, https://doi.org/10.1016/j. patrec.2017.05.020. [11] L. Hern´ andez-´ Alvarez, E. Barbierato, S. Caputo, L. Mucchi, L. Hern´ andez Encinas, EEG authentication system based on one- and multi-class machine learning classifiers, Sensors 23 (2023) 186, https://doi.org/10.3390/s23010186. [12] L. Hern´ andez-´ Alvarez, J.M. de Fuentes, L. Gonz´ alez-Manzano, L. Hern´ andez Encinas, SmartCAMPP - smartphone-based continuous authentication leveraging motion sensors with privacy preservation, Pattern Recognit. Lett. 147 (2021) 189–196, https://doi.org/10.1016/j.patrec.2021.04.013. [13] L. Hern´ andez-´ Alvarez, J.M. de Fuentes, L. Gonz´ alez-Manzano, L. Hern´ andez Encinas, Privacy-preserving sensor-based continuous authentication and user profiling: a review, Sensors 21 (2021) 92, https://doi.org/10.3390/s21010092. [14] A.K. Kumar Nitendra, A.H. Siddiqi, Wavelet transform for classification of EEG signal using SVM and ANN, Biomed. Pharmacol. 10 (2017) 1–9, https://doi.org/ 10.13005/bpj/1328. [15] E. Maiorana, Learning deep features for task-independent EEG-based biometric verification, Pattern Recognit. Lett. 143 (2021) 122–129, https://doi.org/10.1016/ j.patrec.2021.01.004. [16] E. Maiorana, A survey on biometric recognition using wearable devices, Pattern Recognit. Lett. 156 (2022) 29–37, https://doi.org/10.1016/j.patrec.2022.03.002. [17] National Institute of Standards and Technology, SHA-3 Standard: Permutation- Based Hash and Extendable-Output Functions 202, NIST FIPS, 2014.http://csrc. nist.gov/publications/drafts/fips-202/fips_202_draft.pdf [18] D. Nguyen, D. Tran, D. Sharma, W. Ma, On the study of EEG-based cryptographic key generation, Procedia Comput. Sci. 112 (2017) 936–945, https://doi.org/ 10.1016/j.procs.2017.08.126. L. Hern´ andez-´ Alvarez et al.
Pattern Recognition Letters 173 (2023) 1–9 9 [19] M. Obaidat, I. Trore, I. Wougang, Biometric-Based Physical and Cybersecurity Systems, Springer, 2019, https://doi.org/10.1007/978-3-319-98734-7. [20] H. Pan, D. Badawi, C. Chen, A. Watts, E. Koyuncu, A.E. Cetin, Deep neural network with Walsh–Hadamard transform layer for ember detection during a wildfire. Proc. 2022 IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops (CVPRW), 2022, pp. 256–265, https://doi.org/10.1109/ CVPRW56347.2022.00040. [21] A.D. Rasamoelina, F. Adjailia, P. Sinc´ ak, A review of activation function for artificial neural network. 2020 IEEE 18th World Symposium on Applied Machine Intelligence and Informatics (SAMI), 2020, pp. 281–286, https://doi.org/10.1109/ SAMI48414.2020.9108717. [22] K. Ravi, R. Palaniappan, C. Eswaran, S. Phon-Amnuaisuk, Data encryption using event-related brain signals. International Conference on Computational Intelligence and Multimedia Applications (ICCIMA 2007), 2007, pp. 540–544, https://doi.org/10.1109/ICCIMA.2007.178. [23] A. Singandhupe, H. Manh La, D. Feil-Seifer, P. Huang, L. Guo, M. Li, Securing a UAV using individual characteristics from an EEG signal. 2017 IEEE International Conference on Systems, Man, and Cybernetics (SMC), 2017, pp. 2748–2753, https://doi.org/10.1109/SMC.2017.8123042. [24] A. Sodhro, C. Sennersten, A. Ahmad, Towards cognitive authentication for smart healthcare applications, Sensors 22 (2022), https://doi.org/10.3390/s22062101. [25] S.E. Tuiri, N. Sabil, N. Benamar, C.A. Kerrache, G. Koziel, An EEG based key generation cryptosystem using Diffie–Hellman and AES. Proc. 2nd IEEE Middle East and North Africa COMMunications Conference (MENACOMM 2019), 2019, pp. 1–6, https://doi.org/10.1109/MENACOMM46666.2019.8988578. [26] I. Tyukin, D. Higham, A. Gorban, On adversarial examples and stealth attacks in artificial intelligence systems. Proc. 2020 International Joint Conference on Neural Networks (IJCNN), 2020, https://doi.org/10.1109/IJCNN48605.2020.9207472. [27] A. Valsaraj, I. Madala, N. Garg, M. Patil, V. Baths, Motor imagery based multimodal biometric user authentication system using EEG. Proc. 2020 International Conference on Cyberworlds (CW), 2020, pp. 272–279, https://doi.org/10.1109/ CW49994.2020.00050. [28] M. Wang, K. Kasmarik, A. Bezerianos, K.C. Tan, H. Abbass, On the channel density of EEG signals for reliable biometric recognition, Pattern Recognit. Lett. 147 (2021) 134–141, https://doi.org/10.1016/j.patrec.2021.04.003. [29] X. Wang, Y.L. Yin, H. Yu, Finding collisions in the full SHA-1. Advances in Cryptology - CRYPTO 2005, Lecture Notes Comput. Sci., 2005, pp. 17–36, https:// doi.org/10.1007/11535218_2. [30] Y. Wang, D. Wu, X. Liu, X. Hei, Never lost keys: a novel key generation scheme based on motor imagery EEG in end-edge-cloud system, China Commun. 19 (2022) 172–184, https://doi.org/10.23919/JCC.2022.07.014. [31] H. Yang, V. Mihajlovi´ c, T. Ignatenko, Private authentication keys based on wearable device EEG recordings. 2017 25th European Signal Processing Conference (EUSIPCO), 2017. [32] M. Zeynali, H. Seyedarabi, B. Mozaffari Tazehkand, Development of a unique biometric-based cryptographic key generation with repeatability using brain signals, J. AI Data Min. 8 (2020) 343–356, https://doi.org/10.22044/ jadm.2020.7858.1923. L. Hern´ andez-´ Alvarez et al.