CN114124454A - Message sending method, system, electronic equipment, readable storage medium and product - Google Patents

Message sending method, system, electronic equipment, readable storage medium and product Download PDF

Info

Publication number
CN114124454A
CN114124454A CN202111224787.6A CN202111224787A CN114124454A CN 114124454 A CN114124454 A CN 114124454A CN 202111224787 A CN202111224787 A CN 202111224787A CN 114124454 A CN114124454 A CN 114124454A
Authority
CN
China
Prior art keywords
message
participant
receiving
publish
forwarded
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111224787.6A
Other languages
Chinese (zh)
Inventor
张春海
孙军欢
孙夏
张翔宇
楚汉祥
薛新江
陈沫
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Zhixing Technology Co Ltd
Original Assignee
Shenzhen Zhixing Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Zhixing Technology Co Ltd filed Critical Shenzhen Zhixing Technology Co Ltd
Priority to CN202111224787.6A priority Critical patent/CN114124454A/en
Publication of CN114124454A publication Critical patent/CN114124454A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/04Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
    • H04L63/0428Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload
    • H04L63/0442Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload wherein the sending and receiving network entities apply asymmetric encryption, i.e. different keys for encryption and decryption
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/606Protecting data by securing the transmission between two devices or processes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/62Protecting access to data via a platform, e.g. using keys or access control rules
    • G06F21/6218Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database
    • G06F21/6245Protecting personal data, e.g. for financial or medical purposes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail

Abstract

The invention discloses a message sending method, a system, electronic equipment, a readable storage medium and a product, wherein the message sending method comprises the following steps: receiving a message to be converted published by a first message participant, and extracting a message topic and a message body in the message to be converted, wherein the message to be converted is published by the first message participant in a publish-subscribe mode, and the message to be converted is subscribed only by a message forwarder; analyzing the message theme to obtain an identifier of a second message participant; searching and acquiring a receiving address of the second message participant from a preset configuration file based on the identifier of the second message participant; and publishing the message body to the second message participant in a publish-subscribe mode according to the receiving address. The invention solves the technical problem of message leakage risk in a basic publish-subscribe mode when a scene needing to be sent to some appointed subscribers by a sender in a privacy calculation scene is solved.

Description

