A fresh flower transaction data privacy protection system based on homomorphic encryption
Patent Information
- Application Number
- CN202610968056.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-01
- Publication Date
- 2026-10-27
- Estimated Expiration
- 2046-07-01
AI Technical Summary
[0022]本发明的有益效果在于:本发明通过在终端完成交易数据的规范化处理,能够从数据源头锁定敏感信息,避免敏感信息以明文形式传输。通过将非线性鲜度校正转移到终端明文域,能够降低云端密态计算的复杂度,减少系统的计算延迟。通过自适应通道编码和固定格式上传,能够在保证结算精度的同时避免交易信息的泄露。通过隔离环境的授权解密,能够保障私钥的存储和使用安全。本发明适配鲜花交易场景的隐私保护需求,有助于提升交易数据的安全性和系统运行效率。
Smart Images

Figure CN122471501B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of homomorphic encryption technology, and more specifically, to a privacy protection system for flower transaction data based on homomorphic encryption. Background Technology
[0002] With the development of e-commerce, the scale of online flower transactions has gradually expanded, covering multiple fields such as wholesale, auctions, and e-commerce. Currently, most trading platforms use cloud services to process transaction data, which generates a large amount of related data, including transaction prices, quantities, category information, and temperature tracking data during cold chain transportation. All of this data involves the privacy information of both parties in the transaction, and the demand for data privacy protection is gradually increasing.
[0003] Currently, homomorphic encryption technology is used for privacy protection of transaction data. The conventional implementation involves encrypting the transaction amount and uploading it to the cloud. The cloud performs aggregation calculations in the ciphertext domain, and the settlement terminal decrypts the data to obtain the final result. This method can achieve a certain level of privacy protection in ordinary retail transaction scenarios, avoiding the cloud's access to plaintext transaction details and meeting the privacy requirements of regular transactions.
[0004] The flower trade has certain unique characteristics. The value of flowers changes with storage time and ambient temperature, and the settlement process needs to adjust the transaction amount based on freshness. In existing technologies, placing the freshness correction calculation in the encrypted domain increases the complexity of encrypted computation, leading to significant computational latency and accelerating the growth of encrypted noise. Placing the correction process in the plaintext domain, on the other hand, would leak detailed transaction data, failing to meet privacy protection requirements. Furthermore, some adaptive processing schemes also pose a risk of information leakage. Summary of the Invention
[0005] This invention provides a privacy protection system for flower transaction data based on homomorphic encryption, which solves the technical problems mentioned in the background.
[0006] This invention provides a privacy protection system for flower transaction data based on homomorphic encryption, comprising:
[0007] The system executes the following seven steps across the terminal, cloud aggregation terminal, and settlement terminal:
[0008] Step S1: The terminal extracts the order number, terminal number, transaction unit price, transaction quantity, temperature sample sequence, time step sequence, and product semi-freshness period, and calculates the deduplication token by combining the order number and terminal number;
[0009] Step S2: The terminal calculates the equivalent thermal age by combining the temperature sample sequence and the time step sequence, calculates the retention factor by combining the equivalent thermal age and the half-freshness period of the product category, and calculates the freshness loss coupling index by combining the retention factor, the transaction unit price and the transaction quantity.
[0010] Step S3: The terminal determines the channel index based on the freshness loss coupling index and generates a mask sequence by combining the channel index;
[0011] Step S4: The terminal calculates the plaintext integer sequence by combining the transaction unit price, transaction quantity, retention factor, mask sequence, and preset scale sequence;
[0012] Step S5: The terminal homomorphically encrypts the plaintext integer sequence into a homomorphic ciphertext sequence, combines the homomorphic ciphertext sequence and the deduplication token to package and generate a data packet, and sends it to the cloud aggregation terminal;
[0013] Step S6: The cloud aggregation terminal receives the data packet, removes duplicate data based on the deduplication token, accumulates the non-duplicate homomorphic ciphertext sequence channel by channel to obtain the aggregated ciphertext sequence, and sends it to the settlement terminal.
[0014] Step S7: The settlement terminal receives the aggregated ciphertext sequence and decrypts it to obtain the aggregated integer sequence. It then combines the aggregated integer sequence with the preset scale sequence to generate the settlement amount and outputs it.
[0015] Further, step S1 includes: The terminal extracts order number, terminal number, transaction unit price, transaction quantity, temperature sample sequence, time step sequence, and category semi-freshness period from the flower transaction data. The temperature sample sequence is generated by the cold chain sensor signature, the time step in the time step sequence is limited by the preset sampling interval, and the category semi-freshness period is read from the local read-only category parameter table of the terminal. The terminal concatenates the order number and the terminal number in sequence, calculates the message authentication value using the deduplication key stored in the authorized settlement field, and uses the message authentication value as the deduplication token. The deduplication key is not sent to the cloud aggregation terminal. The terminal arranges the temperature sample sequence and time step sequence in chronological order before the transaction, and combines the category code, deduplication token, transaction unit price, transaction quantity, temperature sample sequence, time step sequence, and category semi-freshness period into a standardized transaction record; The standardized transaction record only enters step S2 in the terminal memory, where the cloud aggregation terminal receives the deduplication token and the homomorphic ciphertext sequence.
[0016] Further, step S2 includes: The terminal determines the equivalent thermal age based on the temperature sample sequence, time step sequence, preset reference temperature, preset temperature difference denominator, and preset thermal age base. The terminal determines the retention factor based on the equivalent heat age, the semi-freshness period of the product category, and the preset logarithmic base. The terminal determines the freshness-loss coupling index based on the transaction unit price, transaction quantity, retention factor, preset amount reference quantity, preset stability constant, and constant 1. Among them, the freshness-loss coupling index is the logarithmic value formed by the product of the amount ratio and the freshness-loss ratio after being biased by constant 1; the amount ratio is the product of the transaction unit price and the transaction quantity divided by the preset amount reference quantity; the freshness-loss ratio is the difference between constant 1 and the retention factor divided by the sum of the retention factor and the preset stability constant.
[0017] Further, step S3 includes: The terminal determines the channel index based on the freshness loss coupling index and the preset channel upper limit; The terminal generates a mask sequence based on the channel index; wherein, the value corresponding to the channel number that matches the channel index in the mask sequence is a constant 1, and the value corresponding to the channel number that does not match the channel index is zero. The preset scale sequence includes a first preset setpoint scale, a second preset setpoint scale, and a third preset setpoint scale; The terminal sends the mask sequence and the preset scale sequence to step S4 to participate in the plaintext integer sequence calculation.
[0018] Further, step S4 includes: The terminal determines the corrected value of goods based on the transaction unit price, transaction quantity, and retention factor; The terminal determines the plaintext integer sequence based on the corrected value, mask sequence, preset scale sequence, preset amount reference quantity and plaintext modulus. The plaintext integer sequence includes the plaintext integer corresponding to each channel. The plaintext modulus is limited by a preset wraparound constraint; The product of the transaction price, transaction quantity, and retention factor is generated only in the terminal memory and is not written to the terminal log; after the plaintext integer sequence is generated, the terminal overwrites the temporary value of the product.
[0019] Further, step S5 includes: The terminal uses homomorphic encryption that supports precise integer addition, which encapsulates each plaintext integer in the plaintext integer sequence into a corresponding binary ciphertext, and then forms a homomorphic ciphertext sequence from the binary ciphertexts. The encryption parameters include the ciphertext modulus, the plaintext modulus, the public key polynomial, the one-time random polynomial, and the error polynomial; The single-pass random polynomials of the same transaction in each channel are independent of each other; The ciphertext ring dimension, ciphertext modulus, and error distribution are determined based on a preset security level. The terminal packages the deduplication token and homomorphic ciphertext sequence into a data packet according to a fixed number of fields, a fixed field order, and a fixed ciphertext length, and sends it to the cloud aggregation terminal. The deduplication token is not used for decryption, and the private key and the product semi-freshness table are not sent to the cloud aggregation terminal.
[0020] Further, step S6 includes: The cloud aggregation terminal reads data packets in the order of arrival and deduplicates data packets within the same settlement period based on the deduplication token; When the same deduplication token corresponds to multiple data packets within the same settlement period, the cloud aggregation terminal retains the data packet with the earliest arrival time and discards the remaining data packets. The settlement period is limited by the platform clock and the preset settlement duration. The cloud aggregation terminal performs homomorphic addition on the homomorphic ciphertext sequence in the non-repeating data packet by channel to obtain the aggregated ciphertext sequence, and saves only one rolling aggregated ciphertext for each channel; After the settlement period ends, the cloud aggregation terminal sends the period number and the aggregated encrypted sequence to the settlement terminal. The deduplication process does not change the encrypted content, and the cloud aggregation terminal does not generate a single amount output.
[0021] Further, step S7 includes: The settlement end stores its private key within an isolated execution environment; After receiving the cycle number and the aggregated ciphertext sequence, the settlement terminal decrypts the aggregated ciphertext sequence to obtain the aggregated integer sequence. The settlement terminal generates the settlement amount based on the aggregated integer sequence, the preset scale sequence, and the preset amount reference quantity; The settlement terminal outputs the settlement amount only once for the same period number, and outputs an aggregated ciphertext sequence as a privacy-protected aggregated ciphertext. The privacy-protected aggregated ciphertext does not allow for reverse lookup of individual transaction records.
[0022] The beneficial effects of this invention are as follows: By standardizing transaction data at the terminal, this invention can lock sensitive information at the data source, preventing sensitive information from being transmitted in plaintext. By transferring nonlinear freshness correction to the plaintext domain at the terminal, the complexity of cloud-based encrypted calculations can be reduced, and system computational latency can be decreased. Through adaptive channel encoding and fixed-format uploading, transaction information leakage can be prevented while ensuring settlement accuracy. Through authorized decryption in an isolated environment, the storage and use of private keys can be securely guaranteed. This invention is adapted to the privacy protection needs of flower trading scenarios, helping to improve the security of transaction data and system operating efficiency. Attached Figure Description
[0023] Figure 1 This is a UML flowchart of a flower transaction data privacy protection system based on homomorphic encryption according to the present invention;
[0024] Figure 2 This is a schematic diagram of the system deployment of the present invention;
[0025] Figure 3 This is a schematic diagram of the internal structure of the terminal of the present invention;
[0026] Figure 4 This is a schematic diagram of the three-channel fixed upload structure of the present invention;
[0027] Figure 5 This is a schematic diagram of the collaborative structure between the cloud aggregation terminal and the settlement terminal of the present invention. Detailed Implementation
[0028] The subject matter described herein will now be discussed with reference to exemplary embodiments. It should be understood that these embodiments are discussed only to enable those skilled in the art to better understand and implement the subject matter described herein, and changes may be made to the function and arrangement of the elements discussed without departing from the scope of this specification. Various processes or components may be omitted, substituted, or added as needed in the examples. Furthermore, features described in some examples may be combined in other examples.
[0029] It should be noted that, unless otherwise defined, the technical or scientific terms used in one or more embodiments of the present invention should have the ordinary meaning understood by one of ordinary skill in the art to which this invention pertains. The terms "first," "second," and similar terms used in one or more embodiments of the present invention do not indicate any order, quantity, or importance, but are merely used to distinguish different components. Terms such as "comprising" or "including" indicate that the element or object preceding the term encompasses the elements or objects listed following the term and their equivalents, without excluding other elements or objects. Terms such as "connected" or "linked" are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. Terms such as "upper," "lower," "left," and "right" are used only to indicate relative positional relationships; when the absolute position of the described object changes, the relative positional relationship may also change accordingly.
[0030] like Figures 1-5 As shown, a data privacy protection system for flower transactions based on homomorphic encryption includes: a terminal, a cloud aggregation terminal, and a settlement terminal. The system performs the following seven steps:
[0031] Step S1: The terminal extracts the order number, terminal number, transaction unit price, transaction quantity, temperature sample sequence, time step sequence, and product semi-freshness period, and calculates the deduplication token by combining the order number and terminal number;
[0032] Step S2: The terminal calculates the equivalent thermal age by combining the temperature sample sequence and the time step sequence, calculates the retention factor by combining the equivalent thermal age and the half-freshness period of the product category, and calculates the freshness loss coupling index by combining the retention factor, the transaction unit price and the transaction quantity.
[0033] Step S3: The terminal determines the channel index based on the freshness loss coupling index and generates a mask sequence by combining the channel index;
[0034] Step S4: The terminal calculates the plaintext integer sequence by combining the transaction unit price, transaction quantity, retention factor, mask sequence, and preset scale sequence;
[0035] Step S5: The terminal homomorphically encrypts the plaintext integer sequence into a homomorphic ciphertext sequence, combines the homomorphic ciphertext sequence and the deduplication token to package and generate a data packet, and sends it to the cloud aggregation terminal;
[0036] Step S6: The cloud aggregation terminal receives the data packet, removes duplicate data based on the deduplication token, accumulates the non-duplicate homomorphic ciphertext sequence channel by channel to obtain the aggregated ciphertext sequence, and sends it to the settlement terminal.
[0037] Step S7: The settlement terminal receives the aggregated ciphertext sequence and decrypts it to obtain the aggregated integer sequence. It then combines the aggregated integer sequence with the preset scale sequence to generate the settlement amount and outputs it.
[0038] In one embodiment of the present invention, step S1 specifically performs the following steps:
[0039] In step S101, the terminal extracts the order number, terminal number, transaction unit price, transaction quantity, temperature sample sequence, time step sequence, and category semi-freshness period from the flower transaction data. The temperature sample sequence is generated by the cold chain sensor signature, the time step in the time step sequence is limited by the preset sampling interval, and the category semi-freshness period is read from the local read-only category parameter table of the terminal. The preset sampling interval is 0.25 hours.
[0040] In step S102, the terminal concatenates the order number and the terminal number in sequence, calculates the message authentication value using the deduplication key stored in the authorized settlement field, and uses the message authentication value as the deduplication token.
[0041] Specifically, the formula for calculating the deduplication token is as follows:
[0042]
[0043] in, For the first The deduplication token for this transaction. For the first This transaction uses a deduplicated key. Message authentication calculation, For the first The order number for this transaction. For the first The terminal number of the transaction. For the first The string connecting the order number and the terminal number of the transaction. Deduplication keys stored for authorized settlement fields; The deduplication key is generated by the authorized settlement terminal and provided to the authorized terminal for the terminal to calculate the deduplication token; the deduplication key is not sent to the cloud aggregation terminal along with the deduplication token and the homomorphic ciphertext sequence, and the cloud aggregation terminal does not hold the deduplication key.
[0044] Step S103: The terminal arranges the temperature sample sequence and time step sequence according to the time sequence before the transaction, and combines the category code, deduplication token, transaction unit price, transaction quantity, temperature sample sequence, time step sequence and category semi-freshness period into a standardized transaction record;
[0045] Specifically, the formula for composing a standardized transaction record is as follows:
[0046]
[0047] in, For the first The standardized transaction record of this transaction, For the first The category code of this transaction, For the first The deduplication token for this transaction. For the first The transaction price per unit of the transaction. For the first The number of transactions in a transaction. For the first The first transaction Temperature samples within a temperature range, For the first The first transaction Time step for each temperature range For the first The product category corresponding to this transaction has a semi-fresh period;
[0048] In step S104, the normalized transaction record only enters step S2 in the terminal memory, and the cloud aggregation terminal receives the deduplication token and homomorphic ciphertext sequence.
[0049] It should be noted that the deduplication token is a unique identifier generated by the terminal based on the order number and the terminal number. It represents the unique identity of the transaction record and is only used for deduplication in the cloud. It does not participate in decryption.
[0050] The deduplication key is a key stored in the authorized settlement domain, used to generate deduplication tokens. It is not sent to the cloud aggregation terminal. The preferred value is a 256-bit symmetric key. It is generated by the authorized settlement terminal and distributed to each seller edge terminal during system initialization.
[0051] A standardized transaction record is a structured record containing the core elements of a flower transaction, generated in the terminal's local memory. It represents the complete input data for a single transaction and circulates only within the terminal.
[0052] The category code is used to identify different flower categories. The preferred value is an 8-digit integer code, which is a unique identifier for the category uniformly assigned by the system.
[0053] The temperature sample sequence is a temperature data sequence generated by cold chain sensor signatures from the time of collection to the time of transaction. It can be acquired in real time through cold chain temperature sensors connected to the seller's edge terminal, and each sample is accompanied by the sensor's digital signature.
[0054] The time step sequence is a sequence of time intervals between adjacent temperature samples, which can be automatically generated by the sampling clock of the temperature sensor and corresponds one-to-one with the temperature samples.
[0055] The category semi-freshness period is a parameter that characterizes the time required for the quality of a corresponding category of fresh flowers to degrade to half of its initial value. It is read from the local read-only category parameter table on the terminal, and the preferred value range is 12 hours to 120 hours, which is pre-calibrated according to the physiological characteristics of different flower categories.
[0056] The preset sampling interval is fixed at 0.25 hours to limit the collection frequency of temperature samples, and all terminals maintain this consistency.
[0057] Specifically, HMAC message authentication uses the SHA256 hash function as its underlying algorithm, conforming to the RFC2104 standard. All seller edge terminals use the same algorithm to ensure that different terminals can generate completely consistent outputs for the same input. For example, when the input order number is 12345678 and the terminal number is 87654321, the deduplication tokens generated by different terminals are all the same 256-bit binary data, preventing the same input from generating different outputs and ensuring the accuracy of cloud-based deduplication operations.
[0058] Specifically, the terminal's local read-only category parameter table is pre-stored in the terminal's non-volatile storage medium using encrypted storage. The stored content is encrypted, making it difficult for the terminal to directly modify. Updates to the parameter table employ an offline signature update mechanism. The update data packet is generated by the authorized settlement terminal and includes a digital signature. Upon receiving the update packet, the terminal first verifies the signature's validity before updating its local parameter table. For example, when a new flower category is added, the authorized settlement terminal generates update data containing the category code and corresponding half-freshness period. After signing this data with a private key, it is distributed to all terminals. Once the terminal verifies the signature, it writes the half-freshness period data for that category into its local read-only parameter table, ensuring the reliability of the category's half-freshness period data and preventing malicious tampering.
[0059] Specifically, the order number and terminal number are concatenated using big-endian byte order. The order number occupies the first 4 bytes, and the terminal number occupies the last 4 bytes. Any part less than 8 bytes during concatenation is padded with zeros. For example, when the order number is 12345 and the terminal number is 6789, the order number, after being converted to 4-byte big-endian data, is 00 01 E2 40, and the terminal number, after being converted to 4-byte big-endian data, is 00 00 1A 85. The complete byte sequence after concatenation is 00 01 E2 40 00 00 1A 85. All terminals use the same concatenation rule to ensure the consistency of the generated deduplication tokens.
[0060] Specifically, standardized transaction records are stored only in the terminal's volatile memory, using a temporary memory allocation method. Memory space is allocated when a record is generated and immediately released after processing; the record is not written to any non-volatile storage medium. For example, after the terminal completes the processing of a transaction, the 128 bytes of memory allocated for storing the standardized transaction record are immediately released, and this memory area is zeroed out before release to ensure that sensitive data does not remain in memory and prevent malicious programs from reading it.
[0061] It should be noted that the raw data of flower transactions contains a variety of sensitive information such as price, quantity, type, and temperature. Sending this plaintext data to the cloud could easily lead to privacy leaks. In this embodiment, the transaction data is collected in a standardized manner at the seller's edge terminal. Each transaction is broken down into the minimum sufficient set of value and age. The raw data is processed internally at the terminal, which reduces the possibility of the cloud side obtaining plaintext features that can reconstruct the transaction behavior. At the same time, it lays a standardized input foundation for the subsequent biological decay mapping to homomorphic friendly integers, and also allows subsequent homomorphic encryption processing to be performed according to unified rules.
[0062] In one embodiment of the present invention, step S2 specifically performs the following steps:
[0063] Step S201: The terminal determines the equivalent thermal age based on the temperature sample sequence, time step sequence, preset reference temperature, preset temperature difference denominator, and preset thermal age base.
[0064] Specifically, the formula for calculating equivalent thermal age is as follows:
[0065]
[0066] in, For the first The equivalent thermal age of the batch corresponding to each transaction, in hours. For the first Number of temperature samples per transaction For the first The first transaction The duration of each temperature range, in hours. For the first The first transaction Temperature samples within a temperature range, in degrees Celsius. The preset reference temperature is 5 degrees Celsius. The denominator 10 is the preset temperature difference denominator, which is 10 and has the unit of degrees Celsius. The 2 in the exponent is the preset thermal age base, which is 2.
[0067] In step S202, the terminal determines the retention factor based on the equivalent heat age, the semi-fresh period of the product category, and the preset logarithmic base.
[0068] Specifically, the formula for calculating the retention factor is as follows:
[0069]
[0070] in, For the first The retention factor of this transaction, This is a unitless numerical value, and its range is [value range missing]. , The natural logarithm with a base of 2 is given. For the first The equivalent thermal age of the transaction, in hours. For the first The semi-freshness period of the product category corresponding to this transaction, in hours. For the first The ratio of the number of transactions to the number of transactions;
[0071] Step S203: The terminal determines the freshness loss coupling index based on the transaction unit price, transaction quantity, retention factor, preset amount reference, preset stability constant and constant 1; Among them, the freshness loss coupling index is the logarithmic value formed by the product of the amount ratio and the freshness loss ratio after being biased by a constant 1; the amount ratio is the product of the transaction unit price and the transaction quantity divided by the preset amount reference quantity; the freshness loss ratio is the difference between the constant 1 and the retention factor divided by the sum of the retention factor and the preset stability constant.
[0072] Specifically, the formula for calculating the freshness loss coupling index is as follows:
[0073]
[0074] in, For the first The fresh loss coupling index of a transaction, and it has a unitless value. For the first The transaction price is expressed in yuan per branch. For the first The number of transactions in a single transaction, in units of branches. For the first The original value of the goods in this transaction, in yuan. This is a preset reference amount, specifically 100 yuan. For the first The retention factor of this transaction, The preset stability constant is 0.001, and it is a unitless value. This is for calculating the logarithm with a base of 2 (preset).
[0075] It should be noted that equivalent thermal age is a parameter characterizing the overall heat exposure of a batch of fresh flowers from the time of harvest to the time of sale, and the unit is hours.
[0076] The freshness retention factor is a dimensionless parameter that characterizes the proportion of the remaining mass of fresh flowers to the initial mass, and its value ranges from 0 to 1.
[0077] The freshness loss coupling index is a dimensionless intermediate parameter that characterizes the coupling strength between the value of a single transaction and the freshness loss, and is used only within the terminal.
[0078] The preset reference temperature is fixed at 5 degrees Celsius, which serves as the base temperature for calculating the thermal age amplification factor.
[0079] The denominator of the temperature difference is set to 10 to make the exponential term in the thermal age calculation dimensionless, and is pre-calibrated according to the correspondence between the flower's respiration rate and temperature.
[0080] The preset thermal age base is fixed at 2, which is used to calculate the thermal age magnification factor at different temperatures. This is predetermined based on the law that the aging rate of flowers changes with temperature.
[0081] The default logarithmic base is fixed at 2, which is used for calculating the freshness loss coupling index.
[0082] The preset reference amount is fixed at 100 yuan, which is used to normalize the transaction value into a dimensionless value, and is preset according to the conventional value range of flower transactions.
[0083] The preset stability constant is fixed at 0.001 to prevent numerical divergence when the freshness retention factor is extremely small.
[0084] Specifically, after the temperature sample sequence is arranged in chronological order before the transaction, adjacent samples are automatically divided into corresponding temperature intervals. When the temperature sample collection time for a certain transaction is successively 0 hours, 0.25 hours, 0.5 hours, up to 48 hours after collection, the terminal will automatically divide 0 hours to 0.25 hours into the first temperature interval, 0.25 hours to 0.5 hours into the second temperature interval, and so on. The duration of each interval is the time step between two adjacent samples, and the temperature of each interval is the sampling temperature within that interval. In this way, each temperature interval corresponds to the temperature situation over a period of time, and the contribution of thermal age during that period can be accurately calculated.
[0085] Specifically, the closer the retention factor is to 1, the higher the freshness; the closer it is to 0, the lower the freshness. When flowers are freshly picked, they haven't yet shown obvious signs of aging, and the retention factor is close to 1, indicating almost no loss of freshness. However, after prolonged high-temperature transportation, the flowers have aged considerably, and the retention factor is close to 0, indicating that most of their freshness has been lost. For example, if a batch of roses has a retention factor of 0.99 when freshly picked, after 24 hours of standard cold chain transportation, the retention factor will be 0.85, indicating 85% freshness remaining. If the temperature during transportation is too high, the retention factor can drop to 0.5, indicating 50% freshness remaining.
[0086] Specifically, the value range of the freshness loss coupling index is positively correlated with the intensity of freshness loss and the magnitude of the value of the goods. The higher the value of the goods in the transaction and the greater the freshness loss, the larger the value of the freshness loss coupling index, and vice versa.
[0087] It should be noted that the natural decay of flowers follows a non-linear physical law, with different varieties exhibiting different decay rates. Furthermore, changes in temperature and value both impact the computation of encrypted data. This embodiment transforms the natural decay pattern of flowers into quantifiable intermediate parameters by calculating the equivalent thermal age, retention factor, and freshness loss coupling index. By merging the two factors affecting encrypted data computation—value and freshness loss—into a single index, the natural decay rates of different flower varieties can be uniformly mapped to the same scale. This converts multi-dimensional temperature sequences into a single thermal age value, reducing the need for subsequent exponential decay approximation and multi-dimensional data processing in the encrypted domain.
[0088] In one embodiment of the present invention, step S3 specifically performs the following steps:
[0089] Step S301: The terminal determines the channel index based on the freshness loss coupling index and the preset channel upper limit;
[0090] Specifically, the formula for calculating the channel index is as follows:
[0091]
[0092] in, For the first The channel index for this transaction, which can be 0, 1, or 2. For the first Freshness-loss coupling index of a transaction, This is the floor function. Used to fix the rounding result greater than 2 to 2, with the preset channel upper limit specifically set to 2;
[0093] Step S302, the terminal generates a mask sequence based on the channel index; wherein, the value corresponding to the channel number that matches the channel index in the mask sequence is a constant 1, and the value corresponding to the channel number that does not match the channel index is zero.
[0094] Specifically, the formula for calculating the mask sequence is as follows:
[0095]
[0096] in, For the first The transaction was in The mask for each channel, and it has a unitless value. This is the channel number, with a value of 0, 1, or 2. For the first The channel index for this transaction, with a specific number of channels: 3;
[0097] Step S303: The preset scale sequence includes a first preset fixed point scale, a second preset fixed point scale, and a third preset fixed point scale. The first preset fixed point scale corresponds to the 0th channel, specifically 2 to the power of 20. The second preset fixed point scale corresponds to the 1st channel, specifically 2 to the power of 16. The third preset fixed point scale corresponds to the 2nd channel, specifically 2 to the power of 12. All three fixed point scales are unitless integer scales.
[0098] In step S304, the terminal sends the mask sequence and the preset scale sequence to step S4 to participate in the plaintext integer sequence calculation.
[0099] It should be noted that the channel index is a parameter that represents the encrypted transmission channel number corresponding to a single transaction, and its value is 0, 1 or 2.
[0100] The mask sequence is a sequence of three 0s or 1s used to identify the channel that actually carries the transaction data.
[0101] The preset scale sequence is a sequence containing three fixed-point scales, used for fixed-point coding precision control of different channels.
[0102] The preset channel upper limit is fixed at 2, which is used to uniformly classify freshness loss coupling indexes higher than this value into the highest channel.
[0103] The first preset point scale corresponds to the 0th channel and has a value of 2 to the power of 20, which is used for encoding low-loss coupled records.
[0104] The second preset point scale corresponds to the first channel and has a value of 2 to the power of 16, which is used for encoding the medium-loss coupled records.
[0105] The third preset point scale corresponds to the second channel and has a value of 2 to the power of 12. It is used for encoding high-perishability coupled records.
[0106] Specifically, when the calculated result of the freshness loss coupling index is negative, the system will automatically set the channel index to 0 to ensure the stability of system operation. For example, when the freshness retention factor of a transaction is close to 1 and the freshness loss is almost 0, the calculated result of the freshness loss coupling index may be negative. In this case, the system will automatically map it to channel 0 to avoid invalid channel indexes and ensure that subsequent processing can proceed normally.
[0107] Specifically, after the mask sequence is generated, the system will automatically perform logical verification on the sequence, checking whether the number of 1s in the sequence is 1 and whether all other positions are 0. If it does not meet the requirements, the mask sequence will be regenerated.
[0108] Specifically, the values of the three fixed-point scales are determined jointly based on the interval division of the freshness loss coupling index, settlement accuracy requirements, and encrypted noise control requirements. Channel 0 corresponds to the interval where the freshness loss coupling index is less than 1. In this interval, transaction freshness loss is low, requiring high settlement accuracy; therefore, a higher fixed-point scale is used. Channel 1 corresponds to the interval where the freshness loss coupling index is greater than or equal to 1 and less than 2. In this interval, transaction freshness loss is moderate, and a moderate fixed-point scale is used. Channel 2 corresponds to the interval where the freshness loss coupling index is greater than or equal to 2. In this interval, transaction freshness loss is high, and the accuracy requirement is relatively low; therefore, a lower fixed-point scale is used to control the growth of encrypted noise. This satisfies the settlement accuracy requirements while effectively controlling the growth of encrypted noise.
[0109] It should be noted that conventional adaptive scaling binning schemes expose transaction classification information to the cloud, which can easily lead to privacy leaks in high-value or high-perishability transactions. This embodiment uses fixed three-way encrypted upload instead of plaintext binning upload. The channel index exists only within the terminal, and the cloud always receives three encrypted streams with identical formats. This can reduce the privacy leak problem caused by adaptive scaling. At the same time, it allows the terminal to select an appropriate fixed-point precision based on the perishability coupling index, reducing the plaintext dynamic range and encrypted noise pressure caused by using the highest precision for all records.
[0110] In one embodiment of the present invention, step S4 specifically performs the following steps:
[0111] Step S401: The terminal determines the corrected value based on the transaction unit price, transaction quantity, and retention factor;
[0112] In step S402, the terminal determines the plaintext integer sequence based on the corrected value, mask sequence, preset scale sequence, preset amount reference quantity and plaintext modulus. The plaintext integer sequence includes the plaintext integer corresponding to each channel.
[0113] Specifically, the formula for calculating the plaintext integer sequence is as follows:
[0114]
[0115] in, For the first The transaction was in The plaintext integers on each channel belong to the plaintext modulus. Integer ring, For the first The transaction was in The mask on each channel, For the first The fixed-point scale of each channel, For the first The transaction price per unit of the transaction. For the first The number of transactions in a transaction. For the first The retention factor of this transaction, For the first The quality-adjusted amount of a single transaction, in yuan. This is a preset reference amount, specifically 100 yuan. This is the rounding function. The plaintext modulus;
[0116] Step S403: The plaintext modulus is limited by a preset wraparound constraint. Specifically, the preset wraparound constraint is that the plaintext modulus is greater than twice the maximum cumulative amplification integer within the same settlement period.
[0117] In step S404, the product of the transaction unit price, transaction quantity, and retention factor is generated only in the terminal memory and not written to the terminal log. After the plaintext integer is generated, the terminal overwrites the temporary value of the product of the transaction unit price, transaction quantity, and retention factor. The terminal performs calculations on the three channels respectively to obtain the plaintext integers of the three channels, and uses the plaintext integers of the three channels as a plaintext integer sequence to enter step S5.
[0118] It should be noted that the corrected value is the product of the transaction unit price, the transaction quantity, and the freshness preservation factor, that is, the amount of a single transaction after quality correction, in yuan.
[0119] The plaintext integer sequence is a sequence of three plaintext integers, each corresponding to the encoding result of one of the three secret channels.
[0120] The plaintext modulus is a parameter that limits the range of plaintext integer values. It must be greater than twice the maximum cumulative amplified integer within the same settlement period, and preferably a power of 260. It is pre-calculated and determined based on the maximum number of transactions and the maximum value of a single transaction within the settlement period.
[0121] The temporary value overwrite mechanism immediately overwrites the temporary value of the correction value in the terminal memory after the plaintext integer is generated, to prevent sensitive data from being retained.
[0122] Specifically, the plaintext modulus is calculated using the maximum possible value estimation method. First, the maximum number of transactions in a single settlement period is estimated to be 1 million, and the maximum corrected value of a single transaction is 10,000 yuan. The corresponding maximum plaintext integer is 10,000 yuan divided by 100 yuan multiplied by 2 to the power of 20, which is 10,485,760. Then, the maximum cumulative amplification integer in the same period is 1 million transactions multiplied by 10,485,760, which is 1.048576 multiplied by 10 to the power of 13. Therefore, the minimum value of the plaintext modulus is twice this value, which is 2.097152 multiplied by 10 to the power of 13. The system sets the plaintext modulus to the smallest prime number greater than this value to ensure that there will be no modulus wrap-around. For example, when the number of transactions in a settlement period reaches 1 million and the value of each transaction reaches 10,000 yuan, the cumulative sum of plaintext integers is 1.048576 multiplied by 10 to the power of 13, which is less than half of the plaintext modulus. Therefore, there will be no modulus wrap-around problem, ensuring the accuracy of aggregation calculation.
[0123] Specifically, the rounding error control in fixed-point coding adopts an error accumulation monitoring method. The rounding error of each transaction is recorded. When the accumulated error exceeds 0.1 yuan, the system will automatically compensate for the error to ensure that the error of the final settlement result is within an acceptable range.
[0124] Specifically, the plaintext integers are written to the plaintext slots of the BFV at the position of the 0th coefficient of the plaintext polynomial. All terminals write the plaintext integers from the three channels sequentially to the 1st, 2nd, and 3rd coefficient positions, and write 0 to the remaining coefficient positions. Cloud aggregation and settlement decryption both extract data from these three positions. For example, after a terminal processes a transaction, it writes the plaintext integer from channel 0 to the 1st coefficient of the plaintext polynomial, the one from channel 1 to the 2nd, the one from channel 2 to the 3rd, and writes 0 to the remaining positions. During cloud aggregation, the coefficients at these three positions are also summed. The settlement decryption also extracts data from these three positions to ensure accurate data correspondence.
[0125] It should be noted that nonlinear calculations in the ciphertext domain consume a large amount of homomorphic encryption noise budget, increasing computational complexity. In this embodiment, the nonlinear freshness decay and transaction value are compressed into three fixed-point integers before encryption. The actual carrying channel is written with the quality correction amount, and the other two channels are written with zero. The flower quality decay is transformed from a high-depth function calculation in the ciphertext domain to a single fixed-point encoding in the edge domain, which can significantly reduce the depth and complexity of homomorphic calculations in the cloud. At the same time, it can prevent the sensitive intermediate value of the correction value from being written to the terminal log or leaked.
[0126] In one embodiment of the present invention, step S5 specifically performs the following steps:
[0127] Step S501: The terminal uses BFV-type ring learning homomorphic encryption that supports precise integer addition to encapsulate each plaintext integer in the plaintext integer sequence into a corresponding binary ciphertext, and forms a homomorphic ciphertext sequence from each binary ciphertext.
[0128] Specifically, the formula for calculating homomorphic ciphertext sequences is as follows:
[0129]
[0130] in, This is the BFV scaling factor. For the ciphertext modulus, For plaintext modulus, The 0th component of the public-key polynomial. The first component of the public-key polynomial. For the first The first transaction A one-time random polynomial for each channel, For the first The first transaction The central discrete Gaussian error polynomial of the 0th ciphertext component of each channel. For the first The first transaction The central discrete Gaussian error polynomial of the first ciphertext component of each channel. For the first The first transaction Plaintext integers for each channel, For the first The first transaction The 0th ciphertext component of the channel For the first The first transaction The first ciphertext component of each channel, For the first The first transaction Binary ciphertext for each channel;
[0131] The above objects are all in the polynomial ring. The coefficients are calculated sequentially, among which Let be the dimension of the ciphertext ring, and Powers of 2;
[0132] Step S502, the encryption parameters include ciphertext modulus, plaintext modulus, public key polynomial, one-time random polynomial and error polynomial;
[0133] Step S503: The one-time random polynomials of the same transaction in each channel are independent of each other;
[0134] In step S504, the ciphertext ring dimension, ciphertext modulus, and error distribution are determined based on a preset security strength, which is at least 128 bits.
[0135] In step S505, the terminal packages the deduplication token and homomorphic ciphertext sequence into a data packet according to a fixed number of fields, a fixed field order, and a fixed ciphertext length, and sends it to the cloud aggregation terminal.
[0136] In step S506, the deduplication token does not participate in decryption, and the private key and the product category semi-freshness table are not sent to the cloud aggregation terminal. Specifically, the terminal executes formulas on the three channels respectively to obtain binary ciphertext for each channel. The one-time random polynomials for the same transaction on the three channels are independent of each other. The ciphertext modulus and error distribution are selected according to a preset security strength. The terminal uploads a data packet including the deduplication token and the binary ciphertext for the three channels. The number of fields, field order, and ciphertext length of the uploaded packet remain consistent across all transaction records. The deduplication token is only used for deduplication on the cloud aggregation terminal and does not participate in decryption. The cloud aggregation terminal does not obtain the private key and the product category semi-freshness table.
[0137] It should be noted that the BFV scaling factor is a parameter used in BFV homomorphic encryption to map the plaintext and ciphertext spaces.
[0138] The ciphertext modulus is a parameter that limits the range of values for the coefficients of the ciphertext polynomial.
[0139] A public-key polynomial is a public key used for homomorphic encryption. It consists of two components and is generated and published by the authorized settlement end.
[0140] A one-time random polynomial is a small random polynomial generated independently for each channel in each transaction. It is used to randomize the encryption process. The coefficients of each polynomial range from -1 to 1.
[0141] The error polynomial is a centrally discrete Gaussian distribution error polynomial used to ensure the security of homomorphic encryption. Each coefficient follows a centrally discrete Gaussian distribution.
[0142] The dimension of the ciphertext ring is the dimension of the polynomial ring in BFV encryption, and its value is a power of 2, with a preferred value of 8192, which is preset according to the security strength requirements.
[0143] The preset security strength is at least 128 bits, which is used to determine the parameters of the ciphertext modulus and error distribution.
[0144] Specifically, the parameter selection criteria for the BFV homomorphic encryption algorithm are as follows: when the preset security strength is 128 bits, the ciphertext ring dimension is 8192, and the ciphertext modulus is 2 to the power of 218 minus 1. This parameter combination can ensure the security of encryption while meeting the requirements of encrypted addition.
[0145] Specifically, the standard deviation of the central discrete Gaussian error polynomial is 3.2. The generation method adopts rejection sampling to generate random coefficients that conform to the central discrete Gaussian distribution, thus ensuring the safety of the error polynomial.
[0146] Specifically, the data packet is packaged in the following format: first, a 4-byte period number; then, a 32-byte deduplication token; then, the ciphertext of the three channels, each containing two polynomials, each polynomial occupying 8192 8-byte coefficients; and finally, a 4-byte CRC32 checksum. The encoding method uses big-endian byte order, and all fields are arranged in order.
[0147] It should be noted that conventional homomorphic encryption schemes require additional multiplication levels to handle complex calculations, which increases the size of the ciphertext and the complexity of the calculation. This embodiment uses a BFV-type homomorphic encryption algorithm that supports precise integer addition. Since the pre-step has eliminated the nonlinear operation requirements of the ciphertext field, there is no need to reserve additional multiplication levels for subsequent exponentiation, comparison, or sorting operations. The cloud can only perform addition operations on the ciphertext and cannot obtain sensitive information such as channel selection, freshness factor, or transaction amount, thus ensuring the accuracy and security of the ciphertext calculation.
[0148] In one embodiment of the present invention, step S6 specifically performs the following steps:
[0149] Step S601: The cloud aggregation terminal reads data packets in the order of arrival and deduplicates data packets within the same settlement period based on the deduplication token;
[0150] In step S602, when the same deduplication token corresponds to multiple data packets within the same settlement period, the cloud aggregation terminal retains the data packet with the earlier arrival time and discards the remaining data packets. The settlement period is limited by the platform clock and the preset settlement duration, which is specifically 24 hours.
[0151] Step S603: The cloud aggregation terminal performs homomorphic addition on the homomorphic ciphertext sequence in the non-repeating data packet by channel to obtain the aggregated ciphertext sequence;
[0152] Specifically, the formula for calculating the aggregated ciphertext sequence is as follows:
[0153]
[0154] in, For the same settlement period The set of records after deduplication. For the first The first transaction A binary ciphertext for each channel, This is the channel number, with a value of 0, 1, or 2. For the first The aggregated ciphertext of each channel; where the ciphertext summation is performed on a polynomial ring. The process is performed on each of the two ciphertext components separately;
[0155] In step S604, the cloud aggregation terminal saves only one rolling aggregation ciphertext for each channel. After the settlement cycle ends, the cloud aggregation terminal sends the cycle number and the aggregation ciphertext sequence to the settlement terminal. The deduplication process does not change the ciphertext content, and the cloud aggregation terminal does not generate a single amount output.
[0156] It should be noted that the record set is the set of valid transaction records within the same settlement period after duplicate data has been removed by deduplication tokens.
[0157] The aggregated ciphertext sequence is a sequence composed of aggregated ciphertext from three channels, which is the result of channel-by-channel ciphertext addition in the cloud.
[0158] The rolling aggregate ciphertext is a unique aggregate ciphertext maintained by the cloud for each channel. When a new transaction arrives, it is directly added to this ciphertext, with an initial value of zero.
[0159] The cycle number is a unique number used to identify different settlement cycles. It is generated by the platform clock and increments by 1 for each settlement cycle.
[0160] The preset settlement duration is fixed at 24 hours, and the length of the settlement cycle is defined by the platform clock.
[0161] Specifically, the clock synchronization of the terminal, cloud aggregation terminal and settlement terminal adopts the NTP network time protocol. All nodes synchronize their time once every hour to ensure that the clock error of all nodes does not exceed 1 second. The start and end times of the settlement cycle are based on the platform clock, and all nodes use the platform clock time as the judgment standard.
[0162] Specifically, the update strategy for rolling aggregated ciphertext is as follows: the cloud maintains an aggregated ciphertext with an initial value of zero for each channel in each settlement cycle. When a new transaction ciphertext arrives, it first verifies whether a deduplication token already exists. If not, it performs homomorphic addition between the new ciphertext and the corresponding rolling aggregated ciphertext to update the rolling aggregated ciphertext, while simultaneously recording the deduplication token. For example, when the ciphertext for channel 0 of a new transaction arrives, the cloud adds this ciphertext to the rolling aggregated ciphertext for channel 0 of the current cycle to obtain a new rolling aggregated ciphertext, which replaces the original aggregated ciphertext, completing the update. It is not necessary to store all transaction ciphertexts; only the aggregated ciphertext needs to be stored.
[0163] Specifically, the aggregated ciphertext sequence is transmitted to the settlement terminal using TLS 1.3 encryption, along with an SHA256 integrity checksum, to ensure security and integrity during transmission. For example, when the cloud sends the aggregated ciphertext sequence to the settlement terminal, it first encrypts the data using TLS 1.3, then generates an SHA256 checksum. Upon receiving the data, the settlement terminal first verifies the checksum, then decrypts the data, ensuring that the data is not tampered with or eavesdropped on during transmission.
[0164] It should be noted that conventional fully homomorphic encryption schemes, if involving multiplication operations, will experience exponentially increasing noise, making it difficult to handle a large number of transactions. In this embodiment, the cloud-based computation is limited to deduplication and channel-by-channel homomorphic addition. The cloud does not decrypt any ciphertext, compare transaction amounts, read category and temperature information, or sort according to the freshness coupling index. The noise increase in ciphertext computation comes only from the accumulation of addition, without increasing the multiplication depth. This can improve the system's concurrent processing capabilities and computational efficiency, while reducing the possibility of the cloud accessing sensitive plaintext information.
[0165] In one embodiment of the present invention, step S7 specifically performs the following steps:
[0166] Step S701: The settlement terminal stores the private key in the isolated execution environment;
[0167] Step S702: After receiving the cycle number and the aggregated ciphertext sequence, the settlement terminal decrypts the aggregated ciphertext sequence to obtain the aggregated integer sequence.
[0168] Specifically, the formula for calculating the aggregated integer sequence is as follows:
[0169]
[0170] in, For the first The aggregated integer obtained by decrypting each channel For the first The aggregated ciphertext of each channel The 0th ciphertext component, For the first The aggregated ciphertext of each channel The first ciphertext component, The polynomial for the BFV private key held by the settlement end. For plaintext modulus, The ciphertext modulus is used for decryption and extraction from the agreed-upon settlement slot. ;
[0171] Step S703: The settlement terminal generates a settlement amount based on the aggregated integer sequence, the preset scale sequence, and the preset amount reference quantity;
[0172] Specifically, the formula for calculating the settlement amount is as follows:
[0173]
[0174] in, To adjust the final output quality, the flower transaction settlement amount is shown in yuan. This is a preset reference amount, specifically 100 yuan. The aggregate integer of the 0th channel. The aggregate integer of the first channel. The aggregated integer of the second channel. The first preset point scale for channel 0 is as follows: , The second preset point scale for the first channel is as follows: , The third preset point scale for the second channel is as follows: , For the first The normalized amount of each channel, multiplied by It was later restored to the monetary value;
[0175] Step S704: The settlement terminal outputs the settlement amount only once for the same period number, and outputs the aggregated ciphertext sequence as the privacy-protected aggregated ciphertext. The settlement amount is used as the settlement basis and financial voucher for the flower transaction after quality correction, and the privacy-protected aggregated ciphertext is used as privacy-protected audit data and does not check the individual transaction records. Among them, the same period number is used to identify the settlement amount output of the corresponding settlement period. The settlement end outputs the settlement amount only once for the same period number; the privacy protection aggregated ciphertext is the period aggregation result formed by the accumulation of homomorphic ciphertext sequences of non-repeating data packets within the same settlement period by channel, and no reverse lookup correspondence is established between it and a single transaction record.
[0176] The isolated execution environment is a secure environment used to store private keys and perform decryption operations to prevent private key leakage. It is implemented using a hardware security module.
[0177] The privacy-protected aggregated ciphertext is a three-way aggregated ciphertext retained after settlement. It can be used for auditing but it is difficult to trace individual transaction records.
[0178] The settlement slot is a specific location in the BFV plaintext polynomial designated for storing settlement data. After decryption, the aggregated integer is extracted from this location, which is designated as the 1st, 2nd, and 3rd coefficient positions of the plaintext polynomial.
[0179] Specifically, the isolated execution environment employs a hardware security module compliant with the FIPS 140-2 standard, with a security level of 3. Private key generation, storage, and decryption operations are all completed within the hardware security module, making it difficult for external entities to read any information about the private key. For example, after the private key for the authorized settlement end is generated, it is directly stored in the hardware security module and will not leak outside the module. The decryption operation is also completed internally; external entities can only obtain the decrypted result and cannot access the private key, thus ensuring its security.
[0180] Specifically, the settlement slots are designated as the 1st, 2nd, and 3rd coefficient positions of the plaintext polynomial. All encryption and decryption operations extract and write data from these three positions. This designation is configured uniformly during system initialization and remains consistent across all nodes. For example, after decryption at the settlement end, the aggregated integer of channel 0 is extracted from the 1st coefficient of the plaintext polynomial, the 2nd coefficient from channel 1, and the 3rd coefficient from channel 2, ensuring accurate data correspondence and preventing extraction errors.
[0181] Specifically, the archiving standard for privacy-protected aggregated encrypted text is as follows: the aggregated encrypted text for each period is stored according to the period number, the storage format is encrypted, access control adopts a hierarchical access control mechanism, only auditors have access rights, the audit process requires multi-level approval, the data retention period is 5 years, and it is automatically deleted after the expiration.
[0182] It should be noted that conventional homomorphic encryption schemes involving multiplication operations require handling complex residual terms during decryption, which is prone to errors. This embodiment only outputs the aggregated quality-corrected settlement amount and privacy-protected aggregated ciphertext, without outputting any freshness, price, quantity, or channel index information of individual transactions. Since the cloud only performs addition operations, the decryption process does not need to handle higher-order terms or relinearization residuals generated by ciphertext multiplication, which can enhance the determinism of the settlement process, meet the audit retention requirements, and reduce the possibility of privacy leakage of individual transactions.
[0183] Specifically, the system deployment is divided into three layers: the seller edge terminal is deployed on the local devices of flower wholesalers or retailers, which can connect to cold chain sensors to collect temperature data; the cloud aggregation terminal is deployed in the cloud server cluster of the trading platform, responsible for receiving transaction data and completing encrypted aggregation; and the authorized settlement terminal is deployed in the platform's settlement department, using an isolated hardware security environment to store private keys and complete decryption and settlement. After the system goes live, the automatic processing flow of the terminal is triggered when the seller completes a transaction. After the terminal completes data normalization and intermediate parameter calculation, it uploads the encrypted data packet to the cloud platform. The cloud platform can complete deduplication and aggregation without decryption, and sends the aggregated encrypted text to the settlement terminal at the end of the cycle.
[0184] In practical applications, the system supports the daily settlement process of a flower trading platform. For example, a platform might process 50,000 flower transactions daily. The raw data for each transaction never leaves the seller's terminal in plaintext; the cloud platform only processes encrypted data packets. The final settlement terminal outputs the daily quality-corrected total amount, automatically adjusted to reflect the freshness degradation of each flower in each transaction. Simultaneously, it generates corresponding privacy-protected aggregated ciphertext for auditing and archiving. Throughout this process, neither the cloud platform nor external nodes can access the price, quantity, or temperature information of a single transaction. Only authorized settlement nodes can obtain the aggregated settlement results, thus satisfying both the business needs of transaction settlement and ensuring the privacy of transaction data.
[0185] like Figure 2 The diagram illustrates the system deployment of this invention. The system includes a terminal, a cloud aggregation terminal, and a settlement terminal. The terminal is deployed locally on the seller's premises and connected to cold chain sensors to collect data such as order number, terminal number, transaction price, transaction quantity, temperature sample, time step, and product semi-freshness period. After performing normalization, freshness correction, channel encoding, and homomorphic encryption locally, the terminal generates a data packet containing a deduplication token and a homomorphic ciphertext sequence and sends it to the cloud aggregation terminal. The cloud aggregation terminal is equipped with a deduplication zone and three aggregated ciphertext channels to remove duplicate data and accumulate ciphertext channel by channel. The settlement terminal stores its private key in an isolated execution environment, decrypts the aggregated ciphertext to generate the settlement amount, and retains the privacy-protected aggregated ciphertext.
[0186] like Figure 3The diagram shows the internal structure of the terminal according to the present invention. The terminal includes a data acquisition area, a local processing area, and an encryption and packaging area. The data acquisition area receives order numbers, terminal numbers, transaction prices, transaction quantities, temperature sample sequences, time step sequences, and a local read-only category parameter table. The local processing area generates deduplication tokens, normalized transaction records, equivalent thermal age, retention factors, freshness loss coupling index, channel index, mask sequences, and plaintext integer sequences. These transaction details and intermediate parameters are processed only in the terminal's memory. The encryption and packaging area homomorphically encrypts the plaintext integer sequences into homomorphic ciphertext sequences and packages them with the deduplication tokens in a fixed format before sending them to the cloud aggregation terminal.
[0187] like Figure 4 The diagram illustrates the three-channel fixed upload structure of this invention. The terminal determines the channel index based on the freshness coupling index and generates a corresponding mask sequence. Only one channel in the mask sequence has a mask bit set to 1 to carry the correction value code; the mask bits for the remaining channels are set to 0 and written with zero values. Although the terminal internally selects the actual carrying channel based on the channel index, the data packet uploaded to the cloud aggregation terminal always includes a deduplication token, channel 0 ciphertext, channel 1 ciphertext, and channel 2 ciphertext, and each channel ciphertext maintains a fixed length and fixed order. Therefore, the cloud aggregation terminal can only receive a unified three-channel ciphertext format and cannot determine the actual channel selection or individual transaction characteristics.
[0188] like Figure 5 The diagram illustrates the collaborative structure of the cloud aggregation terminal and settlement terminal in this invention. Multiple data packets from terminals enter the cloud aggregation terminal, each carrying a deduplication token and three homomorphic ciphertexts. Within the same settlement cycle, the cloud aggregation terminal uses the deduplication token to determine duplicate data, retaining the first arriving data packet and discarding subsequent duplicate packets. For non-duplicate data packets, the cloud aggregation terminal performs homomorphic addition only for each channel, obtaining the aggregated ciphertexts for channel 0, channel 1, and channel 2. After the settlement cycle ends, the cloud aggregation terminal sends the cycle number and the aggregated ciphertext sequence to the settlement terminal. The settlement terminal decrypts the sequence using its private key within an isolated execution environment, obtains the aggregated integer sequence, performs scale merging, outputs the settlement amount, and retains the aggregated ciphertext for auditing.
[0189] The content of this embodiment has been described above, but this embodiment is not limited to the specific implementation methods described above. The specific implementation methods described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms based on the guidance of this embodiment, all of which are within the protection scope of this embodiment.
Claims
1. A data privacy protection system for flower transactions based on homomorphic encryption, comprising a terminal, a cloud aggregation terminal, and a settlement terminal, characterized in that, The system performs the following seven steps: Step S1: The terminal extracts the order number, terminal number, transaction unit price, transaction quantity, temperature sample sequence, time step sequence, and product semi-freshness period, and calculates the deduplication token by combining the order number and terminal number; Step S2: The terminal calculates the equivalent thermal age by combining the temperature sample sequence and the time step sequence, calculates the retention factor by combining the equivalent thermal age and the half-freshness period of the product category, and calculates the freshness loss coupling index by combining the retention factor, the transaction unit price and the transaction quantity. The equivalent heat age is a parameter characterizing the overall heat exposure of a batch of fresh flowers from harvest to sale. The formula for calculating the equivalent heat age is as follows: ; in, For the first The equivalent thermal age of the batch corresponding to each transaction. For the first Number of temperature samples per transaction For the first The first transaction The duration of each temperature range For the first The first transaction Temperature samples within a temperature range, Preset reference temperature; The semi-freshness period of a product category is a parameter that characterizes the time required for the quality of a corresponding category of fresh flowers to decline to half of its initial value. The retention factor is a dimensionless parameter characterizing the proportion of the remaining mass of the flowers to the initial mass. The formula for calculating the retention factor is as follows: ; in, For the first The retention factor for this transaction has a range of values. , For the first The equivalent heat age of the transaction For the first The product category corresponding to this transaction has a semi-fresh period; The formula for calculating the freshness loss coupling index is as follows: ; in, For the first Freshness-loss coupling index of a transaction, For the first The transaction price per unit of the transaction. For the first The number of transactions in a transaction. For the first The original value of the goods in this transaction, This is a preset reference amount. For the first The retention factor of this transaction, The preset stability constant; Step S3: The terminal determines the channel index based on the freshness loss coupling index and generates a mask sequence by combining the channel index; Step S4: The terminal calculates the plaintext integer sequence by combining the transaction unit price, transaction quantity, retention factor, mask sequence, and preset scale sequence; Step S5: The terminal homomorphically encrypts the plaintext integer sequence into a homomorphic ciphertext sequence, combines the homomorphic ciphertext sequence and the deduplication token to package and generate a data packet, and sends it to the cloud aggregation terminal; Step S6: The cloud aggregation terminal receives the data packet, removes duplicate data based on the deduplication token, accumulates the non-duplicate homomorphic ciphertext sequence channel by channel to obtain the aggregated ciphertext sequence, and sends it to the settlement terminal. Step S7: The settlement terminal receives the aggregated ciphertext sequence and decrypts it to obtain the aggregated integer sequence. It then combines the aggregated integer sequence with the preset scale sequence to generate the settlement amount and outputs it.
2. The flower transaction data privacy protection system based on homomorphic encryption according to claim 1, characterized in that, Step S1 includes: The terminal extracts order number, terminal number, transaction unit price, transaction quantity, temperature sample sequence, time step sequence, and category semi-freshness period from the flower transaction data. The temperature sample sequence is generated by the cold chain sensor signature, the time step in the time step sequence is limited by the preset sampling interval, and the category semi-freshness period is read from the local read-only category parameter table of the terminal. The terminal concatenates the order number and the terminal number in sequence, calculates the message authentication value using the deduplication key stored in the authorized settlement field, and uses the message authentication value as the deduplication token. The deduplication key is not sent to the cloud aggregation terminal. The terminal arranges the temperature sample sequence and time step sequence in chronological order before the transaction, and combines the category code, deduplication token, transaction unit price, transaction quantity, temperature sample sequence, time step sequence, and category semi-freshness period into a standardized transaction record; The standardized transaction record only enters step S2 in the terminal memory, where the cloud aggregation terminal receives the deduplication token and the homomorphic ciphertext sequence.
3. The flower transaction data privacy protection system based on homomorphic encryption according to claim 1, characterized in that, Step S3 includes: The terminal determines the channel index based on the freshness loss coupling index and the preset channel upper limit; The terminal generates a mask sequence based on the channel index; wherein, the value corresponding to the channel number that matches the channel index in the mask sequence is a constant 1, and the value corresponding to the channel number that does not match the channel index is zero. The preset scale sequence includes a first preset setpoint scale, a second preset setpoint scale, and a third preset setpoint scale; The terminal sends the mask sequence and the preset scale sequence to step S4 to participate in the plaintext integer sequence calculation.
4. The flower transaction data privacy protection system based on homomorphic encryption according to claim 1, characterized in that, Step S4 includes: The terminal determines the corrected value of goods based on the transaction unit price, transaction quantity, and retention factor; The terminal determines the plaintext integer sequence based on the corrected value, mask sequence, preset scale sequence, preset amount reference quantity and plaintext modulus. The plaintext integer sequence includes the plaintext integer corresponding to each channel. The plaintext modulus is limited by a preset wraparound constraint; The product of the transaction price, transaction quantity, and retention factor is generated only in the terminal memory and is not written to the terminal log; after the plaintext integer sequence is generated, the terminal overwrites the temporary value of the product.
5. A flower transaction data privacy protection system based on homomorphic encryption according to claim 1, characterized in that, Step S5 includes: The terminal uses homomorphic encryption that supports precise integer addition, which encapsulates each plaintext integer in the plaintext integer sequence into a corresponding binary ciphertext, and then forms a homomorphic ciphertext sequence from the binary ciphertexts. The encryption parameters include the ciphertext modulus, the plaintext modulus, the public key polynomial, the one-time random polynomial, and the error polynomial; The single-pass random polynomials of the same transaction in each channel are independent of each other; The ciphertext ring dimension, ciphertext modulus, and error distribution are determined based on a preset security level. The terminal packages the deduplication token and homomorphic ciphertext sequence into a data packet according to a fixed number of fields, a fixed field order, and a fixed ciphertext length, and sends it to the cloud aggregation terminal. The deduplication token is not used for decryption, and the private key and the product semi-freshness table are not sent to the cloud aggregation terminal.
6. A flower transaction data privacy protection system based on homomorphic encryption according to claim 1, characterized in that, Step S6 includes: The cloud aggregation terminal reads data packets in the order of arrival and deduplicates data packets within the same settlement period based on the deduplication token; When the same deduplication token corresponds to multiple data packets within the same settlement period, the cloud aggregation terminal retains the data packet with the earliest arrival time and discards the remaining data packets. The settlement period is limited by the platform clock and the preset settlement duration. The cloud aggregation terminal performs homomorphic addition on the homomorphic ciphertext sequence in the non-repeating data packet by channel to obtain the aggregated ciphertext sequence, and saves only one rolling aggregated ciphertext for each channel; After the settlement period ends, the cloud aggregation terminal sends the period number and the aggregated encrypted sequence to the settlement terminal. The deduplication process does not change the encrypted content, and the cloud aggregation terminal does not generate a single amount output.
7. A flower transaction data privacy protection system based on homomorphic encryption according to claim 1, characterized in that, Step S7 includes: The settlement end stores its private key within an isolated execution environment; After receiving the cycle number and the aggregated ciphertext sequence, the settlement terminal decrypts the aggregated ciphertext sequence to obtain the aggregated integer sequence. The settlement terminal generates the settlement amount based on the aggregated integer sequence, the preset scale sequence, and the preset amount reference quantity; The settlement terminal outputs the settlement amount only once for the same period number, and outputs an aggregated ciphertext sequence as a privacy-protected aggregated ciphertext. The privacy-protected aggregated ciphertext does not allow for reverse lookup of individual transaction records.
Citation Information
Patent Citations
Any-precision database privacy protection query method based on fully homomorphic encryption
CN118747380A
On-cloud semi-homomorphic encryption method capable of resisting private key tracking
CN120614103A