Method for generating a pseudorandom number and method for symmetrically encrypting a message
Patent Information
- Application Number
- EP2022800654
- Authority / Receiving Office
- EP · EP
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2021-10-08
- Filing Date
- 2022-10-10
- Publication Date
- 2024-08-14
AI Technical Summary
Existing symmetric encryption methods, such as AES, are vulnerable to side-channel attacks and have insufficient resistance against quantum computer brute force attacks, while the One Time Pad (OTP) method is impractical due to its requirements for masks of equal length to messages and difficulty in secure transmission.
A method generating pseudo-random numbers through an exclusive OR operation with a nonce and a one-way hash function, used for symmetric encryption, which is resistant to side-channel attacks and provides a secure, efficient way to encrypt messages by using pseudo-random masks generated from a seed value and nonce.
This method offers robust encryption resistant to side-channel attacks and maintains security against quantum computer attacks, with a reduced computational latency compared to AES, while ensuring the pseudo-random masks are unique for each message, making it practical for real-time data streams.
Smart Images

Figure 1.1 
Figure 1.2
Abstract
Description
Description Title of the invention: Method for generating a pseudo-random number and method for symmetrically encrypting a message
[0001] This invention relates to computer-implemented methods for generating a pseudo-random number and a method for symmetrically encrypting a message. PREVIOUS TECHNIQUE
[0002] It is very common to want to protect the exchange of information. This protection is based on the encryption of messages, such as text, voice and images, exchanged between a sender and a receiver.
[0003] The entire process is called "end-to-end encryption" if the message is encrypted from sender to recipient(s) without being intelligible to the servers or other services involved in routing the message. Only the message sender and the intended recipients should be able to see the unencrypted content.
[0004] The only known and mathematically proven unbreakable symmetric encryption method is the One-Time Pad (OTP) method. This method is unbreakable by any computer. However, its implementation requires adherence to very strict conditions, which has thus far discouraged its use as a basis for the symmetric encryption of long messages.
[0005] OTP encryption is inherently unbreakable, regardless of the computing power used, and therefore, in principle, it offers an infinite level of security. A message of length n bytes is masked by an exclusive OR operation with the bytes of a mask of the same length n. To decrypt the masked message, the same exclusive OR operation must be repeated, which requires the mask. This mask cannot be calculated, and there are as many possible masks as there are intelligible messages (in all possible languages) of the same length n, without any way to guess which one is correct. The message length is the only information accessible to an attacker who does not have the mask, regardless of the available computing power.The same mask must not be reused, because if an attacker were to somehow know the encrypted and decrypted versions of a message, they would be able to calculate the mask by performing an exclusive OR operation between the two versions and reuse the mask for subsequent messages encrypted with the same mask. The major drawback of the OTP method is that the recipient must also have the mask to decrypt the message, that this mask is as long as the message and therefore just as difficult to transmit securely, and that it must be different each time.
[0006] As such, the OTP symmetric encryption method is not usable in practice.
[0007] Other symmetric encryption methods have been developed, and some have been standardized, such as the Advanced Encryption Standard (AES). These algorithms are not unbreakable. In the case of AES, which is the most commonly used, this algorithm is vulnerable to side-channel attacks. Moreover, in its most robust version with a 256-bit key length, its resistance to brute-force attacks from quantum computers will be insufficient, as a minimum of 512 bits is required. Indeed, due to the potential use of Grover's algorithm on a quantum computer, as described in "Grover LK: A fast quantum mechanical algorithm for database search, Proceedings, 28th Annual ACM Symposium on the Theory of Computing, (May 1996) p. 212," the level of security against the risk of brute-force cracking AES-256 drops from 256 bits to 256 / 2 = 128 bits.For encrypting real-time data streams, specific algorithms have been developed with AES as the underlying algorithm. These are Gallon Counter Mode (GCM) and Offset Codebook Mode (OCB). In addition to the drawbacks of AES mentioned earlier, these two modes introduced further weaknesses. A more recent version of AES-GCM, AES-GCM-SIV, addresses some of the weaknesses of AES-GCM (reference "Gueron, S. (April 2019). - ACM hJg nee Misuse-Resistant Authenticated Encryption. IETF, doi: 10.17487 / RFC8452"), but at the cost of a significant performance degradation.
[0008] The present invention aims to remedy one or more of the drawbacks associated with the prior art. SUMMARY OF THE INVENTION
[0009] In accordance with the present inventions, a computer-implemented method is provided for generating at least one pseudo-random number comprising: obtaining a seed value, K, of a certain entropy represented by its bit length; combining, using an exclusive OR (XOR) operation, the seed value, K, with a pseudo-random nonce, N, of the same bit length s, the combination represented by (K A N) where A is an exclusive OR operation; and the execution of a one-way hash function, H, adapted to the bit length on the combination (K A N) to generate a value, M'o, where the pseudo-random number M'i +i is calculated according to H(M'i), where 0 < i < n-1.
[0010] This method is a practical and robust way to provide a pseudo-random number. Furthermore, this process, and any other process relying on its implementation, is resistant to side-channel attacks. The OR operation exclusive is performed with a constant number of clock cycles, regardless of the values of K and N. This operation therefore cannot be subject to side-channel attacks based on the statistical analysis of computation times or power consumption required for this computation if this process is repeated a large number of times with the same key K since these computation time and power consumption data remain constant.
[0011] A nonce, which can be called a cryptographic nonce, is an arbitrary number that can only be used once in a cryptographic communication. The function H(K A N) be called HXOR, where it is defined by HXOR(K, N) = H(KA N).
[0012] Advantageously, the process comprises producing a sequence of pseudo-random masks Mi using a sequence of pseudo-random numbers M'i and the nonce N for generating the pseudo-random numbers, according to the expression Mi = H(M'i A N), where O < i < n.
[0013] Furthermore, the present invention relates to a method for encrypting a message, P, comprising the following steps: dividing the message, P, into n equal parts, Pi, where 0 < i < n, of the chosen bit length s; combining each part, Pi, with the mask, Mi, of the same bit length s, where 0 < i < n, to form an encrypted part, Co to C n -i, for each part; and the concatenation of the nonce N and the ciphertext parts, Co to C n -i to form an encrypted message, C, in which each mask, M o to M n.i, is a pseudo-random number generated according to the process for generating a pseudo-random number.
[0014] Also, the combination includes an exclusive OR XOR operation.
[0015] According to one characteristic, the process includes the creation of a signature, S, for the encrypted message C.
[0016] Advantageously, the method includes calculating the signature, S, according to HMAC(S n -i, M'n), where S n -i is the nth value in a sequence calculated according to Si+i = Si A Pi+i, where 0 < i < n, So is Po and where M' n is the n+1st value in the sequence of pseudo-random numbers M'i.
[0017] Alternatively, the process includes calculating the signature, S, according to HXOR(S n -i, N), where S n -i is the nth value in a sequence calculated according to Si+i = Si A Pi+i, where 0 < i < n, So is Po and N is the nonce.
[0018] Also, the encryption process includes attaching the signature, S, to the ciphertext C, to form a signed ciphertext T.
[0019] Furthermore, the present invention relates to a method for decrypting the ciphertext C, elaborated according to claim 3, comprising recovering the nonce N and the ciphertext parts, C0 to C1. n -i of the encrypted message C, the calculation of the masks according to claim 2; the decryption of each encrypted part Co to C n -i, with the priming value, K and the nonce N, to form equal parts, Po to P n -i; and the combination of parts Po to P n -i to form the message P.
[0020] Furthermore, the present invention relates to a method for encrypting a data stream F, comprising: dividing the data stream F into packets Pi, of bit length s, with i > 0; transmitting a pseudo-random nonce N in the encrypted stream CF; and encrypting each packet Pi, where an encrypted packet Csi = (Pi A M 2i ) and C2i+i = (Pi A M 2i+ i), where Mi is the sequence of pseudo-random masks Mi according to claim 2; the concatenation of the number i with to form C 2i and C2i+i to form the encrypted version (i | C 2i | C2i+i); and the transmission of the encrypted version in the CF encrypted data stream.
[0021] Furthermore, the present invention relates to a method for decrypting an encrypted CF data stream, elaborated according to claim 8, comprising: retrieving the nonce N at the beginning of the transmission of the encrypted CF data stream, enabling the calculation of the sequences Mi and M'i according to claim 2; decrypting each encrypted version (i | C 2i | C2i+i) in Di = C 2i A M 2i ; and the integrity check consisting of establishing that Di = Msi+i A C2i+i, with the certainty that Di = Pi, if this verification is positive.
[0022] Advantageously, if s > 512, the hash function, H, has a quantum security level of more than 170 bits with respect to its inversion.
[0023] According to one characteristic, the hash function, H, is a Keccak hash function.
[0024] According to another characteristic, the chosen bit length is 512 bits.
[0025] Furthermore, the present invention relates to a computer-implemented method for symmetric encryption using a key K, comprising: obtaining a pseudo-random nonce N for each plaintext message P to be encrypted, each nonce having the same length in bits s as the key K; combining, using an exclusive OR (XOR) operation, the key K with the nonce N, the combination represented by (K A N) where A is an exclusive OR operation; the execution of a one-way hash function, H, adapted to the bit length on the combination (K A N) to generate a modified key, K'; encryption of the message P using the modified key, K'; and concatenation of the nonce N with the result of this encryption to constitute the ciphertext C.
[0026] Such a method is resistant to side-channel attacks.
[0027] Furthermore, the present invention relates to a computer-implemented method for the symmetric decryption of the ciphertext C according to claim 14, comprising: obtaining the pseudo-random nonce N of the ciphertext C; combining, using an exclusive OR (XOR) operation, the key K with the nonce, N, the combination represented by (K A N) where A is an exclusive OR operation; the execution of the one-way hash function, H, on the combination (K A N) to generate the modified key, K'; and decryption of the ciphertext C using the modified key, K', to obtain the plaintext P.
[0028] Within the scope of this application, it is expressly provided that the various aspects, embodiments, examples, and variants set forth in the preceding paragraphs, in the claims, and / or in the description and drawings that follow, and in particular their individual features, may be considered independently or in combination. That is to say, all embodiments and / or features of any embodiment may be combined in any manner and / or combination, unless such features are incompatible. The applicant reserves the right to amend any claim originally filed or to file any new claim accordingly, including the right to amend any claim originally filed to depend on and / or incorporate any feature of any other claim, even if it was not originally claimed in that manner. BRIEF DESCRIPTION OF THE FIGURES
[0029] Embodiments of the invention are described below with reference to the attached drawings, in which: Fig. 1 (a) is a flowchart of a method for generating a pseudo-random number based on disclosure; Fig. 1 (b)-is a flowchart of a process for generating a sequence of pseudo-random numbers according to the disclosure; Fig. 2(a) is a flowchart of another method for generating a pseudo-random number based on disclosure; Fig. 2(b) is a flowchart of another method for generating a sequence of pseudo-random numbers according to the disclosure; Fig. 3 is a flowchart of another method for generating a pseudo-random number according to the disclosure; Fig. 4 is a flowchart of a message encryption process based on disclosure; Fig. 5 is another flowchart of the message encryption process according to the disclosure; Fig. 6 (a) and (b) are flowcharts of processes for calculating a signature for a message according to the disclosure; Fig. 7 (a) and (b) are schematic diagrams of encrypted messages according to the disclosure; Fig. 8 (a), (b) and (c) are flowcharts of a method for encrypting a data stream of packets with integrity verification of each packet according to the disclosure; Fig. 9(a) is a flowchart of a known symmetric encryption process; Fig. 9(b) is a flowchart of a symmetric encryption process based on disclosure; and Fig. 10 is a functional diagram of a computer device. DETAILED DESCRIPTION
[0030] Figure 1(a) shows a flowchart of a method for generating a pseudo-random number using a hash function, H, 100. The hash function, H, 100, takes as input a key, K, 102, of a certain bit length s, which serves as the starting value for the process, and transforms it into a pseudo-random number, M, 104, of the same bit length. The hash function, H, 100, can be a good-quality one-way hash function, such as the Keccak hash function. Figure 1(b) shows a flowchart representing a modification of the method illustrated in Figure 1(a), which generates a sequence of pseudo-random numbers. In Figure 1(b), the pseudo-random number produced by the hash function, H, 100, is fed back into the hash function, H, 100, as the starting value. In this way, the sequence of pseudo-random numbers, Mi, can be represented by H(Mi - i), where i > 0, and Mo = K.All Mi values will retain the same level of information entropy as the seed value, K, 102. Although this process is entirely deterministic, the characteristics of the function H, 100 recalled above imply that the all-order autocorrelation levels of the Mi sequence remain close to zero due to the uniformity of the probability density of the H, 100 values, as long as no Mi value is a collision value of H, 100. If the H, 100 function is of good quality, the probability of this occurring remains very low. Furthermore, knowing one or all of the Mi values does not allow determining the key K, 102 with a level of security equal to the bit length of the hash function for a classical deterministic computer.
[0031] Referring to Figure 2(a), an alternative method for generating a pseudo-random number is shown, where the key, K, 10², is first combined with a pseudo-random nonce, N, 10⁶, of the same bit length. A nonce is an arbitrary number used only once in cryptographic communication. The entropy level of the value N, 10⁶, has no effect on the entropy level of the constructed pseudo-random number sequence. The key K, 10², and the nonce N, 10⁶ can be combined using an exclusive OR operation, XOR, 10⁸. According to the procedure illustrated in Figure 1, the output, M, of the hash function, H, 10⁰, is a pseudo-random number 10⁴ equal to HXOR(K, N). In Figure 2(b), the output, Mi, of the hash function, H, 100 can be fed back into the hash function, H, 100 to create a sequence of pseudo-random numbers. In this way, the sequence of pseudo-random numbers, M i;can be represented by H(Mi -1), where i > 0, and M o = K AN. In addition to the properties of the process related to Figure 1, this alternative method allows the process to be repeated with a different value of N, 10⁶, should a collision occur during the calculation of the sequence Mi. It also allows the generation, with the same starting value K, 10², of several sequences with different values of N, 10⁶. The correlation level of these different sequences, as well as the autocorrelation level of each sequence, remains close to zero due to the properties of the hash function H, 100. However, the sequence Mi is not a fully partitioned sequence. A sequence of pseudo-random numbers is said to be fully partitioned if knowing a value Mi of this sequence does not allow us to deduce any other value Mj, with ji, of this sequence.In the pseudo-random number sequence described above, knowledge of Mi does not allow us to deduce any of the Mj with 0 < j < i, nor the key K, but all the Mj with j > i can be deduced from Mi. To use a pseudo-random number sequence in masking a message to be encrypted while preserving the mathematical inviolability properties of the OTP, it is necessary to ensure that the masking process is indistinguishable from chosen ciphertext adaptive attacks (IND-CCA2). To achieve this, the property of no autocorrelation is not sufficient, and the sequence must also be completely partitioned.
[0032] The first operation in the process shown in Figures 2(a) and 2(b) is the exclusive OR operation between the key K and the nonce N. This operation is performed with a constant number of clock cycles, regardless of the values of K and N. Therefore, this operation cannot be subject to side-channel attacks based on statistical analysis of the computation time or power consumption required for this computation if the process is repeated a large number of times with the same key K, since these computation time and power consumption data remain constant. Furthermore, if the nonce N is different each time this process is repeated, the result of this The first operation is also different each time. Thus, even if the key K remains constant, the rest of this process beyond this first operation has as its input a data that is different each time, and the statistical analysis of the computation times or power consumption for the rest of this process cannot reveal any value that would remain constant in the repetition of the process. Overall, the process is therefore resistant to side-channel attacks. Consequently, any other process relying on the implementation of this process will also be resistant to side-channel attacks.
[0033] Referring to Figure 3, we see a flowchart representing another method for generating a pseudo-random number sequence, using an intermediate pseudo-random number sequence. The generated sequence is fully partitioned. The process in Figure 3 is similar to that in Figure 2(a) and (b) in that a key, K, 102, of a certain bit length s is combined, using an exclusive OR function 108a, with the pseudo-random nonce, N, 106, of the same bit length s, the output being subjected to the hash function, H, 100a, to generate an intermediate pseudo-random number, M', 110. The intermediate pseudo-random number, M', 110 is combined with the nonce, N, 106, using an XOR operation 108b, the result being fed into another hash function, H, 100b, to output the pseudo-random number, M = HXOR(M', N).By passing each intermediate pseudo-random number, M', 110, through the hash function, H, 100a, to create the next intermediate pseudo-random number M'i in the sequence, a sequence of n pseudo-random numbers can be created. Thus, the first intermediate pseudo-random number M'o, is calculated according to HXOR(K, N) and M'i. +i is calculated according to H(M'i), where 0 < i < n-1. The sequence of intermediate pseudo-random numbers can then be combined with the nonce, N, 106, to generate the pseudo-random numbers, according to the expression Mi = HXOR(M'i, N), where 0 < i < n. In addition to the properties of the processes related to Figures 1 and 2, this alternative process has the property of not allowing the calculation of the values Mj and subsequent values of the sequence from the sole knowledge of N, 106 and the values Mi for 0 < i < j. This new sequence Mi of pseudo-random numbers is therefore completely partitioned.
[0034] Figure 4 shows a flowchart illustrating a message encryption method. The message is represented by a block P. In Figure 4(a), the message P is divided into n equal parts, P0 to P1. n -i, of the chosen binary length s. The message P can be padded with additional padding bits to bring it to the binary length required to allow division into equal parts of a certain chosen binary length. In one example, the chosen binary length is 512 bits. In Figure 4(b), each part, Pi, of the message is combined with a pseudo-random mask, Mi, from a sequence of masks of the same chosen binary length s, using an exclusive OR (XOR) operation, to form a ciphertext part, Ci. In Figure 4(c), the nonce N and the ciphertext parts are then concatenated together to form a ciphertext message, C. The masks, M o to M n-i, can be pseudo-random numbers generated according to any of the methods in figures 2 and 3, the method in figure 1 not allowing a different mask for each message.
[0035] In this way, One Time Pad symmetric encryption can be provided securely and economically for encrypting transmitted information, but with a reduced level of security compared to infinity. In an example where the chosen binary length is 512 bits and the method conforms to that of Figure 3, the security level is 512 bits against attacks originating from classical computers and three times lower against those originating from quantum computers (170 bits).
[0036] Because the mask calculation is completely independent of the message to be encrypted, for data streams where reducing transmission latency is critical, frame generation and mask construction can be two parallel processes. Latency is therefore only penalized by the exclusive OR operation, which is one of the fastest achievable on a computer. This is a significant advantage over other symmetric encryption algorithms, such as AES 256, where the message to be encrypted must be available before encryption operations can begin, and these operations are much slower than a simple exclusive OR.
[0037] For the one-way hash function, the Keccak algorithm, as described in "Guido Bertoni, Joan Daemen, Michaël Peeters, Gilles Van Assche and Ronny Van Keer, KANGAROO Twelve: fast hashing based on KECCAK-p, International Association for Cryptologic Research, 2016", has a security level of 512 bits against attacks from classical computers. The security level against attacks from quantum computers was determined in "Gilles Brassard, Peter Hoyer and Alain Tapp, Quantum cryptanalysis of hash and claw-free functions, Springer, 2006" and is equal to 512 / 3, which is approximately 170.
[0038] If the entropy of the information of the seed value K is 512 bits, all Mi will retain the same level of entropy, namely 512 bits, if the probability of a collision, when applying the function H to M, remains sufficiently low.
[0039] The use of pseudo-random numbers generated by the method described in relation to Figure 3 prevents the decryption of a block of a message if an attacker somehow obtained the plaintext and ciphertext of a previous block of the message. In this way, it is possible to resist attacks at a level of indistinguishability under chosen ciphertext adaptive attack (IND-CCA2).
[0040] To fully address an IND-CCA2 level attack, it is necessary to ensure that obtaining the encrypted and decrypted versions of a block of message P, by any means, does not allow the decryption of subsequent blocks of the same message. In this regard, the calculation of the mask sequence must conform to the method shown in Figure 3, constructing two sequences Mi and M'j as follows, while using the fully partitioned sequence Mi to mask the information Pi: M'j = HXOR(K, N), M'j +i = H(M'i), for all i such that n-1 > i > 0 and Mi = HXOR(M i, N), for all i such that n > i > 0.
[0041] Referring to Figure 5, we see another flowchart illustrating Method 50 for encrypting a message, such as the message P in Figure 4. Method 50 involves dividing the message into equal parts of a certain binary length at block 120. The message can be extended with additional bits if necessary. At block 122, each of the n parts of the message is combined using an exclusive OR operation with a sequence of masks of the same binary length, such as the mask M in Figure 4, to form ciphertext parts. Then, at block 124, the method involves concatenating the nonce N and the masked parts into a ciphertext message.
[0042] Referring now to Figure 6(a), we see a flowchart of a process for generating a signature, S, for the encrypted message. The use of a signature allows verification of the integrity of the information after transmission. The signature, S, can be attached to the encrypted message. The signature to be attached to the encrypted message is the nth value of a sequence calculated from an exclusive OR (XOR) operation performed on a subset, Pi+i, of the message with the previous value of the signature sequence, Si. When the final value (the nth value) is calculated, a hash function, H, is executed on this final value to generate the signature. Thus, according to Figure 6(a), the signature, S, can be calculated according to HMAC(S n -i, M' n ), where M' n = H(M' n -i), S n -i is the nth value in a sequence calculated according to Si+i = Si A P i+ i, where 0 < i < n-1, and So is P oHMAC(m, k) is a key-based hash function for integrity checking, calculating a result from a message m and a key k. Alternatively, the signature S can be calculated according to HXOR(S n -i,N), according to Figure 6(b), but this method, which is less computationally expensive, is not the subject of a standard like RFC 2104 in the case of HMAC.
[0043] Referring now to Figure 7, functional diagrams of encrypted messages that can be created according to the methods of The invention. Figure 7(a) shows a ciphertext message, C, formed from the combination of the masked parts with the nonce N. Using the pseudo-random number generation described in relation to Figures 2 or 3, the mask is made disposable because the pseudo-random nonce N, and therefore the sequence of masks Mi, are different for each message. The methods in Figures 2 and 3 guarantee that, knowing both versions, plaintext and ciphertext, of a message, the mask could not be calculated with a quantum security level of 170 bits, which is that of the hash function inversion with a quantum computer. The ciphertext message then becomes, C = N | (P o A M o ) | (Pi A Mi) | (P2 A M2) ... | (P n -i A M n-i), because N is necessary for decryption but can be transmitted freely without compromising security. Only the method in Figure 3 can withstand IND-CCA2 attacks with this level of security. In the message encryption process in Figure 7(a), the transmitted message T is simply identical to the encrypted message C.
[0044] Figure 7(b) shows an encrypted message C formed as in Figure 7(a) from the combination of the masked parts with the nonce N. A signature S calculated according to the process related to Figure 6 is also shown. The transmitted message T is the signed message associating C with S.
[0045] For decryption, if T = N | Co | Ci | C2... | C n | S is the encrypted message, possibly signed if S is present, and if the recipient possesses the key K, they can reconstruct the sequences M'i and Mi with the same formulas as before, constructing the decrypted message D = (CoA M o ) | (Ci A Mi) | (C2 A M2) ... | (C n -i A M n -i). If the message is signed, it can also reconstruct the signature S' = HMAC(S n -i, M' n ) with S'o = Do, S'i+i = S'i A D i+ i, for all i such that n-1 > i > 0. Alternatively, as seen above, this signature could be reconstructed according to S' = HXOR(S n -i,N).
[0046] In the case of a signed message, integrity verification can be done by testing the equality S = S', with a very high probability that Di = P i; for all / such that n > i > 0, if the test is positive.
[0047] To encrypt and decrypt, with or without integrity checking, a plaintext message P of any length, it suffices to have previously exchanged, using a signed asymmetric encryption method, a key K of a certain bit length s, for example 512 bits, constructed to ensure an entropy level of 512 bits, and then to encrypt each message with a different value of the nonce N. In OTP encryption, the fact that the security level is infinite stems from the fact that there is no criterion for choosing which of the possible masks corresponds to the encryption chosen by the sender. In embodiments of the invention, this criterion exists as soon as the message has more than one block or is signed. If the message is not signed but it The message contains several blocks; the criterion, when trying a key K, will be that all decrypted blocks are simultaneously "intelligible" in at least one language. If the message is signed, the criterion will simply be that for the tried key K, we obtain S=S'. The security level is therefore not infinite, but decryption without the key requires exploring 2 512 possibilities for a key K and a hash function of length 512 bits. This gigantic number, on the order of magnitude of the square of the number of atoms in the universe, makes decryption impossible in practice, even with an attack device using a quantum computer for which the level of security is reduced however from 512 to 170.
[0048] If the pseudo-random nonce N is inadvertently reused to encrypt two plaintext messages P and P', the consequences will be very limited. If the attacker has detected the reuse of nonce N and knows the encrypted and decrypted versions of P, and that P has n blocks, they will be able to know the decrypted version of the first n blocks of P', but this will be the only possible compromise. The key K cannot be reconstructed to decrypt other messages, and if P' has more blocks than P, the last blocks cannot be decrypted. More precisely, the only blocks of P' that can be decrypted are those for which the encrypted and decrypted versions of the same sequence number of P are known to the attacker. Due to this very significant limitation, the encryption process whose mask sequence calculation is based on Figure 3 of the present inventions can be considered a process resistant to nonce reuse.Furthermore, with a nonce N of length s bits with s > 512, if the pseudo-random nonce drawing process is initialized with an entropy of s bits, the probability of inadvertently reusing a nonce value is practically zero.
[0049] Referring to Figure 8, flowcharts are shown illustrating the process of encrypting a stream of data packets. When the message to be encrypted is a stream of bit or data packets, each packet being relatively small but with a potentially very large number of packets, as in the case of real-time audio or video streams, it is not possible to wait until the end of the message transmission to verify its integrity. It is therefore desirable to verify this integrity at the level of each packet. In this case, the encryption process can be adapted to a stream organized into successive packets of s bits Pi, with i > 0. The nonce N alone then constitutes the first packet transmitted in the encrypted stream, and subsequently each packet Pi, i > 0, is transmitted in the form (i | Csi | Ca+i) = i | (Pi A M 2i ) | (Pi A M 2i+i), with the pseudo-random number sequences Mi and M'i calculated as before. The fact that each packet Pi is encrypted twice with two different masks ensures the integrity of this packet during decryption.
[0050] The process illustrated in Figure 8 allows for the encryption and decryption of a packet stream with integrity verification of each packet. Referring to Fig. 8(a), the stream F is divided into packets Pi of length s bits, with i > 0. Referring to Fig. 8(b), each packet Pi is masked twice using the XOR function, the first time with the mask M 2i and the second one with the M mask 2i+ i. Referring to Fig. 8(c), these two masked versions C 2i and C2i+i are then concatenated with the index i in (i | C 2i| C2i+i) to constitute the encrypted form of the packet. The transmission of the index i maintains the synchronization of the calculation of the sequences Mi and M'i during decryption, should some packets be lost in the transmission of the encrypted stream. The nonce N is transmitted as the first element of the encrypted stream CF.
[0051] Each ciphertext form of the packet (i | C 2i | C2i+i) can be deciphered as Di, with Di = M 2i A C 2i and the integrity check consists of verifying that Di = M 2i+i A C2i+i also. If this verification is positive, then Di = Pi, this time with certainty and not just with a very high probability.
[0052] Expressed as the number of clock cycles required to decrypt each packet of s bits with integrity verification, this process achieves a lower latency than AES alone, AES-GCM, or AES-OCB, without exhibiting the same security weaknesses. Thus, with 64-bit processors, to decrypt a 512-bit packet with integrity verification, the process of the present inventions, due to the complete decorrelation between mask calculation and decryption process, requires only 24 clock cycles with a single-core processor (16 cycles for decryption and 8 cycles for comparison), whereas AES256 alone requires 1610 clock cycles (reference "Schneier, Bruce; Kelsey, John; Whiting, Doug; Wagner, David; Hall, Chris; Ferguson, Niels (1999-02-01)").Performance Comparisons of the AES submissions"), AES256-OCB and AES256-GCM require more than 80, while AES256-GCM-SIV requires more than 170 (reference "Krovetz, Ted and Rogaway, Philip, The Design and Evolution of OCB. Journal of Cryptology 2021-07-27, https: / / link.sprinQer.eom / content / pdf / 10.1007 / s00145-021-09399-8.pdf"). Similar to the message encryption process described earlier, the stream encryption process that is the subject of these disclosures can be considered resistant to inadvertent reuse of the nonce.
[0053] Figure 9(a) shows a flowchart of a known symmetric encryption method E, 60, producing a ciphertext C, 63, from a plaintext P, 62 and a key K, 61. This symmetric encryption method E, 60, is potentially vulnerable to side-channel attacks. An algorithm E can be vulnerable to side-channel attacks because it always processes messages with the same key. and that the execution time and / or the corresponding power consumption depends on this constant factor, a statistical processing of the data can make it possible to extract this constant factor by eliminating the variable part related to the messages processed and thus to extract the bits of the key (see the reference "Bernstein, Daniel J., Cache-timing attacks on AES, htps: / / cr.vp.to / antiforqery / cachetiminq-20050414.pdf" for the purposes of AES).
[0054] To make the algorithm E immune to side-channel attacks, consider the HXOR function defined by HXOR(K, N) = H(K A N), where if s is the number of bits in the key K, N is a pseudo-random nonce of the same bit length s and which will be different for each message to be encrypted P, A is the exclusive OR (XOR) operation, and H is a one-way hash function producing a result of s bits of length. The transformed algorithm E' is then defined by C' = E'(P, K) = N | E(P, HXOR(K, N)), | being the concatenation operation and N being a nonce chosen randomly, but each time different, for any message P to be encrypted. Due to the properties of the hash function H, the transmission of N in plaintext in C' does not allow the compromise of the key K or the message P.
[0055] Figure 9(b) shows a flowchart of a disclosure-based symmetric encryption process. The process in Fig. 9(b) is capable of resisting these side-channel attacks. As shown in this figure, prior to encrypting a plaintext message P, 62, a nonce N, 65, having the same length in bits s as the key K, 61, of the process E, 60, is randomly chosen. The nonce N, 65 has a different value for each plaintext message P. The key K, 61 and the nonce N, 65 are then combined using an exclusive OR operation, XOR, 66. The hash function H, 67 is applied to the result of this combination. The product of this set of operations is the result of the function HXOR(K, N) as defined previously. This product can be called a modified key, K', and is used as the key for the encryption process E in place of the key K.The nonce N is concatenated with the product of the encryption process E, to constitute the encrypted message C', 68, of the transformed process E', 64.
[0056] For decryption, the nonce N 65 is obtained from the ciphertext C', 68. The modified key can then be derived from the nonce N and the key K 61 in the same way as described above in relation to encryption. The ciphertext C', 68 can then be decrypted, using the modified key, to obtain the plaintext P 62.
[0057] The transformed algorithm E' presented above is immune to side-channel attacks. This is because the first operation performed for encryption or decryption is the XOR operation on s bits, always requiring the same number Because it takes only a few clock cycles to execute, this operation itself is not susceptible to side-channel attacks. All subsequent operations in the hash function H and then in the algorithm E have execution times and power consumption that depend on the result of this XOR function. However, since N is different for each encryption, the variability of this result cannot be distinguished from that of the processed messages. Since this result is no longer constant, no side-channel attack relying on statistical analysis of the execution times or power consumption of H and / or E will be able to recover the bits of the key K. Even if the nonce N is inadvertently reused a small number of times and the attacker detects it, no statistical processing will be possible if this number remains small. The process described herein can therefore be considered resistant to nonce reuse.It will be understood that these advantages apply to other processes using the function described here.
[0058] Referring now to Figure 10, we see a functional diagram of a computing device that can be used to implement the methods disclosed above. The computing device 500 includes a memory 504 suitable for storing data and operating instructions, and a processor 502 suitable for processing the operating instructions so as to perform functions including the disclosed methods. The computing device 500 further includes a communication module 506 adapted for transmitting and receiving messages, including encrypted messages such as those shown in Figure 7, to one or more other computing devices (not shown).
[0059] The processes of the embodiments of the invention are based on the use of a hash function H. If I is the interval [0, 2 S -1] of natural numbers, of cardinality 2 S A hash function of length s bits is a function from I to I such that the probability for any X that H(X) is equal to a given value Y is equal to 1 / 2 S If the only known method to reverse the hash function is to iterate through the list of 2 S For values of I, the hash function is said to be one-way, and the inversion security level is equal to s bits for a classical deterministic computer. If a value C of I satisfies C = H(C), C is a collision value of H. If n c is the number of collision values in I; the quality of the hash function is measured by the fact that the probability density of the values of H is uniform on I and that the probability of a collision, equal to n c / 2 S, remains very weak.
[0060] Throughout the description and claims of this specification, the words "include" and "contain" and their variations mean "including but not limited to", and they are not intended to include (and do not exclude) other parts, additives, components, wholes or steps. Throughout the description and claims of this specification, the singular encompasses the plural unless the context requires otherwise. In particular, where the indefinite article is used, the specification should be understood as considering plurality as well as singularity, unless the context requires otherwise.
[0061] The features, integers, characteristics, compounds, or groups described in connection with a particular aspect, embodiment, or example of the invention shall be understood as applicable to any other aspect, embodiment, or example described in this document, except where inconsistent therewith. All features disclosed in this specification (including the claims, abstract, and accompanying drawings), and / or all steps of a method or process so disclosed, may be combined in any combination, except for combinations where at least some of these features and / or steps are mutually exclusive. The invention is not limited to the details of all the preceding embodiments.The invention extends to any new feature, or any new combination, of the features disclosed in this specification (including the claims, abstract, and accompanying drawings), or to any new feature, or any new combination, of the steps of any method or process so disclosed.
[0062] The reader's attention is directed to all papers and documents filed concurrently with or prior to this specification in relation to this application and which are open for public inspection with this specification, and the contents of all such papers and documents are incorporated herein by reference. List of reference signs 50. Process of the invention 60 arbitrary symmetric encryption processes 61 key to the symmetric encryption process 62 clear messages 63 encrypted message 64 transformed symmetric encryption processes 65 pseudo-random nuncio 66 operation OR exclusive 67 hash function 68 encrypted message 100 hash function 100a hash function 100b hash function 102 key used as priming value 104 pseudo-random number 106 pseudo-random nuncio 108 operation OR exclusive 108a exclusive OR operation 108b exclusive OR operation 110 intermediate pseudo-random number, M' 120th Division 122 concatenation 124 concatenation 125 HMAC(m, k) calculation 500 computer devices 502 processor 504 memory 506 communication module
Claims
DEMANDS 1. A computer-implemented method for generating at least one pseudo-random number comprising: obtaining a starting value, K, of a certain entropy represented by its bit length; - the combination, using an exclusive OR (XOR) operation, of the seed value, K, with a pseudo-random nonce, N, of the same bit length s, the combination represented by (K A N) where A is an exclusive OR operation; and the execution of a one-way hash function, H, adapted to the bit length on the combination (K A N) to generate a value, M'o, where the pseudo-random number M'i +i is calculated according to H(M'i), where 0 < i < n-1.
2. A method according to claim 1 comprising the production of a sequence of pseudo-random masks Mi using a sequence of pseudo-random numbers M'i and the nonce N for the generation of the pseudo-random numbers, according to the expression Mi = H(M'i A N), where 0 < i < n.
3. A method for encrypting a message, P, comprising the following steps: - the division of the message, P, into n equal parts, Pi, where 0 < i < n, of the chosen bit length s; - the combination of each part, Pi, with the mask, Mi of the same bit length s, where 0 < i < n, to form an encrypted part, Co to C n -i, for each part; and - the concatenation of the nonce N and the ciphertexts, Co to C n -i to form an encrypted message, C, in which each mask, M o to M n -i, is a pseudo-random number generated according to the method of claim 2.
4. Method according to claim 3 wherein the combination comprises an exclusive OR XOR operation.
5. Method according to claim 3 or 4 comprising the creation of a signature, S, for the encrypted message C. The method of claim 5 includes calculating the signature, S, according to HMAC(S n -i, M'n), where S n -i is the nth value in a sequence calculated according to Si+i = Si A Pi+i, where 0 < i < n, So is Po and where M' n is the n+1st value in the sequence of pseudo-random numbers M'i. Method of claim 5 comprising calculating the signature, S, according to HXOR(S n -i, N), where S n -i is the nth value in a sequence calculated according to Si+i = Si APi+i, where 0 < i < n, So is Po and N is the nonce. A method according to any one of claims 5 to 7 comprising attaching the signature, S, to the ciphertext C, to form a signed ciphertext T. A method for decrypting the ciphertext C, elaborated according to claim 3 comprising - the retrieval of the nonce N and the encrypted parts, Co to C n -i of the encrypted message C - the calculation of the masks according to claim 2; the decryption of each encrypted part Co to C n -i, with the priming value, K and the nonce N, to form equal parts, Po to P n -i; and - the combination of parts Po to P n -i to form the message P. Method for encrypting a data stream F, comprising: - the segmentation of the data stream F into packets Pi, of bit length s, with i > 0; the transmission of a pseudo-random nonce N in the encrypted stream CF; - the encryption of each packet Pi, where an encrypted packet Csi = (Pi A M 2i ) and C2i+i = (Pi A M 2i+ i), where Mi is the sequence of pseudo-random masks Mi according to claim 2; - the concatenation of the number i with to form C 2i and C2i+i to form the encrypted version (i | C 2i | C2i+i); and the transmission of the encrypted version in the encrypted CF data stream. A method for decrypting an encrypted CF data stream, elaborated according to claim 8, comprising: - the retrieval of the nonce N at the beginning of the transmission of the encrypted data stream CF allowing the calculation of the sequences Mi and M'i according to claim 2; - the decryption of each encrypted version (i | Csi | Ca+i) into Di = Csi A M 2i ; and the integrity check consisting of establishing that Di = M2i+i AC2i+i, with the certainty that Di = Pi, if this verification is positive. A method according to any one of the preceding claims, wherein the hash function, H, has a quantum security level of more than 170 bits with respect to its inversion. A method according to any one of the preceding claims, wherein the hash function, H, is a Keccak hash function. A method according to any one of the preceding claims, wherein the chosen bit length is 512 bits. A computer-implemented method of symmetric encryption using a key K, comprising: obtaining a pseudo-random nonce N for each plaintext message P to be encrypted, each nonce having the same bit length s as the key K; - the combination, using an exclusive OR (XOR) operation, of the key K with the nonce, N, the combination represented by (K A N) where Ais an exclusive OR operation; the execution of a one-way hash function, H, adapted to the bit length on the combination (K A N) to generate a modified key, K'; encryption of message P using the modified key, K'; and - concatenation of the nonce N to the result of this encryption to constitute the encrypted message C. Computer-implemented method of symmetric decryption of the encrypted message C according to claim 14 comprising: obtaining the pseudo-random nonce N of the encrypted message C; - the combination, using an exclusive OR (XOR) operation, of the key K with the nonce, N, the combination represented by (K A N) where A is an exclusive OR operation; 21 the execution of the one-way hash function, H, on the combination (K A N) to generate the modified key, K'; and decryption of the ciphertext C using the modified key, K', to obtain the plaintext P.