Message sending method, system, electronic equipment, readable storage medium and product
Technical Field
The present invention relates to the field of database technologies, and in particular, to a message sending method, a message sending system, an electronic device, a readable storage medium, and a readable storage product.
Background
At present, in some application scenarios, for example, in a privacy computing scenario based on a Trusted Execution Environment (TEE), a publish-subscribe mode in a message middleware system needs to be used for message communication, but after a publisher publishes a message to a topic in a basic publish-subscribe mode, as long as the subscriber subscribed to the topic can receive the message, that is, the publisher only manages published messages regardless of who receives the message, and whether the option of receiving the message is on the subscriber side, if it needs to deal with a scenario in which a sender sends the message to a specified number of subscribers, there is a risk of message leakage in the basic publish-subscribe mode.
Disclosure of Invention
The invention mainly aims to provide a message sending method, a message sending system, electronic equipment and a readable storage medium, and aims to solve the technical problem that when a scene that one sender sends messages to some specified subscribers needs to be responded, a basic publish-subscribe mode is adopted, so that the risk of message leakage exists.
In order to achieve the above object, the present invention provides a message sending method, which is applied to a message forwarding party in a privacy computation scenario, where the privacy computation scenario further includes a plurality of message participants, and the message sending method includes:
receiving a message to be converted published by a first message participant, and extracting a message topic and a message body in the message to be converted, wherein the message to be converted is published by the first message participant in a publish-subscribe mode, and the message to be converted is subscribed only by a message forwarder;
analyzing the message theme to obtain an identifier of a second message participant;
searching and acquiring a receiving address of the second message participant from a preset configuration file based on the identifier of the second message participant;
and publishing the message body to the second message participant in a publish-subscribe mode according to the receiving address.
Optionally, the step of receiving a to-be-transferred message issued by a first message participant and extracting a message topic and a message body in the to-be-transferred message includes:
receiving a message to be converted issued by a first message participant, and extracting a message subject and an encrypted message main body in the message to be converted, wherein the encrypted message main body is obtained by encrypting a plaintext message main body by the first message participant by using a first private key of the first message participant;
searching a first public key corresponding to the first private key from the configuration file, and decrypting the encrypted message body by adopting the first public key to obtain the message body in a plaintext;
the step of publishing the message body to the second message participant in a publish-subscribe mode according to the receiving address comprises:
and publishing the message body in plain text to the second message participant in a publish-subscribe mode according to the receiving address.
Optionally, before the step of analyzing the message topic to obtain the identifier of the second message participant, the method further includes:
detecting whether the message theme meets a preset message theme specification or not;
if the message theme specification is met, the step of analyzing the message theme to obtain the identifier of a second message participant is executed;
and if the message subject specification is not met, returning error report information to the first message participant.
Optionally, after the step of analyzing the message topic to obtain the identifier of the second message participant, the method further includes:
searching a second public key of the second message participant corresponding to the identifier of the second message participant in the configuration file;
the step of publishing the message body to the second message participant in a publish-subscribe mode according to the receiving address comprises:
and encrypting the message main body in the plaintext by using the second public key, and publishing the encrypted message main body to the second message participant in a publish-subscribe mode according to the receiving address so that the second message participant can decrypt the message main body in the plaintext by using a second private key corresponding to the second public key.
Optionally, the message sending method further includes:
starting a monitoring thread to monitor the updating state of the configuration file;
the step of searching and acquiring the receiving address of the second message participant from a preset configuration file based on the identifier of the second message participant comprises:
and searching the latest configuration file monitored by the monitoring thread for the receiving address of the second message participant corresponding to the identification of the second message participant.
Optionally, the message sending method further includes:
starting a fixed local receiving port;
the step of receiving the message to be forwarded issued by the first message participant comprises the following steps:
and monitoring the receiving port of the local terminal to receive the message to be converted issued by the receiving port of the local terminal from the first message participation direction.
Optionally, when there are multiple message forwarders, the IP addresses of the multiple message forwarders jointly bind to a forwarder domain name, and the step of receiving the message to be forwarded issued by the first message participant includes:
and receiving a message to be forwarded issued to the domain name of the forwarding party by the first message participant.
In order to achieve the above object, the present invention further provides a message sending method, where the message sending method is applied to any first message participant needing to publish a message in a publish-subscribe mode in a privacy computation scenario, where the privacy computation scenario further includes at least one message forwarding party, and the message sending method includes:
acquiring a message body to be sent to a second message participant and an identifier of the second message participant;
packaging the identifier of the second message participant in a message theme, and packaging the message theme and the message main body to obtain a message to be transferred;
publishing the message to be forwarded to a message forwarding party in a publish-subscribe mode, wherein the message to be forwarded is subscribed only by the message forwarding party;
the message to be forwarded is used for the message forwarding party to extract the message main body and the message subject and analyze and acquire the identifier of the second message participant in the message subject;
the identifier of the second message participant is stored in a preset configuration file in a one-to-one correspondence with the receiving address of the second message participant, and the message to be forwarded is further used for the message forwarding party to search the receiving address of the second message participant from the preset configuration file based on the identifier of the second message participant and send the message body to the second message participant in a publish-subscribe mode according to the receiving address of the second message participant.
In order to achieve the above object, the present invention further provides a message sending method, where the message sending method is applied to any second message participant that needs to receive a subscription message in a privacy computation scenario, where the privacy computation scenario further includes at least one message forwarding party, and the message sending method includes:
starting a fixed local receiving port, wherein the local receiving port is provided with a fixed port number;
receiving a message body published to the local receiving port by a message forwarder in a publish-subscribe mode based on the port number;
the message body is issued to the local receiving port according to a receiving address after the message forwarding party extracts the message to be forwarded;
the message to be forwarded is a message which is published to the message forwarding party by a first message participant in a publish-subscribe mode, and the message to be forwarded can only be subscribed by the message forwarding party;
the message to be forwarded further comprises a message subject, the receiving address is obtained by the message forwarding party through querying in a preset configuration file based on the identifier of the second message participant obtained by analyzing the message subject, and the receiving address comprises the port number.
The present invention further provides a message forwarding apparatus, where the message forwarding apparatus is deployed in a message forwarding party in a privacy computing scenario, where the privacy computing scenario further includes a plurality of message participants, and the message forwarding apparatus includes:
the first receiving module is used for receiving a message to be forwarded published by a first message participant and extracting a message theme and a message main body in the message to be forwarded, wherein the message to be forwarded is a message published by the first message participant in a publish-subscribe mode, and the message to be forwarded is subscribed only by the message forwarding party;
the analysis module is used for analyzing the message theme to obtain the identifier of a second message participant;
the searching module is used for searching and acquiring a receiving address of the second message participant from a preset configuration file based on the identifier of the second message participant;
and the first publishing module is used for publishing the message body to the second message participant in a publishing subscription mode according to the receiving address.
The invention also provides a message sending device, which is deployed in any first message participant needing to publish a message in a publish-subscribe mode among a plurality of message participants in a privacy computation scenario, wherein the privacy computation scenario further comprises at least one message forwarding party, and the message sending device comprises:
the acquisition module is used for acquiring a message main body to be sent to a second message participant and an identifier of the second message participant;
the packaging module is used for packaging the identifier of the second message participant in a message theme and packaging the message theme and the message main body to obtain a message to be converted;
the second publishing module is used for publishing the message to be forwarded to a message forwarding party in a publishing subscription mode, wherein the message to be forwarded is only subscribed by the message forwarding party;
the message to be forwarded is used for the message forwarding party to extract the message main body and the message subject and analyze and acquire the identifier of the second message participant in the message subject;
the identifier of the second message participant is stored in a preset configuration file in a one-to-one correspondence with the receiving address of the second message participant, and the message to be forwarded is further used for the message forwarding party to search the receiving address of the second message participant from the preset configuration file based on the identifier of the second message participant and send the message body to the second message participant in a publish-subscribe mode according to the receiving address of the second message participant.
The invention also provides a message receiving apparatus, which is applied to any second message participant needing to receive a subscription message in a plurality of message participants in a privacy computation scenario, wherein the privacy computation scenario further comprises at least one message forwarding party, and the message receiving apparatus comprises:
the starting module is used for starting a fixed local receiving port, and the local receiving port is provided with a fixed port number;
a second receiving module, configured to receive, based on the port number, a message body published to the local receiving port by the message forwarder in a publish-subscribe mode;
the message body is issued to the local receiving port according to a receiving address after the message forwarding party extracts the message to be forwarded;
the message to be forwarded is a message which is published to the message forwarding party by a first message participant in a publish-subscribe mode, and the message to be forwarded can only be subscribed by the message forwarding party;
the message to be forwarded further comprises a message subject, the receiving address is obtained by the message forwarding party through querying in a preset configuration file based on the identifier of the second message participant obtained by analyzing the message subject, and the receiving address comprises the port number.
The invention also provides a message sending system, which comprises a message sending device, a message forwarding device and a message receiving device, wherein the message forwarding device is deployed at a message forwarding party in a privacy calculation scene, the message sending device is deployed at any first message participant needing to publish messages in a publish-subscribe mode in a plurality of message participants in the privacy calculation scene, and the message receiving device is deployed at any second message participant needing to receive subscribed messages in the plurality of message participants in the privacy calculation scene;
the message sending device is used for publishing the message to be forwarded of the first participant to the message forwarding device in a publish-subscribe mode, wherein the message to be forwarded is subscribed only by the message forwarding device;
the message forwarding device is used for receiving the message to be forwarded, extracting a message theme and a message main body in the message to be forwarded, and analyzing the message theme to obtain an identifier of a second message participant; the message body is used for searching and acquiring a receiving address of the second message participant from a preset configuration file based on the identifier of the second message participant and publishing the message body to the message receiving device of the second message participant in a publish-subscribe mode according to the receiving address;
the message receiving device is used for receiving the message body.
The present invention also provides an electronic device, which is an entity device, and includes: a memory, a processor and a program of the messaging method stored on the memory and executable on the processor, which program of the messaging method when executed by the processor is operable to implement the steps of the messaging method as described above.
The present invention also provides a readable storage medium, which is a computer readable storage medium, on which a program for implementing a message sending method is stored, and when executed by a processor, the program for implementing the message sending method implements the steps of the message sending method as described above.
The invention also provides a product, which is a computer program product comprising a computer program which, when executed by a processor, implements the steps of the message sending method as described above.
The invention provides a message sending method, a system, electronic equipment, a readable storage medium and a product, wherein a message forwarding party is additionally arranged, the message to be forwarded, which is published in a publishing subscription mode by a first message participant, is received, and the message to be forwarded is set to be subscribed only by the message forwarding party, so that the message to be forwarded, which is sent to the message forwarding party by the first message participant, can only be received by the message forwarding party; extracting a message theme and a message body in the message to be forwarded through the message forwarding party, analyzing the message theme to obtain an identifier of a second message participant, searching a receiving address of the second message participant in a preset configuration file based on the identifier of the second message participant, and publishing the message body to the second message participant in a publishing subscription mode according to the receiving address, so that the message body sent to the second message participant by the message forwarding party can only be received by the second message participant; the whole process realizes that the first message participant pertinently sends the message body to the second message participant in the publish-subscribe mode and does not leak to the message participants except the second message participant, and solves the technical problem of message leakage risk existing in the basic publish-subscribe mode when needing to correspond to the situation that one sender sends the message body to some appointed subscribers in the privacy calculation scene.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive exercise.
Fig. 1 is a flowchart illustrating a first embodiment of a message sending method according to the present invention;
fig. 2 is a schematic structural diagram of a hardware operating environment related to a message sending method in an embodiment of the present invention.
The objects, features and advantages of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
In order to make the aforementioned objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in detail below. It is to be understood that the described embodiments are merely exemplary of the invention, and not restrictive of the full scope of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Example one
Referring to fig. 1, a message sending method provided in an embodiment of the present invention is applied to a message forwarding party, and the message sending method includes:
step S10, receiving a to-be-converted message published by a first message participant, and extracting a message topic and a message body in the to-be-converted message, where the to-be-converted message is a message published by the first message participant in a publish-subscribe mode, and the to-be-converted message is subscribed only by the message forwarder;
in the basic publish-subscribe model, publishers publish messages to different topics (or channels) through message queue middleware, and subscribers will receive all messages on their subscribed topics. Topics are customized by the publisher and can be understood as categories of messages. How a subscriber subscribes to a topic specifically differs according to the specifically adopted message queue middleware, for example, in zeroMQ, the subscriber acquires a message in the topic of interest published by a publisher by listening to a sending port of the publisher. ZeroMQ is a message queue-based multi-threaded network library that abstracts underlying details of socket type, connection handling, frames, and even routing, providing sockets across multiple transport protocols. In addition, message queue middleware also has RabbitMQ, RocketMQ, ActiveMQ, Kafka, MetaMq, and the like. In this embodiment, the message queue middleware is not limited to be specifically used. The publish-subscribe mode is generally applied to a scenario where a message is broadcast to multiple parties in one direction, and generally does not need to receive a reply from a subscriber when a publisher sends a message in the publish-subscribe mode.
Therefore, based on the characteristics of the publish-subscribe model, in many application scenarios, the publish-subscribe model needs to be employed for message communication between communicating parties, for example, in a trusted context based privacy computing scenario. However, in the basic publish-subscribe mode, because the messages published by the publishers can be received by the subscribers as long as the subscribers subscribe to the corresponding topics, in the privacy calculation scenario, it is necessary to deal with a scenario in which one sender sends messages to some specified subscribers, and at this time, there is a risk of message leakage by using the basic publish-subscribe mode.
For the technical problem, in this embodiment, a plurality of parties needing to communicate in a privacy computation scenario are all referred to as message participants, a role, that is, a message forwarding party, is added outside the message participants, and messages that each message participant needs to send to other message participants are filtered and forwarded by the message forwarding party.
Specifically, any message participant needing to send a message to other message participants in a publish-subscribe mode is referred to as a first message participant, and a message participant specified by the first message participant to receive the message is referred to as a second message participant; there may be multiple second message participants, i.e., the first message participant specifies that a message be sent to multiple second message participants. It should be noted that "first" and "second" are used merely for convenience of reference and distinction, and are not intended to classify message participants. It will be appreciated that one message participant may be either sending a message to a second message participant as a first message participant or receiving a message sent by the first message participant as a second message participant.
After determining the message body which needs to be sent to the second message participant, the first message participant acquires the identifier of the second message participant. Wherein, each message participant is provided with a unique identifier in advance to distinguish each message participant. The first message participant may pre-store the identifiers of other message participants, and after the first message participant determines the second message participant, the identifier of the second message participant is obtained.
The first message participant encapsulates the identity of the second message participant in the message subject, which may specifically be encapsulated according to a pre-set specification. Further, in one embodiment, in order to facilitate the second message participant or the message forwarding party to trace back the sender of the message, the first message participant may also package its own identifier together with the identifier of the second message participant in the message subject according to a preset specification. The specific package specifications are many and not limited in this embodiment. Illustratively, one message topic is: party _2& party _3@ party _1, representing that the sender is party _1, the receiver is party _2 and party _3, and party _1, party _2 and party _3 are participant identifications of three message participants.
The first message participant packages the acquired message body and the message theme into a message (hereinafter referred to as a to-be-forwarded message for distinguishing), and publishes the to-be-forwarded message to the message forwarder in a publish-subscribe mode. In order to avoid that other message participants can obtain the message to be forwarded, the message published by the first message participant in the publish-subscribe mode can be set to be subscribed by the message forwarder only. It should be noted that there are many ways to implement that the message published by the first message participant in the publish-subscribe mode is only subscribed by the message forwarder, which are different according to the specifically adopted message queue middleware, and the implementation is not limited in this embodiment. Illustratively, a message can be published through a first message participant through a fixed sending port, while the port number of the sending port is only preserved in advance in a message forwarder, and the message forwarder receives a pending message published in a publish-subscribe mode by the first message participant by monitoring the sending port.
And the message forwarding party receives the message to be forwarded published by the first message participant in a publish-subscribe mode, and extracts the message theme and the message body in the message to be forwarded. It should be noted that, the packaging manner and the extracting manner of the message subject and the message body can be defined in advance between each message participant and the message forwarding party.
Step S20, analyzing the message theme to obtain the identifier of the second message participant;
after extracting the message theme in the message to be transferred, the message transfer party analyzes the message theme to obtain the identifier of the second message participant. Specifically, the encapsulation mode of the message topic may be predefined between each message participant and the message forwarding party, and the message forwarding party parses the message topic according to the parsing mode corresponding to the predefined encapsulation mode, so as to obtain the identifier of the second message participant carried in the message topic.
Step S30, searching for and acquiring a receiving address of the second message participant from a preset configuration file based on the identifier of the second message participant;
after the message forwarding party obtains the identifier of the second message participant, the receiving address of the second message participant is searched and obtained in the configuration file based on the identifier of the second message participant. The configuration file is a file preset in the message forwarding party, and includes an identifier and a receiving address of the second message participant, and the identifier and the receiving address of the second message participant are associated with each other, so that the message forwarding party can find the receiving address of the second message participant through the identifier of the second message participant. It should be noted that, the configuration file may be preset to include the identifications and receiving addresses of all message participants that need to be the message recipients. The receiving address may include an IP address of the message participant and a port number of the receiving port. It should be noted that the receiving address of the message participant is not changed once set, or the synchronization is changed in the configuration file when changed.
Further, if the message forwarder does not find the identifier of the second message participant in the configuration file or does not find the receiving address of the second message participant, the error information may be returned to the first message participant.
Step S40, publishing the message body to the second message participant in a publish-subscribe mode according to the receiving address.
After finding the receiving address of the second message participant, the message forwarder may issue the message body to the second message participant in a publish-subscribe mode according to the receiving address of the second message participant. The message forwarding party issues the message body to the second message participant according to the receiving address of the second message participant, so that the message participants except the second message participant cannot receive the message body, and the first message participant sends the message body to the second message participant in a targeted manner in a publish-subscribe mode and cannot be leaked to the message participants except the second message participant. It should be noted that the message forwarding party may specifically publish the message body to the second message forwarding party only by publishing the message body to the second message participant, or publish the whole message to be forwarded to the second message participant.
In the embodiment, by additionally arranging the message forwarding party, the message to be forwarded which is published by the first message participant in a publish-subscribe mode is received, and the message to be forwarded is set to be subscribed only by the message forwarding party, so that the message to be forwarded which is sent by the first message participant to the message forwarding party can only be received by the message forwarding party; extracting a message theme and a message body in the message to be forwarded through the message forwarding party, analyzing the message theme to obtain an identifier of a second message participant, searching a receiving address of the second message participant in a preset configuration file based on the identifier of the second message participant, and publishing the message body to the second message participant in a publishing subscription mode according to the receiving address, so that the message body sent to the second message participant by the message forwarding party can only be received by the second message participant; the whole process realizes that the first message participant pertinently sends the message body to the second message participant in the publish-subscribe mode and does not leak to the message participants except the second message participant, and solves the technical problem of message leakage risk existing in the basic publish-subscribe mode when needing to correspond to the situation that one sender sends the message body to some appointed subscribers in the privacy calculation scene.
Further, in an embodiment, before the step S20, the method further includes:
step a, detecting whether the message theme accords with a preset message theme standard or not;
after receiving the message to be forwarded and extracting the message theme from the message to be forwarded, the message forwarding party can firstly detect whether the message theme meets the message theme specification. The message topic specification is a specification of encapsulating a message topic that is set in advance according to needs, for example, specifies how to organize the identifier of the second message participant and the identifier of the first message participant as a message topic. For example, the message forwarder detecting whether the message topic conforms to the message topic specification may include detecting whether the message topic includes an identification of the second message participant, whether the identification of the second message participant included in the message topic is complete, and so on.
B, if the message theme is in accordance with the message theme specification, executing the step of analyzing the message theme to obtain the identifier of a second message participant;
if the message forwarding party detects that the message topic accords with the message topic specification, the message forwarding party analyzes the message topic to obtain the identifier of the second message participant, then searches the receiving address of the second message participant according to the identifier of the second message participant, and issues a message main body to the second message participant in a publish-subscribe mode according to the receiving address of the second message participant.
And c, if the message subject specification is not met, returning error information to the first message participant.
And if the message forwarding party detects that the message theme does not accord with the message theme specification, returning error report information to the first message participant. After receiving the error information, the first message participant may re-encapsulate the message topic and re-transmit the message to be forwarded.
In the embodiment, after the message to be forwarded is extracted from the message to be forwarded by the message forwarding party, compliance detection is performed on the message topic, the message is forwarded according to the identifier of the second message participant carried in the message topic when compliance is performed, and error information is returned when the compliance is not performed, so that the message of the first message participant can be accurately issued to the second message participant.
Further, in an embodiment, after the step S20, the method further includes:
step S50, searching the configuration file for the second public key of the second message participant corresponding to the identifier of the second message participant;
after obtaining the identifier of the second message participant, the message forwarder may further search, in the configuration file, a public key of the second message participant (hereinafter, referred to as a second public key for distinction) corresponding to the identifier of the second message participant. Each message participant can generate its own public key and private key in advance according to a specified key generation method, the public key of each message participant can be stored in a configuration file of the message forwarding party in association with the identifier of the participant, and the private key is only stored locally in the message participant. Illustratively, when the message participants and the message forwarder publish messages using ZeroMQ, the public key of the message participants may use the public key of the curve protocol, which is a ZeroMQ channel-encrypted protocol.
The step S40 includes:
step S401, encrypting the plaintext message body by using the second public key, and publishing the encrypted message body to the second message participant in a publish-subscribe mode according to the receiving address, so that the second message participant decrypts by using a second private key corresponding to the second public key to obtain the plaintext message body.
After the message forwarding party obtains the second public key, the message body in the plaintext may be encrypted by using the second public key, so as to obtain the encrypted message body. And the message forwarding party publishes the encrypted message body to the second message participant in a publish-subscribe mode according to the receiving address of the second message participant. And after receiving the encrypted message body, the second message participant decrypts the encrypted message body by using a second private key which is locally stored and corresponds to the second public key to obtain a plaintext message body, wherein the second private key is a private key which is owned by the second message participant and corresponds to the second public key.
In this embodiment, the public key of each message participant is stored in the preset configuration file in the message forwarding party, the second public key of the second message participant is found in the configuration file according to the identifier of the second message participant obtained by parsing from the message topic, and the message body is encrypted by using the second public key and then issued to the second message participant, thereby ensuring the security of the message body in the process of forwarding the message body to the second message participant by the message forwarding party.
Further, in an embodiment, the step S10 includes:
step S101, receiving a message to be converted issued by a first message participant, and extracting a message subject and an encrypted message main body in the message to be converted, wherein the encrypted message main body is obtained by encrypting a message main body of a plaintext by the first message participant by using a first private key of the first message participant;
step S102, searching a first public key corresponding to the first private key from the configuration file, and decrypting the encrypted message body by adopting the first public key to obtain the message body in a plaintext;
the first message participant can also encrypt the message body by using a private key of the first message participant (hereinafter referred to as a first private key) after acquiring the message topic and the message body, then package the message body and the message topic together to obtain a message to be forwarded, and issue the message to be forwarded of the message body containing the ciphertext to the message forwarding party. The message forwarding party extracts the message body of the ciphertext from the received message to be forwarded, searches a public key (hereinafter referred to as a first public key) of a first message participant from the configuration file, and decrypts the message body of the ciphertext by using the first public key to obtain the message body of the plaintext. The message body is encrypted by the first message participant and then distributed to the message forwarding party, so that the safety of the message body is ensured in the process of forwarding the message body to the message forwarding party by the first message participant.
The step S40 includes:
step S402, publishing the plaintext message body to the second message participant in a publish-subscribe mode according to the receiving address.
After the message forwarding party obtains the plaintext message body, the message forwarding party may publish the plaintext message body to the second message participant in a publish-subscribe mode according to the receiving address of the second message participant, or may encrypt the plaintext message body by using a second public key of the second message participant and publish the encrypted plaintext message body to the second message participant.
Further, in an embodiment, the message sending method further includes:
step S60, starting a monitoring thread to monitor the update state of the configuration file;
when a message participant is added or deleted, the manager can add the participant information such as the identifier, the receiving address, the public key and the like of the message participant in the configuration file. The message forwarding party can start a monitoring thread to monitor the update state of the configuration file so as to adopt the latest configuration file to perform message forwarding service.
The step S30 includes:
step S301, searching for a receiving address of the second message participant corresponding to the identifier of the second message participant in the latest configuration file monitored by the monitoring thread.
After the message forwarding party obtains the identifier of the second message participant, the message forwarding party can search the receiving address of the second message participant corresponding to the identifier of the second message participant in the latest configuration file monitored by the monitoring thread.
In the embodiment, the information of the participants of each message participant is maintained through the configuration file in the message forwarding party, the monitoring thread is started through the message forwarding party to monitor the updating state of the configuration file, and the message forwarding service is performed by adopting the latest configuration file, so that the message participants are added and deleted only by updating the configuration file, the message participants and the message forwarding party do not need to be restarted, and meanwhile, the network complexity and the maintenance cost when the communication parties perform message communication in a subscription publishing mode are greatly reduced.
Example two
On the basis of the first embodiment, the message sending method in the foregoing embodiment may further include step S70, and the step of receiving the pending message issued by the first message participant in step S10 further includes step S103, which is described below. In this embodiment, the same or similar contents as those in the first embodiment may refer to the above description, and are not repeated herein.
Step S70, starting a fixed local receiving port;
step S103, monitoring the local terminal receiving port to receive the message to be transferred issued by the local terminal receiving port from the first message participation direction.
In the basic publish-subscribe mode, a subscriber can subscribe the message published to the topic by the publisher in a mode of monitoring the transmitting port of the publisher, and the message published by the publisher can be received as long as the subscriber knows the transmitting port of the publisher, so that when the publisher only needs to publish the message to some specified subscribers, the message can be leaked to other subscribers.
To solve the technical problem, in this embodiment, the message forwarder may activate at least one fixed receiving port (hereinafter referred to as a local receiving port, where the local refers to the message forwarder). And presetting the port number of the local receiving port in each message participant in advance.
And the first message participant publishes the message to be forwarded to the local receiving port in a publish-subscribe mode according to the port number of the local receiving port. The message forwarding party acquires the message to be forwarded issued by the first message participant by monitoring the receiving port of the home terminal. Because the first message participant is to publish the message to be forwarded to the local receiving port of the message forwarding party, the message participants except the message forwarding party cannot receive the message to be forwarded, so that the first message participant can send the message body to the second message participant in a publishing subscription mode in a targeted manner, and the message body cannot be leaked to the message participants except the second message participant.
EXAMPLE III
On the basis of the first embodiment, the step of receiving the pending message issued by the first message participant in step S10 of the message sending method in the above embodiment may further include step S104, which is described below. In this embodiment, the same or similar contents as those in the first embodiment may refer to the above description, and are not repeated herein.
Step S104, receiving the message to be forwarded issued by the first message participant to the domain name of the forwarding party.
Because all messages pass through the message forwarding party after the message forwarding party is added, the message forwarding party puts the messages into the memory in a queue mode, and thus, when the number of message participants is increased and the number of messages to be sent is increased, the machine memory for deploying the message forwarding party becomes a short board.
To solve this problem, in this embodiment, a plurality of message forwarders may be provided, the configuration files in the respective message forwarders are the same, and the plurality of message forwarders implement the same message forwarding service. When there are a plurality of message forwarders, IP addresses of the plurality of message forwarders may collectively bind a domain name (hereinafter, referred to as a forwarder domain name).
The first message participant can publish the message to be forwarded to the domain name of the forwarding party in a publish-subscribe mode, and since the message to be forwarded is published to the domain name of the forwarding party, the message published by the first message participant in the publish-subscribe mode can be subscribed only by the message forwarding party. Because the domain name of the forwarding party is bound with a plurality of IP addresses, the domain name service defaults to poll each IP address bound by the domain name of the forwarding party, so that the message to be forwarded is issued to the message forwarding party corresponding to the polled IP address, the message to be forwarded issued by each first message participant is dispersed to each message forwarding party for processing, the effect of shunting is achieved, and the message sending method supports large-scale message sending.
Example four
On the basis of the first, second, and/or third embodiments, a message sending method provided by the embodiments of the present invention is applied to any first message participant needing to publish a message in a publish-subscribe mode in a privacy computation scenario, where the privacy computation scenario further includes at least one message forwarding party, and the message sending method includes:
step A10, obtaining a message body to be sent to a second message participant and an identifier of the second message participant;
step A20, encapsulating the identifier of the second message participant in a message theme, and packaging the message theme and the message body to obtain a message to be converted;
step A30, publishing the message to be forwarded to a message forwarding party in a publish-subscribe mode, wherein the message to be forwarded is subscribed only by the message forwarding party;
the message to be forwarded is used for the message forwarding party to extract the message main body and the message subject and analyze and acquire the identifier of the second message participant in the message subject;
the identifier of the second message participant is stored in a preset configuration file in a one-to-one correspondence with the receiving address of the second message participant, and the message to be forwarded is further used for the message forwarding party to search the receiving address of the second message participant from the preset configuration file based on the identifier of the second message participant and send the message body to the second message participant in a publish-subscribe mode according to the receiving address of the second message participant.
In this embodiment, reference may be made to the contents of the first, second and/or third embodiments in the specific expanded implementation manner of steps a 10-a 30, which is not described herein again. Compared with the prior art, the beneficial effect of the message sending method provided by the embodiment is the same as that of the message sending method provided by the first embodiment, and details are not repeated here.
EXAMPLE five
On the basis of the first, second, third, and/or fourth embodiments, a message sending method provided by the embodiments of the present invention is applied to any second message participant that needs to receive a subscription message in a plurality of message participants in a privacy computation scenario, where the privacy computation scenario further includes at least one message forwarding party, and the message sending method includes:
step B10, starting a fixed home terminal receiving port, and starting the fixed home terminal receiving port, wherein the home terminal receiving port is provided with a fixed port number;
step B20, receiving the message body published to the local terminal receiving port by the message forwarding party in the publish-subscribe mode based on the port number;
the message body is issued to the local receiving port according to a receiving address after the message forwarding party extracts the message to be forwarded;
the message to be forwarded is a message which is published to the message forwarding party by a first message participant in a publish-subscribe mode, and the message to be forwarded can only be subscribed by the message forwarding party;
the message to be forwarded further comprises a message subject, the receiving address is obtained by the message forwarding party through querying in a preset configuration file based on the identifier of the second message participant obtained by analyzing the message subject, and the receiving address comprises the port number.
The second message participant may activate at least one fixed receive port (hereinafter referred to as a home receive port, the home referring to the second message participant). And configuring the port number of the local receiving port as a receiving address of a second message participant in a configuration file of a message forwarding party in advance.
After the message forwarding party acquires the identifier of the second message participant, searching a receiving address of the second message participant corresponding to the identifier of the second message participant in the configuration file, wherein the receiving address comprises the port number of the local receiving port. And the message forwarding party publishes a message body to the local terminal receiving port in a publish-subscribe mode according to the receiving address of the second message participant. And the second message participant acquires the message main body issued by the message forwarding party by monitoring the receiving port of the home terminal. Because the message forwarding party issues the message body to the local receiving port of the second message participant in a targeted manner, the message participants except the second message participant cannot receive the message body, so that the first message participant sends the message body to the second message participant in a targeted manner in a publish-subscribe mode, and the message body is not leaked to the message participants except the second message participant.
Compared with the prior art, the beneficial effect of the message sending method provided by the embodiment is the same as that of the message sending method provided by the first embodiment, and details are not repeated here.
EXAMPLE six
The embodiment of the invention provides a message forwarding device, which is deployed in a message forwarding party in a privacy computation scene, wherein the privacy computation scene also comprises a plurality of message participants, and the message forwarding device comprises:
the first receiving module is used for receiving a message to be forwarded published by a first message participant and extracting a message theme and a message main body in the message to be forwarded, wherein the message to be forwarded is a message published by the first message participant in a publish-subscribe mode, and the message to be forwarded is subscribed only by the message forwarding party;
the analysis module is used for analyzing the message theme to obtain the identifier of a second message participant;
the searching module is used for searching and acquiring a receiving address of the second message participant from a preset configuration file based on the identifier of the second message participant;
and the first publishing module is used for publishing the message body to the second message participant in a publishing subscription mode according to the receiving address.
The message forwarding device provided by the invention solves the technical problem of message leakage risk existing in a basic publish-subscribe mode when a scene needing to be sent to some appointed subscribers by a sender in a privacy calculation scene is solved. Compared with the prior art, the beneficial effects of the message forwarding device provided by the embodiment of the present invention are the same as the beneficial effects of the message sending method provided by the first embodiment, and other technical features of the message forwarding device are the same as those disclosed by the message forwarding devices provided by the first, second, third, fourth, or fifth embodiments, and are not described herein again.
EXAMPLE seven
An embodiment of the present invention provides a message sending apparatus, where the message sending apparatus is deployed in a first message participant that needs to publish a message in a publish-subscribe mode among a plurality of message participants in a privacy computing scenario, where the privacy computing scenario further includes at least one message forwarding party, and the message sending apparatus includes:
the acquisition module is used for acquiring a message main body to be sent to a second message participant and an identifier of the second message participant;
the packaging module is used for packaging the identifier of the second message participant in a message theme and packaging the message theme and the message main body to obtain a message to be converted;
the second publishing module is used for publishing the message to be forwarded to a message forwarding party in a publishing subscription mode, wherein the message to be forwarded is only subscribed by the message forwarding party;
the message to be forwarded is used for the message forwarding party to extract the message main body and the message subject and analyze and acquire the identifier of the second message participant in the message subject;
the identifier of the second message participant is stored in a preset configuration file in a one-to-one correspondence with the receiving address of the second message participant, and the message to be forwarded is further used for the message forwarding party to search the receiving address of the second message participant from the preset configuration file based on the identifier of the second message participant and send the message body to the second message participant in a publish-subscribe mode according to the receiving address of the second message participant.
The message sending device provided by the invention solves the technical problem of message leakage risk caused by adopting a basic publish-subscribe mode when a sender needs to be sent to a plurality of appointed subscribers in a privacy calculation scene. Compared with the prior art, the beneficial effects of the message sending device provided by the embodiment of the present invention are the same as the beneficial effects of the message sending method provided by the first embodiment, and other technical features of the message sending device are the same as the features disclosed by the message sending devices provided by the first, second, third, fourth, or fifth embodiments, and are not described herein again.
Example eight
An embodiment of the present invention provides a message receiving apparatus, where the message receiving apparatus is applied to any second message participant that needs to receive a subscription message among a plurality of message participants in a privacy computing scenario, where the privacy computing scenario further includes at least one message forwarding party, and the message receiving apparatus includes:
the starting module is used for starting a fixed local receiving port, and the local receiving port is provided with a fixed port number;
a second receiving module, configured to receive, based on the port number, a message body published to the local receiving port by the message forwarder in a publish-subscribe mode;
the message body is issued to the local receiving port according to a receiving address after the message forwarding party extracts the message to be forwarded;
the message to be forwarded is a message which is published to the message forwarding party by a first message participant in a publish-subscribe mode, and the message to be forwarded can only be subscribed by the message forwarding party;
the message to be forwarded further comprises a message subject, the receiving address is obtained by the message forwarding party through querying in a preset configuration file based on the identifier of the second message participant obtained by analyzing the message subject, and the receiving address comprises the port number.
The message receiving device provided by the invention solves the technical problem of message leakage risk caused by adopting a basic publish-subscribe mode when a sender needs to be sent to a plurality of appointed subscribers in a privacy calculation scene. Compared with the prior art, the beneficial effects of the message receiving apparatus provided by the embodiment of the present invention are the same as the beneficial effects of the message sending method provided by the first embodiment, and other technical features of the message receiving apparatus are the same as the features disclosed in the message sending methods provided by the first, second, third, fourth, or fifth embodiments, and are not described herein again.
Example nine
The embodiment of the invention provides a message sending system, which comprises a message sending device, a message forwarding device and a message receiving device, wherein the message forwarding device is deployed at a message forwarding party in a privacy calculation scene, the message sending device is deployed at a first message participant which needs to publish a message in a publish-subscribe mode in any of a plurality of message participants in the privacy calculation scene, and the message receiving device is deployed at a second message participant which needs to receive a subscribe message in any of the plurality of message participants in the privacy calculation scene;
the message sending device is used for publishing the message to be forwarded of the first participant to the message forwarding device in a publish-subscribe mode, wherein the message to be forwarded is subscribed only by the message forwarding device;
the message forwarding device is used for receiving the message to be forwarded, extracting a message theme and a message main body in the message to be forwarded, and analyzing the message theme to obtain an identifier of a second message participant; the message body is used for searching and acquiring a receiving address of the second message participant from a preset configuration file based on the identifier of the second message participant and publishing the message body to the message receiving device of the second message participant in a publish-subscribe mode according to the receiving address;
the message receiving device is used for receiving the message body.
Further, in an embodiment, the message sending apparatus is further configured to obtain a message body to be sent to a second message participant and an identifier of the second message participant, encapsulate the identifier of the second message participant in a message topic, and package the message topic and the message body to obtain the message to be forwarded;
further, in an embodiment, the message receiving apparatus is further configured to start a fixed local receiving port, where the local receiving port is provided with a fixed port number, and receive the message body issued by the message forwarding apparatus to the local receiving port in an publish-subscribe mode based on the port number;
and the message forwarding device is further configured to, after finding the receiving address, issue the message body to the home terminal receiving port according to the port number included in the receiving address.
Further, in an embodiment, the message sending apparatus is further configured to encrypt a plaintext message body by using a first private key of the first message participant, and package the encrypted message body and the message subject to obtain the message to be forwarded;
the message forwarding device is further configured to receive the message to be forwarded, extract the message subject and the encrypted message body in the message to be forwarded, search a first public key corresponding to the first private key from the configuration file, and decrypt the encrypted message body by using the first public key to obtain the message body in a plaintext;
the message forwarding device is further configured to publish the message body in plain text to the message receiving device of the second message participant in a publish-subscribe mode according to the receiving address.
Further, in an embodiment, the message forwarding apparatus is further configured to:
detecting whether the message theme meets a preset message theme specification or not;
if the message theme specification is met, the operation of analyzing the message theme to obtain the identifier of a second message participant is executed;
and if the message subject specification is not met, returning error report information to the first message participant.
Further, in an embodiment, the message forwarding apparatus is further configured to:
searching a second public key of the second message participant corresponding to the identifier of the second message participant in the configuration file;
encrypting the message body in plaintext by using the second public key, and publishing the encrypted message body to the message receiving device of the second message participant in a publish-subscribe mode according to the receiving address;
the message receiving device is further configured to receive the encrypted message body, and decrypt the encrypted message body by using a second private key corresponding to the second public key to obtain the plaintext message body.
Further, in an embodiment, the message forwarding apparatus is further configured to:
starting a monitoring thread to monitor the updating state of the configuration file;
and searching the latest configuration file monitored by the monitoring thread for the receiving address of the second message participant corresponding to the identification of the second message participant.
Further, in an embodiment, the message forwarding apparatus is further configured to:
starting a fixed local receiving port;
and monitoring the local terminal receiving port to receive the message to be transferred issued to the local terminal receiving port by the message sending device of the first message participant.
Further, in an embodiment, when there are multiple message forwarders, the IP addresses of the multiple message forwarders jointly bind to a forwarder domain name, and the message forwarding apparatus is further configured to receive a to-be-forwarded message that is issued to the forwarder domain name by the message sending apparatus of the first message participant.
In the embodiments of the present invention, the same or corresponding contents as those in the first, second, third, fourth, or fifth embodiments are described with reference to the above description, and are not repeated herein.
The message sending system provided by the invention solves the technical problem of message leakage risk caused by adopting a basic publish-subscribe mode when a sender needs to be sent to a plurality of appointed subscribers in a privacy calculation scene. Compared with the prior art, the beneficial effects of the message sending system provided by the embodiment of the present invention are the same as the beneficial effects of the message sending method provided by the first embodiment, and other technical features of the message sending system are the same as those disclosed in the message sending methods provided by the first, second, third, fourth, or fifth embodiments, and are not described herein again.
Example ten
An embodiment of the present invention provides an electronic device, including: at least one processor; and a memory communicatively coupled to the at least one processor; the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the message sending method according to the first embodiment.
Referring now to FIG. 2, shown is a schematic diagram of an electronic device suitable for use in implementing embodiments of the present disclosure. The electronic devices in the embodiments of the present disclosure may include, but are not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., car navigation terminals), and the like, and fixed terminals such as digital TVs, desktop computers, and the like. The electronic device shown in fig. 2 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 2, the electronic device may include a processing apparatus (e.g., a central processing unit, a graphic processor, etc.) that may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) or a program loaded from a storage apparatus into a Random Access Memory (RAM). In the RAM, various programs and data necessary for the operation of the electronic apparatus are also stored. The processing device, the ROM, and the RAM are connected to each other by a bus. An input/output (I/O) interface is also connected to the bus.
Generally, the following systems may be connected to the I/O interface: input devices including, for example, touch screens, touch pads, keyboards, mice, image sensors, microphones, accelerometers, gyroscopes, and the like; output devices including, for example, Liquid Crystal Displays (LCDs), speakers, vibrators, and the like; storage devices including, for example, magnetic tape, hard disk, etc.; and a communication device. The communication means may allow the electronic device to communicate wirelessly or by wire with other devices to exchange data. While the figures illustrate an electronic device with various systems, it is to be understood that not all illustrated systems are required to be implemented or provided. More or fewer systems may alternatively be implemented or provided.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication means, or installed from a storage means, or installed from a ROM. The computer program, when executed by a processing device, performs the above-described functions defined in the methods of the embodiments of the present disclosure.
The electronic device provided by the invention adopts the message sending method in the first, second, third, fourth or fifth embodiment, so that the technical problem of message leakage risk existing in a basic publish-subscribe mode when a scene that one sender needs to send to a specified number of subscribers in a privacy calculation scene is solved.
Compared with the prior art, the beneficial effects of the electronic device provided by the embodiment of the present invention are the same as the beneficial effects of the message sending method provided by the first embodiment, and other technical features of the electronic device are the same as the features disclosed in the message sending methods provided by the first, second, third, fourth, or fifth embodiments, which are not described herein again.
It should be understood that portions of the present disclosure may be implemented in hardware, software, firmware, or a combination thereof. In the foregoing description of embodiments, the particular features, structures, materials, or characteristics may be combined in any suitable manner in any one or more embodiments or examples.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the appended claims.
EXAMPLE eleven
The present embodiment provides a computer-readable storage medium having computer-readable program instructions stored thereon for performing the method of message transmission in the first embodiment.
The computer readable storage medium provided by the embodiments of the present invention may be, for example, a USB flash disk, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, or device, or any combination thereof. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present embodiment, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, or device. Program code embodied on a computer readable storage medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
The computer-readable storage medium may be embodied in an electronic device; or may be present alone without being incorporated into the electronic device.
The computer readable storage medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: receiving a message to be converted published by a first message participant, and extracting a message topic and a message body in the message to be converted, wherein the message to be converted is published by the first message participant in a publish-subscribe mode, and the message to be converted is subscribed only by a message forwarder; analyzing the message theme to obtain an identifier of a second message participant; searching and acquiring a receiving address of the second message participant from a preset configuration file based on the identifier of the second message participant; and publishing the message body to the second message participant in a publish-subscribe mode according to the receiving address.
Alternatively, the computer readable storage medium carries one or more programs which, when executed by an electronic device, cause the electronic device to: acquiring a message body to be sent to a second message participant and an identifier of the second message participant; packaging the identifier of the second message participant in a message theme, and packaging the message theme and the message main body to obtain a message to be transferred; and publishing the message to be forwarded to a message forwarding party in a publish-subscribe mode, wherein the message to be forwarded is subscribed only by the message forwarding party.
Alternatively, the computer readable storage medium carries one or more programs which, when executed by an electronic device, cause the electronic device to: starting a fixed local receiving port, wherein the local receiving port is provided with a fixed port number; and receiving a message body published to the local receiving port by the message forwarder in a publish-subscribe mode based on the port number.
Computer program code for carrying out operations for aspects of the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present disclosure may be implemented by software or hardware. Wherein the names of the modules do not in some cases constitute a limitation of the unit itself.
The computer-readable storage medium provided by the invention stores the computer-readable program instruction for executing the message sending method, and solves the technical problem of message leakage risk existing in a basic publish-subscribe mode when a scene needing to be sent to some appointed subscribers by a sender in a privacy calculation scene is adopted. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the embodiment of the present invention are the same as the beneficial effects of the message sending methods provided by the first, second, third, fourth, or fifth embodiments, and are not described herein again.
The invention also provides a product, which is a computer program product comprising a computer program which, when executed by a processor, implements the steps of the message sending method as described above.
The computer program product provided by the invention solves the technical problem of message leakage risk existing in a basic publish-subscribe mode when a scene needing to be sent to some appointed subscribers by a sender in a privacy calculation scene is adopted. Compared with the prior art, the beneficial effects of the computer program product provided by the embodiment of the present invention are the same as those of the message sending method provided in the first embodiment, the second embodiment, or the third embodiment, and are not described herein again.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by the contents of the present specification and drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (13)

1. A message sending method is applied to a message forwarder in a privacy computation scenario, the privacy computation scenario further comprises a plurality of message participants, and the message sending method comprises the following steps:
receiving a message to be converted published by a first message participant, and extracting a message topic and a message body in the message to be converted, wherein the message to be converted is published by the first message participant in a publish-subscribe mode, and the message to be converted is subscribed only by a message forwarder;
analyzing the message theme to obtain an identifier of a second message participant;
searching and acquiring a receiving address of the second message participant from a preset configuration file based on the identifier of the second message participant;
and publishing the message body to the second message participant in a publish-subscribe mode according to the receiving address.
2. The method for sending messages according to claim 1, wherein the step of receiving the message to be forwarded published by the first message participant and extracting the message subject and the message body in the message to be forwarded comprises:
receiving a message to be converted issued by a first message participant, and extracting a message subject and an encrypted message main body in the message to be converted, wherein the encrypted message main body is obtained by encrypting a plaintext message main body by the first message participant by using a first private key of the first message participant;
searching a first public key corresponding to the first private key from the configuration file, and decrypting the encrypted message body by adopting the first public key to obtain the message body in a plaintext;
the step of publishing the message body to the second message participant in a publish-subscribe mode according to the receiving address comprises:
and publishing the message body in plain text to the second message participant in a publish-subscribe mode according to the receiving address.
3. The method for sending a message according to claim 1, wherein before the step of parsing the message topic to obtain the identifier of the second message participant, the method further comprises:
detecting whether the message theme meets a preset message theme specification or not;
if the message theme specification is met, the step of analyzing the message theme to obtain the identifier of a second message participant is executed;
and if the message subject specification is not met, returning error report information to the first message participant.
4. The method for sending a message according to claim 1, wherein after the step of parsing the message topic to obtain the identifier of the second message participant, the method further comprises:
searching a second public key of the second message participant corresponding to the identifier of the second message participant in the configuration file;
the step of publishing the message body to the second message participant in a publish-subscribe mode according to the receiving address comprises:
and encrypting the message main body in the plaintext by using the second public key, and publishing the encrypted message main body to the second message participant in a publish-subscribe mode according to the receiving address so that the second message participant can decrypt the message main body in the plaintext by using a second private key corresponding to the second public key.
5. The message transmission method of claim 1, wherein the message transmission method further comprises:
starting a monitoring thread to monitor the updating state of the configuration file;
the step of searching and acquiring the receiving address of the second message participant from a preset configuration file based on the identifier of the second message participant comprises:
and searching the latest configuration file monitored by the monitoring thread for the receiving address of the second message participant corresponding to the identification of the second message participant.
6. The message transmission method according to any of claims 1 to 5, characterized in that the message transmission method further comprises:
starting a fixed local receiving port;
the step of receiving the message to be forwarded issued by the first message participant comprises the following steps:
and monitoring the receiving port of the local terminal to receive the message to be converted issued by the receiving port of the local terminal from the first message participation direction.
7. The message sending method according to any one of claims 1 to 5, wherein when there are multiple message senders, the IP addresses of the multiple message senders jointly bind a forwarder domain name, and the step of receiving the message to be forwarded issued by the first message participant comprises:
and receiving a message to be forwarded issued to the domain name of the forwarding party by the first message participant.
8. A message sending method is applied to any first message participant needing to publish a message in a publish-subscribe mode in a plurality of message participants in a privacy computation scenario, and at least one message forwarding party is further included in the privacy computation scenario, and the message sending method comprises the following steps:
acquiring a message body to be sent to a second message participant and an identifier of the second message participant;
packaging the identifier of the second message participant in a message theme, and packaging the message theme and the message main body to obtain a message to be transferred;
publishing the message to be forwarded to a message forwarding party in a publish-subscribe mode, wherein the message to be forwarded is subscribed only by the message forwarding party;
the message to be forwarded is used for the message forwarding party to extract the message main body and the message subject and analyze and acquire the identifier of the second message participant in the message subject;
the identifier of the second message participant is stored in a preset configuration file in a one-to-one correspondence with the receiving address of the second message participant, and the message to be forwarded is further used for the message forwarding party to search the receiving address of the second message participant from the preset configuration file based on the identifier of the second message participant and send the message body to the second message participant in a publish-subscribe mode according to the receiving address of the second message participant.
9. A message sending method is applied to any second message participant needing to receive subscription messages in a plurality of message participants in a privacy computation scene, and at least one message forwarding party is further included in the privacy computation scene, and the message sending method comprises the following steps:
starting a fixed local receiving port, wherein the local receiving port is provided with a fixed port number;
receiving a message body published to the local receiving port by a message forwarder in a publish-subscribe mode based on the port number;
the message body is issued to the local receiving port according to a receiving address after the message forwarding party extracts the message to be forwarded;
the message to be forwarded is a message which is published to the message forwarding party by a first message participant in a publish-subscribe mode, and the message to be forwarded can only be subscribed by the message forwarding party;
the message to be forwarded further comprises a message subject, the receiving address is obtained by the message forwarding party through querying in a preset configuration file based on the identifier of the second message participant obtained by analyzing the message subject, and the receiving address comprises the port number.
10. A message sending system comprises a message sending device, a message forwarding device and a message receiving device, wherein the message forwarding device is deployed at a message forwarding party in a privacy calculation scene, the message sending device is deployed at a first message participant needing to publish a message in a publish-subscribe mode in any of a plurality of message participants in the privacy calculation scene, and the message receiving device is deployed at a second message participant needing to receive a subscribe message in any of the plurality of message participants in the privacy calculation scene;
the message sending device is used for publishing the message to be forwarded of the first participant to the message forwarding device in a publish-subscribe mode, wherein the message to be forwarded is subscribed only by the message forwarding device;
the message forwarding device is used for receiving the message to be forwarded, extracting a message theme and a message main body in the message to be forwarded, and analyzing the message theme to obtain an identifier of a second message participant; the message body is used for searching and acquiring a receiving address of the second message participant from a preset configuration file based on the identifier of the second message participant and publishing the message body to the message receiving device of the second message participant in a publish-subscribe mode according to the receiving address;
the message receiving device is used for receiving the message body.
11. An electronic device, characterized in that the electronic device comprises:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the steps of the method of any one of claims 1 to 9.
12. A readable storage medium, characterized in that the readable storage medium has stored thereon a program for implementing a message sending method, which is executed by a processor to implement the steps of the message sending method according to any one of claims 1 to 9.
13. An article of manufacture being a computer program product comprising a computer program, wherein the computer program when executed by a processor implements the steps of the message sending method according to any of claims 1 to 9.
CN202111224787.6A 2021-10-21 2021-10-21 Message sending method, system, electronic equipment, readable storage medium and product Pending CN114124454A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111224787.6A CN114124454A (en) 2021-10-21 2021-10-21 Message sending method, system, electronic equipment, readable storage medium and product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111224787.6A CN114124454A (en) 2021-10-21 2021-10-21 Message sending method, system, electronic equipment, readable storage medium and product

Publications (1)

Publication Number Publication Date
CN114124454A true CN114124454A (en) 2022-03-01

Family

ID=80376136

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111224787.6A Pending CN114124454A (en) 2021-10-21 2021-10-21 Message sending method, system, electronic equipment, readable storage medium and product

Country Status (1)

Country Link
CN (1) CN114124454A (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103534988A (en) * 2013-06-03 2014-01-22 华为技术有限公司 Publish and subscribe messaging method and apparatus
CN109981641A (en) * 2019-03-26 2019-07-05 北京邮电大学 A kind of safe distribution subscription system and distribution subscription method based on block chain technology
CN111095256A (en) * 2019-04-26 2020-05-01 阿里巴巴集团控股有限公司 Securely executing intelligent contract operations in a trusted execution environment
CN112346833A (en) * 2020-09-30 2021-02-09 深圳致星科技有限公司 Task processing method and processor for privacy computation and heterogeneous processing system
CN112953940A (en) * 2021-02-20 2021-06-11 同济大学 Safe publishing and subscribing system and method based on hybrid encryption algorithm and key attribute filtering
US20210266160A1 (en) * 2020-02-21 2021-08-26 International Business Machines Corporation Publish/subscribe messaging

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103534988A (en) * 2013-06-03 2014-01-22 华为技术有限公司 Publish and subscribe messaging method and apparatus
CN109981641A (en) * 2019-03-26 2019-07-05 北京邮电大学 A kind of safe distribution subscription system and distribution subscription method based on block chain technology
CN111095256A (en) * 2019-04-26 2020-05-01 阿里巴巴集团控股有限公司 Securely executing intelligent contract operations in a trusted execution environment
US20210266160A1 (en) * 2020-02-21 2021-08-26 International Business Machines Corporation Publish/subscribe messaging
CN112346833A (en) * 2020-09-30 2021-02-09 深圳致星科技有限公司 Task processing method and processor for privacy computation and heterogeneous processing system
CN112953940A (en) * 2021-02-20 2021-06-11 同济大学 Safe publishing and subscribing system and method based on hybrid encryption algorithm and key attribute filtering

Similar Documents

Publication Publication Date Title
CN110266480B (en) Data transmission method, device and storage medium
CN110311983B (en) Service request processing method, device and system, electronic equipment and storage medium
CN109446309B (en) Question feedback method and device
JP5870471B2 (en) Method, apparatus, and system for sharing software between terminals
US11824854B2 (en) Communication system and computer readable storage medium
CN111241559A (en) Training model protection method, device, system, equipment and computer storage medium
CN112866385B (en) Interface calling method and device, electronic equipment and storage medium
CN113254103A (en) Application function implementation method and device and storage medium
CN113434905B (en) Data transmission method and device, computer equipment and storage medium
CN111314351A (en) Anti-crawler data processing method and device, electronic equipment and storage medium
CN114124454A (en) Message sending method, system, electronic equipment, readable storage medium and product
CN116502189A (en) Software authorization method, system, device and storage medium
CN112257039B (en) Identity attribute adding method and device and electronic equipment
CN113923167A (en) Data transmission optimization method in federal learning
CN113965360A (en) Intelligent device cloud server access method, device, medium, device and system
CN111752625A (en) Method and device for interface mock
CN109962962B (en) Socket connection method and device
CN116226888B (en) Power data interactive encryption method, system and equipment based on privacy protection
CN116578427B (en) Resource device scheduling method, electronic device and computer readable medium
CN113472785B (en) Data processing method and device, electronic equipment and readable storage medium
CN111291199B (en) Information query method and device
CN111314320B (en) Communication method, terminal, server and system based on HTTP
CN114245161B (en) Live broadcast push method and device, storage medium and electronic equipment
US20210344557A1 (en) Systems, methods, and apparatuses for network management
CN113824625B (en) Information interaction method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination