WO2022022009A1 - 消息处理方法、装置、设备及存储介质 - Google Patents

消息处理方法、装置、设备及存储介质 Download PDF

Info

Publication number
WO2022022009A1
WO2022022009A1 PCT/CN2021/093918 CN2021093918W WO2022022009A1 WO 2022022009 A1 WO2022022009 A1 WO 2022022009A1 CN 2021093918 W CN2021093918 W CN 2021093918W WO 2022022009 A1 WO2022022009 A1 WO 2022022009A1
Authority
WO
WIPO (PCT)
Prior art keywords
information
message
sender
content
random number
Prior art date
Application number
PCT/CN2021/093918
Other languages
English (en)
French (fr)
Inventor
简怀兵
Original Assignee
百果园技术(新加坡)有限公司
简怀兵
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 百果园技术(新加坡)有限公司, 简怀兵 filed Critical 百果园技术(新加坡)有限公司
Publication of WO2022022009A1 publication Critical patent/WO2022022009A1/zh

Links

Images

Classifications

    • 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
    • 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

Definitions

  • the present application relates to the field of communication technologies, for example, to a message processing method, apparatus, device, and storage medium.
  • the present application provides a message processing method, apparatus, device and storage medium, which can optimize the message processing scheme.
  • a message processing method applied to the sender of the message, including:
  • the sender uses a preset encryption algorithm to encrypt the sender identifier
  • the sender identification is decrypted according to the first information.
  • a message processing device configured on the sender of the message, including:
  • a sender identification encryption module configured to encrypt the sender identification by using a preset encryption algorithm to obtain the first information
  • a message sending module configured to send a first message including the first information and the content of the first message to the server, wherein the first message is used to instruct the server to save the first information and the first message a message content, and if the preset sending conditions are met, send the first information and the first message content to the receiver corresponding to the first message for the receiver to send the first message according to the first message.
  • the information is decrypted for the sender identification.
  • a message processing device is also provided, which is configured on the server and includes:
  • a message receiving module configured to receive a first message sent by a sender that includes first information and content of the first message, wherein the first information is obtained by the sender encrypting the sender identifier by using a preset encryption algorithm;
  • a saving module configured to save the first information and the content of the first message
  • a message sending module configured to send the first information and the content of the first message to a receiver corresponding to the first message when a preset sending condition is met, so that the receiver can send the first message according to the
  • the first information decrypts the sender identifier.
  • a message processing device is also provided, which is configured on the receiver of the message, including:
  • the message receiving module is configured to receive the first information and the first message content sent by the server, wherein the first information and the first message content are included in the first message sent by the sender to the server.
  • the first information is obtained by encrypting the identifier of the sender by the sender using a preset encryption algorithm;
  • the sender identifier decryption module is configured to decrypt the sender identifier according to the first information.
  • a computer device including a memory, a processor, and a computer program stored in the memory and running on the processor, and the processor implements the above-mentioned message processing method when the processor executes the computer program.
  • a computer-readable storage medium is also provided, on which a computer program is stored, and when the program is executed by a processor, the above-mentioned message processing method is implemented.
  • FIG. 1 is a scene architecture diagram of an application scenario to which a message processing method provided by an embodiment of the present application is applicable;
  • FIG. 2 is a schematic flowchart of a message processing method provided by an embodiment of the present application.
  • FIG. 3 is a schematic flowchart of another message processing method provided by an embodiment of the present application.
  • FIG. 4 is a schematic diagram of a message interaction provided by an embodiment of the present application.
  • FIG. 5 is a schematic flowchart of a message processing method provided by an embodiment of the present application.
  • FIG. 6 is a schematic flowchart of another message processing method provided by an embodiment of the present application.
  • FIG. 7 is a schematic flowchart of another message processing method provided by an embodiment of the present application.
  • FIG. 8 is a schematic diagram of a one-to-one message interaction provided by an embodiment of the present application.
  • FIG. 9 is a schematic diagram of a group message interaction provided by an embodiment of the present application.
  • FIG. 10 is a structural block diagram of a message processing apparatus provided by an embodiment of the application.
  • FIG. 11 is a structural block diagram of another message processing apparatus provided by an embodiment of the present application.
  • FIG. 12 is a structural block diagram of another message processing apparatus provided by an embodiment of the present application.
  • FIG. 13 is a structural block diagram of a computer device provided by an embodiment of the present application.
  • FIG. 1 is a scene architecture diagram of an application scenario to which a message processing method provided by an embodiment of the present application is applicable.
  • the application scenario may include a sender 101, a server 102 and a receiver 103.
  • the sender 101 needs to send a message to the receiver 103, it first sends the message to the server 102, and then the server 102 sends the message to the receiver 103.
  • the message is sent to the recipient 103 .
  • This embodiment of the present application does not limit the type of application scenarios.
  • the types of scenarios may be instant messaging (Instant Messaging, IM) scenarios, email sending and receiving scenarios, transfer scenarios of bitcoin accounts in the blockchain, and payment application programs (Application, APP) scenarios.
  • IM Instant Messaging
  • APP payment application programs
  • the embodiment of the present application does not limit the respective physical devices corresponding to the sender 101 , the server 102 and the receiver 103 , for example, the physical devices may be mobile phones, tablet computers, desktop computers, or servers, and so on.
  • the following takes an IM scenario as an example for a schematic illustration.
  • Many applications include IM functions, such as social instant messaging APPs and live broadcast APPs, etc.
  • the messages transmitted in these applications can be timely messages between ordinary users. Communication messages, signaling of business logic, etc.
  • the basic function of the IM system is to efficiently and stably send messages from one user to another, but in many cases, the message recipient cannot receive the message in time.
  • the network is unstable, the IM system must process a large number of offline messages, and the offline messages are usually stored in the database.
  • the corresponding relationship between the sender and the receiver of the message (hereinafter referred to as the user relationship chain) is stored in the database. ), that is, the relationship between who sends to whom and who is communicating with whom. From the perspective of security and privacy, the user relationship chain should not be public, or at least disclosed to a third party under the premise of an authorization. However, when encountering a drag library (generally refers to the behavior of hackers stealing database content), the user relationship chain stored in the database is easily exposed to unauthorized third parties or criminals, and there is a great security risk.
  • a drag library generally refers to the behavior of hackers stealing database content
  • the sender of the message before sending the first message content to the server, the sender of the message encrypts the sender's identifier by using a preset encryption algorithm, so that when the first message content is stored in the server, the first message content
  • the identity of the corresponding sender is encrypted, so it can ensure that the user relationship chain of the message is kept secret, preventing exposure to malicious third parties.
  • FIG. 2 is a schematic flowchart of a message processing method provided by an embodiment of the present application.
  • the method can be executed by a message processing apparatus, wherein the apparatus can be implemented by software and/or hardware, and can generally be integrated in computer equipment, and the computer equipment has Message sending function.
  • the method includes:
  • Step 201 Encrypt the sender identifier by using a preset encryption algorithm to obtain first information.
  • the preset encryption algorithm may be a preset symmetric encryption algorithm.
  • Symmetric encryption algorithm is also known as shared key encryption algorithm or single key encryption algorithm. In a symmetric encryption algorithm, only one key is used, and both sender and receiver use this key to encrypt and decrypt data.
  • the data encryption process may be that, in a symmetric encryption algorithm, the data sender undergoes special encryption processing together with the plaintext (original data, which may be the sender's identifier in this embodiment of the present application) and the encryption key to generate a complex encrypted
  • the ciphertext (which may be the first information in this embodiment of the present application) is sent;
  • the data decryption process may be that after the data receiver receives the ciphertext, if it wants to read the original data, it needs to use the encryption key and the same
  • the inverse of the algorithm decrypts the encrypted ciphertext and restores it to readable plaintext.
  • the preset symmetric encryption algorithm may be an Advanced Encryption Standard (Advanced Encryption Standard, AES) algorithm, a Data Encryption Standard (Data Encryption Standard, DES) or triple data encryption Algorithms (Triple Data Encryption Algorithm, TDEA), etc.
  • AES Advanced Encryption Standard
  • DES Data Encryption Standard
  • TDEA Triple Data Encryption Algorithm
  • the embodiments of this application do not limit the number of digits of the encryption algorithm.
  • the number of digits of the encryption algorithm can be 128 bits, 256 bits, or 512 bits, etc., which can be set according to actual needs.
  • the default encryption algorithm is AES256.
  • the sender identification can be understood as an identifier used to represent the unique identity of the sender.
  • This embodiment of the present application does not limit the representation of the sender ID, and the representation of the sender ID may be the sender ID. Account name or sender code, etc.
  • Step 202 Send a first message including the first information and the content of the first message to the server, where the first message is used to instruct the server to save the first information and the content of the first message, and when the content of the first message is satisfied
  • the sending condition is preset, the first information and the content of the first message are sent to the receiver corresponding to the first message, so that the receiver can decrypt the identifier of the sender according to the first information.
  • the embodiment of the present application does not limit the communication protocol adopted between the sender and the server, for example, the communication protocol may be a Hyper Text Transfer Protocol (Hyper Text Transfer Protocol over SecureSocket Layer, HTTPS) or other protocol.
  • HTTPS Hyper Text Transfer Protocol
  • This embodiment of the present application does not limit the structure of the first message, and the structure of the first message may be set according to the communication protocol used, and may also be set differently for the same communication protocol.
  • the message sent by the sender to the server does not contain the first information, and the message in the related art may be referred to as the original message.
  • the communication protocol is determined, in this embodiment of the present application, the first information may be added on the basis of the original message.
  • the embodiment of the present application does not limit the location where the first information is added, and the first information may be added inside the original message, such as the message body can also be added to the outside of the original message, and after the addition is completed, the first message in the embodiment of the present application is obtained.
  • the first message may be any message sent by the sender to the receiver, and the content of the first message is not limited in this embodiment of the present application.
  • This embodiment of the present application does not limit the number of recipients, and the number of recipients may be one or more.
  • a certain encryption algorithm may also be used for encryption, so as to ensure the security of the content of the message.
  • the first message may further include a receiver identifier, so that the server can determine the receiver corresponding to the first message according to the receiver identifier.
  • the receiver identifier corresponding to the first message can also be sent independently of the first message, and the correspondence between the first message and the receiver can be sent to the server, for example, the correspondence between the message ID of the first message and the receiver ID can be sent relation.
  • the server may always store the first information and the first message content.
  • the receiver identifier, message content and sender identifier are stored in the database of the server, and the message content and the sender identifier are sent to the receiver together, so that the receiver can know the source of the message content.
  • the identifier of the sender is not stored, and the first information may be stored at the location where the identifier of the sender was originally stored, or an additional field may be added to store the first information.
  • the preset sending conditions can be set according to actual needs, for example, it can be sent immediately after receiving the first message, it can be sent after relevant verification is performed after receiving the first message, or it can be sent after the first message is received. After receiving the first message, first determine whether the receiver is online or whether the network condition of the receiver is appropriate, and then determine whether to send or not.
  • This embodiment of the present application does not limit the execution order of the steps of saving and sending the first information and the content of the first message, which may be set according to actual conditions.
  • the server may also send other content at the same time, which is not limited in this embodiment of the present application.
  • the server may generate the second message according to the first information and the content of the first message, and send the second message to the receiver.
  • the receiver can use the inverse algorithm corresponding to the preset encryption algorithm and the corresponding key to decrypt the first information.
  • the sender identifier corresponding to the first message can be obtained, that is, the sender identity of the first message can be obtained.
  • the sender and receiver of the message may negotiate a shared key in advance, or may include decryption information in the first information, and the decryption information may help the receiver determine the key used to decrypt the first information according to the information it already knows. .
  • operations such as reporting an error may be performed, which is not limited in this embodiment of the present application.
  • the receiver After receiving the content of the first message, if the content of the first message is encrypted, the receiver can decrypt the content of the first message, and if the decryption is successful, the content of the message that the sender really wants to send can be obtained. If the content of the first message is not encrypted, the subsequent process may be performed according to the sender identifier and the content of the first message.
  • the sender of the message before sending the message to the server, the sender of the message encrypts the identifier of the sender with a preset encryption algorithm to obtain the first information, and then sends the first information to the server. and the first message of the first message content, the first message is used to instruct the server to save the first information and the first message content, and when the preset sending conditions are met, send the first information and the first message content to the first message.
  • the receiver corresponding to the message is for the receiver to decrypt the identifier of the sender according to the first information, so as to obtain the identity of the sender of the first message.
  • the identity of the sender corresponding to the content of the first message is encrypted, and only the real receiver of the message can decrypt it.
  • the relationship chain between the two communication parties of the message is guaranteed to be kept secret to prevent exposure to malicious third parties.
  • the method further includes: signing the first information with the private key of the sender to obtain the second information ; determine first attribute information according to the first information and the second information.
  • the sending the first message including the first information and the first message content to the server includes: sending the first message including the first attribute information and the first message content to the server.
  • the first message is used to instruct the server to save the first information and the first message content, and when the preset sending conditions are met, send the first information and the first message content to the
  • the receiver corresponding to the first message is for the receiver to decrypt the identifier of the sender according to the first information, including: the first message is used to instruct the server to decipher the sender according to the public key of the sender.
  • the second information is used for signature verification, the first attribute information and the first message content are saved after the signature verification is successful, and when the preset sending conditions are met, the first attribute information and the first message are stored.
  • the content is sent to the receiver corresponding to the first message, so that the receiver can decrypt the identifier of the sender according to the first information and decrypt the second information according to the public key of the sender obtained after decryption is successful.
  • Checkout The advantage of this setting is that it can support the server to verify whether the sender of the first message has been tampered with, and ensure the accuracy and security of message communication.
  • the sender uses its own private key to sign the first information, obtains the second information, and sends the first information and the second information together as the first attribute information to the server
  • the server can learn the identity of the sender from the first message (for example, the sender ID may be included in the protocol header of the first message), and then query the corresponding sender's public key, and use the public key to verify the signature of the second information, If the first information can be successfully verified and signed out, it can indicate that the first message is indeed sent by the sender. If the information obtained after verification is inconsistent with the first information, it can indicate that someone may pretend to be the sender to send the first message. In order to achieve the effect of effectively identifying the attack behavior.
  • the receiver is a single user
  • the use of a preset encryption algorithm to encrypt the identifier of the sender to obtain the first information includes: generating a first random number and a first random key pair; using a preset encryption algorithm
  • the key agreement protocol generates a first public key based on the first private key in the first random key pair and the public key of the recipient; the first random number, The first public key and the sender identifier are encrypted to obtain encrypted sender information; according to the first random number, the first public key in the first random key pair, and the encrypted sender information, Determine the first information.
  • the advantage of this setting is that, for a one-to-one message communication scenario, a public key that can be deduced by the sender and the receiver can be generated by means of a preset key agreement protocol, so as to improve the encryption level of the first information, so as to ensure the transmission security of party identification.
  • the number of bits of the first random number can be set freely, for example, 16 bytes.
  • the first random key pair is randomly generated, and can only be used for the message sent this time to ensure security.
  • the preset key agreement protocol may be, for example, an Elliptic Curves Diffie-Hellman (ECDH) protocol, and an asynchronous public key agreement algorithm in the ECDH protocol may be used based on the first private key in the first random key pair and the recipient's public key to generate the first public key.
  • ECDH Elliptic Curves Diffie-Hellman
  • the receiver After receiving the first information including the first random number, the first public key and the encrypted sender information, the receiver can also use the asynchronous public key agreement algorithm based on the first public key in the first random key pair and its own If there is no abnormality in the intermediate process, the second public key should be the same as the first public key, then the receiver can continue to use the first random number and the second public key for The encrypted sender information is decrypted to obtain the sender identity.
  • the first random number, the first public key and the sender identifier are encrypted by using a first preset encryption algorithm to obtain encrypted sender information, and a preset hash algorithm is used to calculate the first hash value corresponding to the first public key; encrypting the first random number, the first hash value and the sender identifier by using a first preset encryption algorithm to obtain encrypted sender information.
  • the preset hash algorithm may be a secure hash algorithm (Secure Hash Algorithm, SHA), also known as a secure hash algorithm.
  • SHA Secure Hash Algorithm
  • the SHA may be SHA256 or the like.
  • the receiver is a group user
  • the use of a preset encryption algorithm to encrypt the identifier of the sender to obtain the first information includes: generating a second random number; The second random number, the group password corresponding to the group user, and the sender identifier are encrypted to obtain encrypted sender information; the first information is determined according to the second random number and the encrypted sender information.
  • the second preset encryption algorithm may be the same as or different from the first preset encryption algorithm.
  • the group password in this embodiment of the present application may be a group entry password, or a newly added encrypted password dedicated to group message sending.
  • the group password is not known to the rest of the group, so the password can be used as a public key for encryption and decryption.
  • the group password can be fixed, but it can also be changed in some cases, such as when the members change (such as adding new members or existing members who have left the group), or in order to avoid being cracked, it can be changed regularly. After the group password is changed, all current members in the group can be notified.
  • the method further includes: generating a third random number; and signing the third random number with the private key of the sender to obtain the second attribute information.
  • the sending the first message including the first attribute information and the content of the first message to the server includes: sending to the server the first message including the first attribute information, the second attribute information and the first message Content first message.
  • the second attribute information is added to facilitate the server to verify the initiator of the retracted message and prevent other members' messages from being retracted by impersonation. situation happens.
  • the method further includes: after detecting that the first message is targeted for the first message When the withdrawal event is triggered, a fourth random number is generated; the fourth random number, the group password and the sender identification are encrypted by using the second preset encryption algorithm to obtain new encrypted sender information ; According to the fourth random number and the new encrypted sender information, determine the third information; use the private key of the sender to sign the third information to obtain the fourth information; According to the third information and the fourth information to determine third attribute information; send to the server a first retraction message for the first message that includes the third attribute information and the third random number, the first retraction message It is used to instruct the server to verify the signature of the fourth information according to the public key of the sender, and to verify the signature of the second attribute information after the signature verification is successful.
  • the second retraction message for the first message containing the third attribute information is sent to the receiver corresponding to the first message for the receiver Perform the corresponding message recall action.
  • the server verifies the signature of the third attribute information according to the sender's public key, and can verify whether the initiator of the retracted message is indeed the current sender. If the signature verification fails, it indicates that there may be an attack. Continue to verify whether the original sender of the message to be withdrawn is the initiator of the withdrawn message. If the verification is successful, you can continue the follow-up message withdrawal related process. If the verification fails, it means that there may be an impostor and malicious withdrawal, and you can not enter the follow-up. message recall process.
  • FIG. 3 is a schematic flowchart of another message processing method provided by an embodiment of the present application, and the method can be applied to a message sender in a one-to-one message communication scenario in an IM system.
  • Fig. 4 is a schematic diagram of a message interaction provided by an embodiment of the present application.
  • Fig. 4 includes user A and user C.
  • User A's private key and public key pair can be denoted as (c a , C a ), and sender A passes the The network is connected to one or more IM servers (Servers).
  • the IM Server can be responsible for persistently writing messages to the database.
  • User C's private key and public key pair can be recorded as (c c , C c ).
  • Figure 4 takes user A sending a message to user C as an example to illustrate how the user relationship chain "A is communicating with C" will not be leaked even when the database is dragged to the database.
  • the method may include:
  • Step 301 Generate a first random number and a first random key pair.
  • the first random number can be a random number with a length of 16 bytes, which can be recorded as IV; the first random key pair can be regarded as a temporary key pair (key pair) for this message sending operation, and can be recorded as IV.
  • IV is (r, R), where r is the first private key and R is the first public key.
  • Step 302 using a preset key agreement protocol to generate a first public key based on the first private key in the first random key pair and the recipient's public key.
  • the preset key agreement protocol may be an ECDH protocol, and the first public key is obtained in the following manner:
  • P is the first public key.
  • Step 303 Calculate a first hash value corresponding to the first public key by using a preset hash algorithm.
  • the preset hash algorithm is SHA256
  • the first hash value corresponding to the first public key is obtained in the following manner:
  • H is the first hash value.
  • Step 304 Encrypt the first random number, the first hash value and the sender identifier by using the first preset symmetric encryption algorithm to obtain encrypted sender information.
  • the first preset symmetric encryption algorithm is AES256
  • the encrypted sender information is obtained in the following manner:
  • source is used to represent the sender identifier (such as the ID of user A), and source' is used to represent encrypted sender information.
  • Step 305 Determine the first information according to the first random number, the first public key in the first random key pair, and the encrypted sender information.
  • the first information may be recorded as payload (payload).
  • payload can be expressed as:
  • the "+” in the embodiment of the present application does not represent the addition in the operation symbol, but is used to represent the parallel relationship of items, for example, the payload includes several parallel items such as IV, R, and source'.
  • Step 306 Sign the first information with the private key of the sender to obtain the second information.
  • the ca signature payload is used to obtain the second information, and the second information may be denoted as S.
  • Step 307 Determine the first attribute information according to the first information and the second information.
  • Step 308 Send a first message containing the first information and the content of the first message to the server, where the first message is used to instruct the server to verify the signature of the second information according to the public key of the sender, and save the first message after the verification is successful.
  • attribute information and the content of the first message and when the preset sending conditions are met, the first attribute information and the content of the first message are sent to the receiver corresponding to the first message, so that the receiver can identify the sender according to the first information. Decrypt and verify the signature of the second information according to the decrypted public key of the sender after successful decryption.
  • the sender of the message before sending a message to the server, the sender of the message first generates a public key by using a preset key agreement protocol, and calculates the hash of the public key value, use a preset encryption algorithm to encrypt the random number, hash value and sender identification to obtain encrypted sender information, and then determine the first information according to the random number, the public key in the random key pair and the encrypted sender information, Sign the first message with its own private key to obtain the second message, and then send the first message including the first message, the second message and the content of the first message to the server.
  • the identity of the sender can be verified first, and after success, the first information, the second information, and the content of the first message can be saved, and when the preset sending conditions are met, the saved content can be sent to the receiver corresponding to the first message.
  • the party performs decryption of the sender's identity and signature verification of the sender's identity, respectively.
  • FIG. 5 is a schematic flowchart of a message processing method provided by an embodiment of the present application. As shown in FIG. 5 , the method can be applied to a message sender in a group message communication scenario in an IM system. Also taking FIG. 4 as an example, it is assumed that user A is a user in the communication group, user C is a user other than user A in the communication group, and the communication group may also include other users, such as user B, user D Etc., not shown in FIG. 4 , when user A sends a message in the communication group, other users in the communication group are all recipients, and user C is used as an example for description below.
  • the method may include:
  • Step 501 Generate a second random number.
  • the second random number may be a random number with a length of 16 bytes, and may also be recorded as IV.
  • Step 502 Encrypt the second random number, the group password corresponding to the group user, and the sender identifier by using the second preset symmetric encryption algorithm to obtain encrypted sender information.
  • the second preset symmetric encryption algorithm is AES256
  • the encrypted sender information is obtained in the following manner:
  • source' AES256(IV, group cipher, source)
  • source is used to represent the sender identifier (such as the ID of user A), and source' is used to represent encrypted sender information.
  • Step 503 Determine the first information according to the second random number and the encrypted sender information.
  • the first information may be recorded as payload (payload).
  • payload can be expressed as:
  • Step 504 Sign the first information with the private key of the sender to obtain the second information.
  • the ca signature payload is used to obtain the second information, and the second information may be denoted as S.
  • Step 505 Determine the first attribute information according to the first information and the second information.
  • Step 506 Generate a third random number.
  • the third random number may be a random number with a length of 16 bytes, which may be denoted as IIV. After the third random number is generated, the client needs to save it and apply it to the subsequent message recall process.
  • Step 507 Sign the third random number with the private key of the sender to obtain the second attribute information.
  • the ca signature IIV is used to obtain the second attribute information, and the second attribute information may be denoted as v.
  • Step 508 Send a first message including the first attribute information, the second attribute information and the content of the first message to the server.
  • the first message is used to instruct the server to verify the signature of the second information according to the public key of the sender, save the first attribute information, the content of the first message and the second attribute information after the signature verification is successful, and
  • the sending conditions are preset, the first attribute information and the content of the first message are sent to the receiver corresponding to the first message, so that the receiver can decrypt the identifier of the sender according to the first information and obtain the sender's identity according to the decryption after successful decryption. verifies the second information with the public key.
  • Step 509 generating a fourth random number when it is detected that a withdrawal event for the first message is triggered.
  • the fourth random number may be a random number with a length of 16 bytes, and may also be recorded as IV.
  • a withdrawal event can be initiated, for example, a withdrawal button corresponding to the first message can be triggered.
  • the retraction event of the first message is triggered, and a fourth random number is generated.
  • Step 510 Encrypt the fourth random number, the group password and the sender identifier by using the second preset symmetric encryption algorithm to obtain new encrypted sender information.
  • source' AES256(IV, group cipher, source)
  • Step 511 Determine the third information according to the fourth random number and the new encrypted sender information.
  • Step 512 Sign the third information with the private key of the sender to obtain the fourth information.
  • the fourth information is obtained, and the fourth information may be denoted as S.
  • Step 513 Determine third attribute information according to the third information and the fourth information.
  • Step 514 Send a first withdraw message for the first message that includes the third attribute information and the third random number to the server.
  • the first revocation message is used to instruct the server to verify the signature of the fourth information according to the public key of the sender, and to verify the signature of the second attribute information after the signature verification is successful. If the third random number carried in the message is the same, a second retraction message for the first message containing the third attribute information is sent to the receiver corresponding to the first message for the receiver to perform a corresponding message retraction operation.
  • a group ID (gid) and a message ID (mid) may be included in the retract message, and the group ID (gid) and the message ID (mid) are used to indicate which message in which group is to be retracted.
  • the first retraction message contains the gid of the communication group where the sender is located, and the mid of the first message.
  • the sender of the message uses the group password as the public key before sending the message to the server, and uses a preset symmetric encryption algorithm to encrypt the random number, the group password and the sending.
  • the first information is determined according to the random number and the encrypted sender information, and the first information is signed with its own private key, and the second information is obtained, and the first information and the second information are obtained. It is determined as the first attribute information, and then the random number is signed to obtain the second attribute information, which is used for subsequent message withdrawal verification.
  • the server After receiving the first message, the server can first verify the identity of the sender, and save the first attribute after success. information, the second attribute information and the first message content, and when the preset sending conditions are met, the first attribute information and the first message content are sent to other members in the group, and other members can The decryption of the sender's identity and the verification of the sender's identity are carried out respectively.
  • the sender When the sender initiates the message withdrawal process, it regenerates new encrypted sending information, determines the third information, and after signing the third information, obtains the fourth information, and uses the third information and the fourth information as the third attribute information
  • the third random number saved when the first message was sent before is sent to the server, and the server can know whether the initiator of the withdrawal operation has been impersonated by verifying the fourth information.
  • FIG. 6 is a schematic flowchart of another message processing method provided by an embodiment of the present application.
  • the method may be executed by a message processing apparatus, where the apparatus may be implemented by software and/or hardware, and may generally be integrated in computer equipment such as a server. As shown in Figure 6, the method includes:
  • Step 601 Receive a first message including first information and first message content sent by a sender, wherein the first information is obtained by the sender encrypting a sender identifier by using a preset encryption algorithm.
  • the server can obtain the sender identifier (uid) from the protocol header (https header), and then learn the sender's identity, but in the embodiment of this application, the service The sender does not store the sender identity.
  • Step 602 Save the first information and the content of the first message.
  • the server does not store the identity information of the sender, but only stores the encrypted identifier of the sender and the content of the message that the sender wants to send.
  • Step 603 When the preset sending conditions are met, send the first information and the content of the first message to the receiver corresponding to the first message, so that the receiver sends according to the first information Decryption of party IDs.
  • the server receives the first message sent by the message sender, the first message includes the first information and the first message content, and the first information is sent by the sender using a preset encryption algorithm.
  • the identification is encrypted, and only the real message receiver can decrypt it. Therefore, the first information will not be cracked by others during the storage period of the server, which can ensure the normal message communication between the two parties and the relationship chain between the two parties. are kept confidential to prevent exposure to malicious third parties.
  • the receiving the first message sent by the sender and including the first information and the first message content includes: receiving the first message sent by the sender and including the first attribute information and the first message content, wherein , the first attribute information is determined by the sender according to the first information and the second information, and the second information is signed by the sender using the sender's private key to sign the first information get.
  • the saving of the first information and the content of the first message includes: verifying the second information according to the public key of the sender, and after the signature verification is successful, saving the first attribute information and the first message content.
  • the sending the first information and the content of the first message to a receiver corresponding to the first message, so that the receiver can decrypt the identifier of the sender according to the first information includes:
  • the first attribute information and the content of the first message are sent to the receiver corresponding to the first message, so that the receiver can decrypt the sender's identity according to the first information and obtain the decryption according to the decryption after successful decryption.
  • the sender's public key is used to verify the signature of the second information in the first attribute information.
  • the recipient is a group user
  • the receiving a first message sent by the sender that includes the first attribute information and the content of the first message includes: receiving a message sent by the sender that includes the first attribute information, the second message attribute information and the first message of the first message content, wherein the second attribute information is obtained by the sender using the sender's private key to sign a third random number, and the third random number is obtained by the sender generated by the sender.
  • the method further includes: saving the second attribute information.
  • two fields may be added to the database of the server, which are respectively used to store the first attribute information and the second attribute information.
  • the first attribute information can be recorded as extra
  • the second attribute information can be recorded as v.
  • a "ciphertext source” field can be added to the database to store extra.
  • This field can also be named extra, and "verifySig” can be added. field is used to store v.
  • the above names are only examples and can be set according to the actual situation. Among them, the names extra and verifySig can improve security and privacy protection, and avoid easily exposing the use of this ciphertext data.
  • the method further includes: receiving a first message for the first message that includes the third attribute information and the third random number and is sent by the sender.
  • a withdrawal message wherein the third attribute information is determined by third information and fourth information, the third information is determined by the sender according to a fourth random number and new encrypted sender information, the fourth random number The number is generated by the sender, and the new encrypted sender information is obtained by the sender encrypting the fourth random number, the group password and the sender ID by using the second preset encryption algorithm,
  • the fourth information is obtained by the sender signing the third information using the sender's private key; the fourth information is signed according to the sender's public key, and the signature is verified.
  • FIG. 7 is a schematic flowchart of another message processing method provided by an embodiment of the present application.
  • the method may be executed by a message processing apparatus, wherein the apparatus may be implemented by software and/or hardware, and may generally be integrated in computer equipment.
  • Step 701 Receive first information and first message content sent by a server, wherein the first information and the first message content are included in the first message sent by the sender to the server, and the first message The information is obtained by encrypting the identifier of the sender by the sender using a preset encryption algorithm.
  • Step 702 Decrypt the sender identifier according to the first information.
  • the receiver receives the first information and the first message content sent by the message sender and forwarded by the server, and the first information is encrypted by the sender using a preset encryption algorithm. Therefore, the first information will not be cracked by others during the storage period of the server, which ensures that the relationship chain between the two communication parties of the message is kept secret and prevents exposure to malicious third parties.
  • an accurate message sender can be obtained, and subsequent operations can be performed according to the message sender and the content of the first message to ensure the accuracy and security of communication between the two parties.
  • the receiving the first information and the first message content sent by the server includes: receiving the first attribute information and the first message content sent by the server, wherein the first attribute information is included in the in the first message, and determined by the sender according to the first information and the second information, the second information is signed by the sender using the sender's private key to the first message get.
  • the method further includes: if the decryption is successful, obtaining the public key of the corresponding sender according to the identifier of the sender obtained by decryption; The second information is verified.
  • the receiver is a single user
  • the first information includes a first random number, a first public key in a first random key pair, and encrypted sender information
  • the first random number and the first random key pair are generated by the sender
  • the encrypted sender information is encrypted by the sender using a first preset encryption algorithm to the first random number, the first public key and the sender.
  • the identifier is encrypted to obtain the first public key
  • the first public key is generated by the sender using a preset key agreement protocol based on the first private key in the first random key pair and the recipient's public key.
  • the decrypting the identifier of the sender according to the first information includes: generating by using the preset key agreement protocol based on the private key of the receiver and the first public key in the first random key pair second public key; decrypting the sender identification for the encrypted sender information according to the second public key and the first random number.
  • the encrypted sender information is encrypted by the sender using a first preset encryption algorithm to encrypt the first random number, the first hash value corresponding to the first public key, and the sender identifier Obtaining; the decrypting the sender identifier for the encrypted sender information according to the second public key and the first random number includes: using a preset hash algorithm to calculate the corresponding correspondence of the second public key The second hash value of the encrypted sender information is decrypted according to the second hash value and the first random number for the encrypted sender information.
  • the advantage of this setting is that it matches the calculation method of the sender's public key. After hash operation, the length of the public key can be fixed, reducing the complexity of subsequent operations.
  • the receiver C can read the first information payload from the first attribute information, and obtain the first random numbers IV and R therein. If the payload also includes version, the receiver C can first The own version information is compared with the obtained version. If the receiver C's own version information is inconsistent with the obtained version, the corresponding version adaptation operation is performed according to the preset compatibility policy. Then, ECDH can be used to calculate the second public key P based on cc and R, namely ECDH: ( c c , R) ⁇ P.
  • An error can be reported if decryption fails.
  • the corresponding public key C a can be queried according to the decrypted source, and the signature of the second information S can be verified using C a . If the signature verification result is consistent with the first information payload, the authenticity of the first message can be proved.
  • the sender is A, that is, the signature verification is successful, and the follow-up process can be entered. If the signature verification fails, operations such as error reporting can be performed.
  • the receiver is a group user
  • the first information includes a second random number and encrypted sender information
  • the second random number is generated by the sender
  • the encrypted sender information is The sender encrypts the second random number, the group password corresponding to the group user, and the sender identifier by using a second preset encryption algorithm; the decryption of the sender identifier is performed according to the first information. , including: decrypting the sender identity for the encrypted sender information according to the second random number and the group password.
  • receiver C can read the first information payload from the first attribute information, and obtain the first random number IV in it. If the payload also includes version, the receiver C's own The version information is compared with the acquired version. If the receiver C's own version information is inconsistent with the acquired version, a corresponding version adaptation operation is performed according to the preset compatibility policy. Then, the source' is decrypted using the first random number IV and the group cipher to obtain the source. An error can be reported if decryption fails. If the decryption is successful, the corresponding public key C a can be queried according to the decrypted source, and the signature of the second information S can be verified using C a .
  • the authenticity of the first message can be proved.
  • the sender is A, that is, the signature verification is successful, and the follow-up process can be entered. If the signature verification fails, operations such as error reporting can be performed. Other receivers in the group can similarly perform the above operations, which are not repeated here.
  • the method further includes: receiving a message including the third attribute information sent by the server.
  • the second retraction message for the first message wherein the third attribute information is included in the first retraction message for the first message sent by the sender to the server, and the third attribute information
  • the information is determined by third information and fourth information, the third information is determined by the sender according to a fourth random number and the new encrypted sender information, the fourth random number is generated by the sender, the The new encrypted sender information is obtained by the sender encrypting the fourth random number, the group password and the sender identifier by using the second preset encryption algorithm, and the fourth information is obtained by the sender
  • the third information is obtained by signing the private key of the sender; according to the fourth random number and the group password, the sender identification is decrypted for the new encrypted sender information; if the decryption is successful, Then, obtain the public
  • the receiver after receiving the second withdrawal message sent by the server, the receiver reads the third attribute information extra, and then obtains the third information payload therein, and obtains the fourth random number IV therein, Use the fourth random number IV and the group password to decrypt the new encrypted sender information source'. If the decryption fails, an error can be reported. If the decryption succeeds, the sender identifier source can be obtained, and the corresponding sender identifier source can be obtained according to the decrypted sender identifier source.
  • the party's public key C a according to the obtained public key C a to verify the signature of the fourth information S, if the signature verification is successful, a corresponding withdrawal operation can be performed for the first message, such as removing the first message from the group conversation removed from the interface.
  • FIG. 8 is a schematic diagram of a one-to-one message interaction provided by an embodiment of the present application. As shown in FIG. 8 , the interaction process may include:
  • Step 801 The sender encrypts the sender identifier by using a preset encryption algorithm to obtain first information.
  • Step 802 The sender signs the first information with the sender's private key to obtain the second information, and determines the first attribute information according to the first information and the second information.
  • Step 803 The sender sends a first message including the first attribute information and the content of the first message to the server.
  • Step 804 The server verifies the signature of the second information according to the public key of the sender, and saves the first attribute information and the content of the first message after the signature verification is successful.
  • Step 805 The server sends the first attribute information and the first message content to the receiver when the preset sending condition is satisfied.
  • Step 806 The receiver decrypts the sender's identity according to the first information, and if the decryption is successful, obtains the corresponding sender's public key according to the decrypted sender's identity, and verifies the signature of the second information according to the obtained public key. .
  • FIG. 9 is a schematic diagram of a group message interaction provided by an embodiment of the present application. As shown in FIG. 9 , the interaction process may include:
  • Step 901 The sender encrypts the sender identifier by using a preset encryption algorithm to obtain first information.
  • Step 902 The sender signs the first information with the sender's private key to obtain the second information, and determines the first attribute information according to the first information and the second information.
  • Step 903 The sender signs the third random number with the sender's private key, obtains second attribute information, and saves the third random number.
  • Step 904 The sender sends a first message including the first attribute information, the second attribute information and the content of the first message to the server.
  • Step 905 The server verifies the signature of the second information according to the public key of the sender, and saves the first attribute information, the second attribute information and the content of the first message after the signature verification is successful.
  • Step 906 When the preset sending condition is met, the server sends the first attribute information and the first message content to the receiver.
  • Step 907 The receiver decrypts the sender's identity according to the first information, and if the decryption is successful, obtains the corresponding sender's public key according to the decrypted sender's identity, and verifies the signature of the second information according to the obtained public key. .
  • Step 908 when the sender detects that the recall event for the first message is triggered, the sender uses a preset encryption algorithm to encrypt the sender identifier to obtain third information.
  • Step 909 The sender signs the third information with the sender's private key to obtain fourth information, and determines the third attribute information according to the third information and the fourth information.
  • Step 910 The sender sends a first retraction message for the first message that includes the third attribute information and the third random number to the server.
  • Step 911 the server verifies the signature of the fourth information according to the public key of the sender, and verifies the signature of the second attribute information after the signature verification is successful.
  • Step 912 The server determines that the signature verification result is consistent with the random number carried in the first retraction message, and sends a second retraction message for the first message that includes the third attribute information to the recipient.
  • Step 913 The receiver decrypts the sender's identity according to the third information, and if the decryption is successful, obtains the corresponding sender's public key according to the decrypted sender's identity, and verifies the fourth information according to the obtained public key. , if the signature verification is successful, a corresponding withdrawal operation is performed for the first message.
  • FIG. 10 is a structural block diagram of a message processing apparatus provided by an embodiment of the application.
  • the apparatus can be implemented by software and/or hardware, and can generally be integrated in a computer device serving as a message sender.
  • Message processing methods can be executed by executing a message processing method. send processing.
  • the device includes:
  • the sender of the message before sending the message to the server, the sender of the message encrypts the identifier of the sender with a preset encryption algorithm to obtain the first information, and then sends the first information and the message to the server to the server.
  • the first message of the first message content The first message is used to instruct the server to save the first information and the first message content, and send the first information and the first message content to the first message when the preset sending conditions are met.
  • the corresponding receiver is used for the receiver to decrypt the identifier of the sender according to the first information, so as to obtain the identity of the sender of the first message.
  • the identity of the sender corresponding to the content of the first message is encrypted, and only the real receiver of the message can decrypt it.
  • the relationship chain between the two communication parties of the message is guaranteed to be kept secret to prevent exposure to malicious third parties.
  • FIG. 11 is a structural block diagram of another message processing apparatus provided by an embodiment of the application.
  • the apparatus can be implemented by software and/or hardware, and can generally be integrated in computer equipment such as a server, and can perform message forwarding by executing a message processing method. deal with.
  • the device includes:
  • the first message receiving module 1101 is configured to receive a first message sent by a sender that includes first information and content of a first message, wherein the first information is performed by the sender using a preset encryption algorithm to identify the sender.
  • the saving module 1102 is configured to save the first information and the content of the first message; the second message sending module 1103 is configured to save the first information and the first message when the preset sending conditions are met.
  • a message content is sent to the receiver corresponding to the first message, so that the receiver can decrypt the sender identifier according to the first information.
  • the server receives the first message sent by the message sender, the first message includes first information and the content of the first message, and the first information is sent by the sender using a preset encryption algorithm.
  • the logo is encrypted, and only the real message receiver can decrypt it. Therefore, the first information will not be cracked by others during the storage period of the server, which can ensure the normal message communication between the two parties and the relationship chain between the two parties. are kept confidential to prevent exposure to malicious third parties.
  • the second message receiving module 1201 is configured to receive first information and first message content sent by the server, wherein the first information and the first message content are included in the first message sent by the sender to the server , the first information is obtained by encrypting the sender identifier by the sender using a preset encryption algorithm; the sender identifier decryption module 1202 is configured to decrypt the sender identifier according to the first information.
  • the receiver receives the first information and the first message content sent by the message sender and forwarded by the server, and the first information is encrypted by the sender using a preset encryption algorithm. Therefore, the first information will not be cracked by others during the storage period of the server, which ensures that the relationship chain between the two communication parties of the message is kept secret and prevents exposure to malicious third parties.
  • an accurate message sender can be obtained, and subsequent operations can be performed according to the message sender and the content of the first message to ensure the accuracy and security of communication between the two parties.
  • Fig. 13 is a structural block diagram of a computer device provided by an embodiment of the present application.
  • the computer device 1300 includes a memory 1301, a processor 1302, and a computer program stored in the memory 1301 and executable on the processor 1302. When the processor 1302 executes the computer program, the message processing method provided by the embodiments of the present application is implemented.
  • the embodiments of the present application further provide a storage medium containing computer-executable instructions, where the computer-executable instructions are used to execute the message processing method provided by the embodiments of the present application when executed by a computer processor.
  • the message processing apparatus, device, and storage medium provided in the above embodiments can execute the message processing method provided by any embodiment of the present application, and have corresponding functional modules and beneficial effects for executing the method.
  • the message processing method provided by any embodiment of the present application can execute the message processing method provided by any embodiment of the present application, and have corresponding functional modules and beneficial effects for executing the method.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Medical Informatics (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

本文公开了消息处理方法、装置、设备及存储介质。消息处理方法包括:利用预设加密算法对发送方标识进行加密,得到第一信息,向服务端发送包含第一信息和第一消息内容的第一消息,其中,第一消息用于指示服务端保存第一信息和第一消息内容,并在满足预设发送条件的情况下,将第一信息和第一消息内容发送至第一消息对应的接收方,供接收方根据第一信息进行发送方标识的解密。

Description

消息处理方法、装置、设备及存储介质
本申请要求在2020年07月28日提交中国专利局、申请号为202010737744.7的中国专利申请的优先权,该申请的全部内容通过引用结合在本申请中。
技术领域
本申请涉及通信技术领域,例如涉及消息处理方法、装置、设备及存储介质。
背景技术
随着通信技术及互联网技术的快速发展,人与人之间的基于网络的信息交互越来越频繁,交互场景也越来越丰富。交互***的基础功能是将消息从一个用户发送给另一个用户,大多交互***基本能够保证高效稳定地进行消息的发送,但交互***中的安全性和保护用户隐私的方案仍不够完善,需要改进。
发明内容
本申请提供了消息处理方法、装置、设备及存储介质,可以优化消息处理方案。
提供了一种消息处理方法,应用于消息的发送方,包括:
利用预设加密算法对发送方标识进行加密,得到第一信息;
向服务端发送包含所述第一信息和第一消息内容的第一消息,其中,所述第一消息用于指示所述服务端保存所述第一信息和所述第一消息内容,并在满足预设发送条件的情况下,将所述第一信息和所述第一消息内容发送至所述第一消息对应的接收方,供所述接收方根据所述第一信息进行所述发送方标识的解密。
还提供了一种消息处理方法,应用于服务端,包括:
接收发送方发送的包含第一信息和第一消息内容的第一消息,其中,所述第一信息由所述发送方利用预设加密算法对发送方标识进行加密得到;
保存所述第一信息和所述第一消息内容;
在满足预设发送条件的情况下,将所述第一信息和所述第一消息内容发送至所述第一消息对应的接收方,以使所述接收方根据所述第一信息进行所述发送方标识的解密。
还提供了一种消息处理方法,应用于消息的接收方,包括:
接收服务端发送的第一信息和第一消息内容,其中,所述第一信息和所述第一消息内容包含于发送方发送给所述服务端的第一消息中,所述第一信息由所述发送方利用预设加密算法对发送方标识进行加密得到;
根据所述第一信息进行所述发送方标识的解密。
还提供了一种消息处理装置,配置于消息的发送方,包括:
发送方标识加密模块,设置为利用预设加密算法对发送方标识进行加密,得到第一信息;
消息发送模块,设置为向服务端发送包含所述第一信息和第一消息内容的第一消息,其中,所述第一消息用于指示所述服务端保存所述第一信息和所述第一消息内容,并在满足预设发送条件的情况下,将所述第一信息和所述第一消息内容发送至所述第一消息对应的接收方,供所述接收方根据所述第一信息进行所述发送方标识的解密。
还提供了一种消息处理装置,配置于服务端,包括:
消息接收模块,设置为接收发送方发送的包含第一信息和第一消息内容的第一消息,其中,所述第一信息由所述发送方利用预设加密算法对发送方标识进行加密得到;
保存模块,设置为保存所述第一信息和所述第一消息内容;
消息发送模块,设置为在满足预设发送条件的情况下,将所述第一信息和所述第一消息内容发送至所述第一消息对应的接收方,以使所述接收方根据所述第一信息进行所述发送方标识的解密。
还提供了一种消息处理装置,配置于消息的接收方,包括:
消息接收模块,设置为接收服务端发送的第一信息和第一消息内容,其中,所述第一信息和所述第一消息内容包含于发送方发送给所述服务端的第一消息中,所述第一信息由所述发送方利用预设加密算法对发送方标识进行加密得到;
发送方标识解密模块,设置为根据所述第一信息进行所述发送方标识的解密。
还提供了一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现上述的消息处理方法。
还提供了一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现上述的消息处理方法。
附图说明
图1为本申请实施例提供的一种消息处理方法所适用的应用场景的场景架构图;
图2为本申请实施例提供的一种消息处理方法的流程示意图;
图3为本申请实施例提供的另一种消息处理方法的流程示意图;
图4为本申请实施例提供的一种消息交互的示意图;
图5为本申请实施例提供的一种消息处理方法的流程示意图;
图6为本申请实施例提供的另一种消息处理方法的流程示意图;
图7为本申请实施例提供的另一种消息处理方法的流程示意图;
图8为本申请实施例提供的一种一对一消息交互的示意图;
图9为本申请实施例提供的一种群组消息交互的示意图;
图10为本申请实施例提供的一种消息处理装置的结构框图;
图11为本申请实施例提供的另一种消息处理装置的结构框图;
图12为本申请实施例提供的另一种消息处理装置的结构框图;
图13为本申请实施例提供的一种计算机设备的结构框图。
具体实施方式
下面结合附图和实施例对本申请进行说明。
图1为本申请实施例提供的一种消息处理方法所适用的应用场景的场景架构图。参考图1,该应用场景中可以包括发送方101、服务端102和接收方103,发送方101在需要向接收方103发送消息时,先将消息发送给服务端102,再由服务端102将消息发送给接收方103。本申请实施例对应用场景类型不做限定,例如场景类型可以是即时通讯(Instant Messaging,IM)场景、邮件收发场景、区块链中比特币账号的转账场景以及支付类应用程序(Application,APP)中的支付或转账场景等等。本申请实施例对发送方101、服务端102和接收方103分别对应的实体设备也不做限定,例如实体设备可以是手机、平板电脑、台式机或服务器等等。
下面以IM场景为例进行示意性说明,很多应用程序中都包含有IM功能,如社交类即时通信APP以及直播类APP等等,这些应用程序中所传递的消息可以是普通用户之间的及时通讯消息,也可以业务逻辑的信令等。IM***的基础功能是将消息从一个用户高效稳定地发送给另外一个用户,但在很多情况下, 消息接收方并无法及时收到消息,例如通过移动网络进行通讯的移动端可能处于离线或者遭遇网络不稳定的情况,这时,IM***必须处理大量的离线消息,离线消息通常都存储于数据库中。相关技术中,为了便于在接收方适合接收消息时,及时转发消息,并让接收方成功获知消息的发送方,数据库中会保存消息的发送方和接收方的对应关系(以下称为用户关系链),也即谁发送给谁、谁在和谁通讯的关系,从安全和隐私的角度考虑,用户关系链应该不是公开的,或者至少在一种授权的前提下才可以披露给第三方。但在遭遇拖库(一般指黑客窃取数据库内容的行为)的时候,存储于数据库中的用户关系链很容易暴露给未经授权的第三方或不法分子,存在很大的安全隐患。
本申请实施例中,消息的发送方在向服务端发送第一消息内容之前,先利用预设加密算法对发送方标识进行加密,使得第一消息内容在服务端进行存储时,第一消息内容对应的发送方的身份是被加密的,因此,能够保证消息的用户关系链处于保密状态,防止暴露给恶意第三方。
图2为本申请实施例提供的一种消息处理方法的流程示意图,该方法可以由消息处理装置执行,其中该装置可由软件和/或硬件实现,一般可集成在计算机设备中,该计算机设备具备消息发送功能。如图2所示,该方法包括:
步骤201、利用预设加密算法对发送方标识进行加密,得到第一信息。
示例性的,预设加密算法可以是预设对称加密算法。对称加密算法又称为共享密钥加密算法或单密钥加密算法。在对称加密算法中,使用的密钥只有一个,发送和接收双方都使用这个密钥对数据进行加密和解密。一般的,数据加密过程可以是,在对称加密算法中,数据发送方将明文(原始数据,在本申请实施例中可以是发送方标识)和加密密钥一起经过特殊加密处理,生成复杂的加密密文(在本申请实施例中可以是第一信息)进行发送;数据解密过程可以是,数据接收方收到密文后,若想读取原始数据,则需要使用加密使用的密钥及相同算法的逆算法对加密的密文进行解密,使其恢复成可读明文。本申请实施例对预设对称加密算法的类型不做限定,例如预设对称加密算法可以是高级加密标准(Advanced Encryption Standard,AES)算法、数据加密标准(Data Encryption Standard,DES)或三重数据加密算法(Triple Data Encryption Algorithm,TDEA)等,本申请实施例对加密算法的位数不做限定,例如加密算法的位数可以是128位、256位或512位等等,可根据实际需求进行设置。可选的,预设加密算法为AES256。
示例性的,发送方标识(Identification,ID)可以理解为用于表示发送方唯一身份的标识,本申请实施例对发送方标识的表现形式不做限定,发送方标识的表现形式可以是发送方账号名称或发送方代号等。
步骤202、向服务端发送包含所述第一信息和第一消息内容的第一消息,第一消息用于指示所述服务端保存所述第一信息和所述第一消息内容,并在满足预设发送条件时,将所述第一信息和所述第一消息内容发送至所述第一消息对应的接收方,供所述接收方根据所述第一信息进行发送方标识的解密。
本申请实施例中,本申请实施例对发送方与服务端之间采用的通信协议不做限定,例如该通信协议可以是超文本传输安全协议(Hyper Text Transfer Protocol over SecureSocket Layer,HTTPS)或其他协议。本申请实施例对第一消息的结构不做限定,第一消息的结构可以根据所采用的通信协议进行设置,对于同一个通信协议也可进行不同的设置。在相关技术中,发送方发送给服务端的消息中并不包含第一信息,可将相关技术中的消息称为原始消息,原始消息中可以包括消息内容以及协议头等其他相关内容,可以由所采用的通信协议确定,本申请实施例中,可以在原始消息基础上添加第一信息,本申请实施例对第一信息的添加位置不做限定,第一信息可以添加到原始消息内部,如消息体中,也可添加到原始消息外部,添加完成后,得到本申请实施例中的第一消息。该第一消息可以是发送方发送给接收方的任意一条消息,本申请实施例对第一消息的内容不做限定。本申请实施例对接收方的数量不做限定,接收方的数量可以是一个或多个。
可选的,对于第一消息内容,也可采用一定的加密算法进行加密,以保证消息内容的安全性。
示例性的,第一消息中还可以包含接收方标识,便于服务端根据接收方标识确定第一消息对应的接收方。此外,第一消息对应的接收方标识也可独立于第一消息进行发送,可将第一消息与接收方的对应关系发送给服务端,例如发送第一消息的消息ID与接收方ID的对应关系。
示例性的,服务端在将第一信息和第一消息内容成功发送给第一消息对应的接收方之前,可一直存储第一信息和第一消息内容。相关技术中服务端的数据库中会保存接收方标识、消息内容和发送方标识,并将消息内容和发送方标识一起发送给接收方,以便接收方获知消息内容的来源。而本申请实施例中,不会保存发送方标识,可以在原来保存发送方标识的位置保存第一信息,也可额外增设字段用于保存第一信息。在服务端未将第一信息和第一消息内容删除之前,若发生拖库情况,由于实施拖库操作的第三方无法得知接收方持有的用于解密发送方标识的密钥,因此,无法得知第一消息内容是谁发送的,也即无法解密存储于数据库中的用户关系链(由于处于被加密状态,为便于与相关技术中用户关系链进行区分,这里也可称为密文关系链),可有效保护消息交互***的安全性,提升产品的隐私保护能力。
示例性的,预设发送条件可以根据实际需求进行设置,例如,可以是在接收到第一消息后立即发送,可以是在接收到第一消息后先进行相关验证再进行发送,还可以是在接收到第一消息后先判断接收方是否在线或接收方的网络状况是否合适再确定是否发送等。本申请实施例对第一信息和第一消息内容的保存步骤和发送步骤的执行顺序不做限定,可以根据实际情况进行设置。
示例性的,服务端在向接收方发送第一信息和第一消息内容时,还可同时发送其他内容,本申请实施例对此不做限定。例如,服务端可根据第一信息和第一消息内容生成第二消息,并将第二消息发送至接收方。
示例性的,接收方在接收到服务端转发的第一信息和第一消息内容后,可利用预设加密算法对应的逆算法和对应的密钥对第一信息进行解密,若解密成功,则可得到第一消息对应的发送方标识,也即获知第一消息的发送方身份。可选的,消息收发双方可以提前协商好共享的密钥,也可在第一信息中包含解密信息,解密信息可以帮助接收方根据自己已知的信息确定出用于解密第一信息的密钥。可选的,若解密失败,则可执行报错等操作,本申请实施例对此不做限定。接收方在接收到第一消息内容后,若第一消息内容被加密,则可针对第一消息内容进行解密,若解密成功,则可得到发送方真正想要发送的消息内容。若第一消息内容未被加密,则可根据发送方标识和第一消息内容进行后续流程。
本申请实施例中提供的消息处理方法,消息的发送方在向服务端发送消息之前,先利用预设加密算法对发送方标识进行加密,得到第一信息,再向服务端发送包含第一信息和第一消息内容的第一消息,第一消息用于指示服务端保存第一信息和第一消息内容,并在满足预设发送条件时,将第一信息和第一消息内容发送至第一消息对应的接收方,供接收方根据第一信息进行发送方标识的解密,进而获知第一消息的发送方的身份。通过采用上述技术方案,第一消息内容在服务端进行存储时,第一消息内容对应的发送方的身份是被加密的,只有真正的消息接收方能够进行解密,因此,能够在保证双方正常的消息通信的同时,保证消息的通信双方关系链被保密,防止暴露给恶意第三方。
在一些实施例中,所述利用预设加密算法对发送方标识进行加密,得到第一信息之后,还包括:采用所述发送方的私钥对所述第一信息进行签名,得到第二信息;根据所述第一信息和所述第二信息确定第一属性信息。所述向服务端发送包含所述第一信息和第一消息内容的第一消息,包括:向服务端发送包含所述第一属性信息和第一消息内容的第一消息。所述第一消息用于指示所述服务端保存所述第一信息和所述第一消息内容,并在满足预设发送条件时,将所述第一信息和所述第一消息内容发送至所述第一消息对应的接收方,供所述 接收方根据所述第一信息进行发送方标识的解密,包括:第一消息用于指示所述服务端根据所述发送方的公钥对所述第二信息进行验签,在验签成功后保存所述第一属性信息和所述第一消息内容,并在满足预设发送条件时,将所述第一属性信息和所述第一消息内容发送至所述第一消息对应的接收方,供所述接收方根据所述第一信息进行发送方标识的解密以及在解密成功后根据解密得到的发送方的公钥对所述第二信息进行验签。这样设置的好处在于,能够支持服务端验证第一消息的发送方是否被篡改,保证消息通信的准确性和安全性。
示例性的,发送方在得到第一信息后,采用自己的私钥对第一信息进行签名,得到第二信息,并将第一信息和第二信息一起作为第一属性信息发送给服务端,服务端可以从第一消息中(如第一消息的协议头中可以包含发送方ID)得知发送方身份,进而查询到对应的发送方的公钥,使用该公钥验签第二信息,若能够成功验签出第一信息,则可说明第一消息确实是发送方发送的,若验签后得到的信息与第一信息不一致,则可说明可能有人冒充发送方来发送第一消息,进而达到有效识别攻击行为的效果。
在一些实施例中,所述接收方为单一用户,所述利用预设加密算法对发送方标识进行加密,得到第一信息,包括:生成第一随机数和第一随机密钥对;利用预设密钥协商协议基于所述第一随机密钥对中的第一私钥和所述接收方的公钥生成第一公共密钥;利用第一预设加密算法对所述第一随机数、所述第一公共密钥和发送方标识进行加密,得到加密发送方信息;根据所述第一随机数、所述第一随机密钥对中的第一公钥和所述加密发送方信息,确定第一信息。这样设置的好处在于,对于一对一的消息通信场景,可借助于预设密钥协商协议,产生发送方和接收方可以推演出的公共密钥,提升第一信息的加密程度,从而保证发送方标识的安全性。
第一随机数的位数可自由设置,例如16字节。第一随机密钥对随机产生,可以仅针对本次发送的消息,保证安全性。预设密钥协商协议例如可以是椭圆曲线赫尔曼(Elliptic Curves Diffie-Hellman,ECDH)协议,可以利用ECDH协议中的异步公共密钥协商算法基于第一随机密钥对中的第一私钥和接收方的公钥生成第一公共密钥。接收方在接收到包含第一随机数、第一公钥和加密发送方信息的第一信息后,同样可以利用异步公共密钥协商算法基于第一随机密钥对中的第一公钥和自己的私钥生成第二公共密钥,若中间过程未出现异常,则第二公共密钥应该与第一公共密钥相同,那么接收方即可继续根据第一随机数和第二公共密钥针对加密发送方信息进行解密,进而得到发送方标识。
在一些实施例中,所述利用第一预设加密算法对所述第一随机数、所述第一公共密钥和发送方标识进行加密,得到加密发送方信息,利用预设哈希算法 计算所述第一公共密钥对应的第一哈希值;利用第一预设加密算法对所述第一随机数、所述第一哈希值和发送方标识进行加密,得到加密发送方信息。这样设置的好处在于,第一公共密钥的数据长度可能是不固定的,也即发送两条消息时,分别计算出来的第一公共密钥的长度可能是不一致的,通过采用预设哈希算法计算对应的哈希值,可以将第一公共密钥的长度固定下来,降低后续运算的复杂度。本申请实施例对预设哈希算法的类型不做限定,例如预设哈希算法可以是安全哈希算法(Secure Hash Algorithm,SHA),又称安全散列算法。一实施例中,SHA可以是SHA256等。
在一些实施例中,所述接收方为群组用户,所述利用预设加密算法对发送方标识进行加密,得到第一信息,包括:生成第二随机数;利用第二预设加密算法对所述第二随机数、所述群组用户对应的群密码和发送方标识进行加密,得到加密发送方信息;根据所述第二随机数和所述加密发送方信息,确定第一信息。这样设置的好处在于,对于群组消息通信场景,可利用群密码作为公共密钥,在保证安全性的前提下简化加密流程。
第二预设加密算法可以与第一预设加密算法相同,也可不同。本申请实施例中的群密码可以是入群密码,也可以是新增的专用于群消息发送的加密密码,对于一个群组来说,群组内的成员均知道这个密码,而群组外的其他人并不知道群密码,因此,可将该密码作为公共密钥进行加密和解密。群密码一般情况下可以是固定的,但在一些情况下也可以变更,如成员发生变化时(如新增成员或存在退群的成员),或为了避免被破解,可定期变更等。群密码变更后,可通知到群组内当前的所有成员。
在一些实施例中,在所述确定第一信息之后,还包括:生成第三随机数;采用所述发送方的私钥对所述第三随机数进行签名,得到第二属性信息。相应的,所述向服务端发送包含所述第一属性信息和第一消息内容的第一消息,包括:向服务端发送包含所述第一属性信息、所述第二属性信息和第一消息内容的第一消息。这样设置的好处在于,对于群组通信场景来说,可能存在撤回消息的情况,而在服务端中,由于存储的发送方都是加密的,服务端无法验证撤回操作的发起方所针对的要撤回的消息是否本来由该发起方发送,也即为了避免有人冒充消息发送方来撤回消息,增设了第二属性信息,便于服务端对撤回消息的发起者进行验证,防止冒名撤回其他成员消息的情况发生。
在一些实施例中,在所述向服务端发送包含所述第一属性信息、所述第二属性信息和第一消息内容的第一消息之后,还包括:在检测到针对所述第一消息的撤回事件被触发时,生成第四随机数;利用所述第二预设加密算法对所述第四随机数、所述群密码和所述发送方标识进行加密,得到新的加密发送方信 息;根据所述第四随机数和所述新的加密发送方信息,确定第三信息;采用所述发送方的私钥对所述第三信息进行签名,得到第四信息;根据所述第三信息和所述第四信息确定第三属性信息;向所述服务端发送包含所述第三属性信息和所述第三随机数的针对所述第一消息的第一撤回消息,第一撤回消息用于指示所述服务端根据所述发送方的公钥对所述第四信息进行验签,并在验签成功后对所述第二属性信息进行验签,若验签结果与所述第一撤回消息携带的第三随机数一致,则将包含所述第三属性信息的针对所述第一消息的第二撤回消息发送至所述第一消息对应的接收方,供所述接收方执行相应的消息撤回操作。这样设置的好处在于,可以使群消息在保证合法性的情况下被撤回。
服务端根据发送方的公钥对第三属性信息进行验签,可以验证撤回消息的发起者是否确实为当前的发送方,若验签失败,说明可能存在攻击行为,若验签成功,则可继续验证当前所要撤回的消息的原发送方是否为撤回消息的发起者,若验证成功,则可继续后续的消息撤回相关流程,若验证失败,说明可能存在冒名恶意撤回的情况,可以不进入后续的消息撤回流程。
图3为本申请实施例提供的另一种消息处理方法的流程示意图,该方法可应用于IM***中一对一消息通讯场景中的消息发送方。图4为本申请实施例提供的一种消息交互的示意图,图4中包含用户A和用户C,用户A的私钥和公钥对可记为(c a,C a),发送方A通过网络和一个或者多个IM服务端(Server)连接,IM Server可以负责将消息持久化写入数据库,用户C的私钥和公钥对可记为(c c,C c)。图4以用户A向用户C发送消息为例,说明如何在数据库被拖库的情况下,依然不会泄漏“A在和C通讯”这个用户关系链。
示例性的,如图3所示,该方法可包括:
步骤301、生成第一随机数和第一随机密钥对。
示例性的,第一随机数可以是16字节长度的随机数,可记为IV;第一随机密钥对可认为是针对本次消息发送操作的临时密钥对(key pair),可记为(r,R),其中,r为第一私钥,R为第一公钥。
步骤302、利用预设密钥协商协议基于第一随机密钥对中的第一私钥和接收方的公钥生成第一公共密钥。
示例性的,预设密钥协商协议可以是ECDH协议,通过以下方式得到第一公共密钥:
ECDH:(r,C c)→P
其中,P为第一公共密钥。
步骤303、利用预设哈希算法计算第一公共密钥对应的第一哈希值。
示例性的,预设哈希算法为SHA256,通过以下方式得到第一公共密钥对应的第一哈希值:
H=SHA256(P)
其中,H为第一哈希值。
步骤304、利用第一预设对称加密算法对第一随机数、第一哈希值和发送方标识进行加密,得到加密发送方信息。
示例性的,第一预设对称加密算法为AES256,通过以下方式得到加密发送方信息:
source′=AES256(IV,H,source)
其中,source用于表示发送方标识(如用户A的ID),source′用于表示加密发送方信息。
步骤305、根据第一随机数、第一随机密钥对中的第一公钥和加密发送方信息,确定第一信息。
示例性的,可将第一信息记为payload(有效负载)。payload可表示为:
payload=IV+R+source′
本申请实施例中的“+”并非表示运算符号中的加法,而是用于表示项目的并列关系,如payload中包含IV、R和source′这几个并列的项目。
可选的,在考虑发送方和接收方的版本兼容问题时,第一信息中还可包含发送方的版本信息,如可记为version,即payload=IV+R+source′+version。
步骤306、采用发送方的私钥对第一信息进行签名,得到第二信息。
示例性的,采用c a签名payload,得到第二信息,第二信息可记为S。
步骤307、根据第一信息和第二信息确定第一属性信息。
示例性的,可将第一属性信息记为extra,extra=payload+S。
步骤308、向服务端发送包含第一信息和第一消息内容的第一消息,第一消息用于指示服务端根据发送方的公钥对第二信息进行验签,在验签成功后保存第一属性信息和第一消息内容,并在满足预设发送条件时,将第一属性信息和第一消息内容发送至第一消息对应的接收方,供接收方根据第一信息进行发送方标识的解密以及在解密成功后根据解密得到的发送方的公钥对所述第二信息进行验签。
关于服务端和接收方的相关细节可参考本文其他相关内容,此处不再赘述。
本申请实施例提供的消息处理方法,对于一对一通信场景,消息的发送方 在向服务端发送消息之前,先利用预设密钥协商协议生成公共密钥,并计算公共密钥的哈希值,利用预设加密算法对随机数、哈希值和发送方标识进行加密,得到加密发送方信息,然后根据随机数、随机密钥对中的公钥和加密发送方信息确定第一信息,采用自己的私钥对第一信息进行签名,得到第二信息,再向服务端发送包含第一信息、第二信息和第一消息内容的第一消息,服务端在接收到第一消息后,可以先对发送方身份进行验签,成功后保存第一信息、第二信息和第一消息内容,并在满足预设发送条件时,将保存的内容发送至第一消息对应的接收方,接收方根据第一信息和第二信息分别进行发送方标识的解密以及发送方身份的验签。通过采用上述技术方案,第一消息内容在服务端进行存储时,可保证消息的通信双方关系链被保密,防止暴露给恶意第三方,且能够保证通信过程中及时发现发送方被篡改的情况,保证通信安全。
图5为本申请实施例提供的一种消息处理方法的流程示意图,如图5所示,该方法可应用于IM***中群组消息通讯场景中的消息发送方。同样以图4为例,假设用户A是通信群组中的一个用户,用户C是通信群组中除用户A以外的一个用户,通信群组中还可包括其他用户,如用户B,用户D等,图4中未示出,当用户A在通信群组内发送消息时,通信群组中的其他用户均为接收方,下面以用户C为例进行说明。
示例性的,该方法可包括:
步骤501、生成第二随机数。
示例性的,第二随机数可以是16字节长度的随机数,也可记为IV。
步骤502、利用第二预设对称加密算法对第二随机数、群组用户对应的群密码和发送方标识进行加密,得到加密发送方信息。
示例性的,第二预设对称加密算法为AES256,通过以下方式得到加密发送方信息:
source′=AES256(IV,群密码,source)
其中,source用于表示发送方标识(如用户A的ID),source′用于表示加密发送方信息。
步骤503、根据第二随机数和加密发送方信息,确定第一信息。
示例性的,可将第一信息记为payload(有效负载)。payload可表示为:
payload=IV+source′
可选的,在考虑发送方和接收方的版本兼容问题时,第一信息中还可包含发送方的版本信息,如可记为version,即payload=IV+source′+version。
步骤504、采用发送方的私钥对第一信息进行签名,得到第二信息。
示例性的,采用c a签名payload,得到第二信息,第二信息可记为S。
步骤505、根据第一信息和第二信息确定第一属性信息。
示例性的,可将第一属性信息记为extra,extra=payload+S。
步骤506、生成第三随机数。
示例性的,第三随机数可以是16字节长度的随机数,可记为IIV。生成第三随机数后,客户端需要进行保存,应用于后续的消息召回流程。
步骤507、采用发送方的私钥对第三随机数进行签名,得到第二属性信息。
示例性的,采用c a签名IIV,得到第二属性信息,第二属性信息可记为v。
步骤508、向服务端发送包含第一属性信息、第二属性信息和第一消息内容的第一消息。
示例性的,第一消息用于指示服务端根据发送方的公钥对第二信息进行验签,在验签成功后保存第一属性信息、第一消息内容和第二属性信息,并在满足预设发送条件时,将第一属性信息和第一消息内容发送至第一消息对应的接收方,供接收方根据第一信息进行发送方标识的解密以及在解密成功后根据解密得到的发送方的公钥对所述第二信息进行验签。
步骤509、在检测到针对第一消息的撤回事件被触发时,生成第四随机数。
示例性的,第四随机数可以是16字节长度的随机数,也可记为IV。当用户A发现自己发送过的第一消息因内容不合适等原因希望撤回时,可以发起撤回事件,例如可以触发第一消息对应的撤回按钮,客户端检测到该撤回按钮被触发后,确定针对第一消息的撤回事件被触发,生成第四随机数。
步骤510、利用第二预设对称加密算法对第四随机数、群密码和发送方标识进行加密,得到新的加密发送方信息。
source′=AES256(IV,群密码,source)
步骤511、根据第四随机数和所述新的加密发送方信息,确定第三信息。
payload=IV+source′
步骤512、采用发送方的私钥对第三信息进行签名,得到第四信息。
示例性的,采用c a签名payload,得到第四信息,第四信息可记为S。
步骤513、根据第三信息和第四信息确定第三属性信息。
步骤514、向服务端发送包含第三属性信息和第三随机数的针对第一消息的 第一撤回消息。
示例性的,第一撤回消息用于指示服务端根据发送方的公钥对第四信息进行验签,并在验签成功后对第二属性信息进行验签,若验签结果与第一撤回消息携带的第三随机数一致,则将包含第三属性信息的针对第一消息的第二撤回消息发送至第一消息对应的接收方,供接收方执行相应的消息撤回操作。
可在撤回消息中包含群ID(gid)和消息ID(mid),群ID(gid)和消息ID(mid)用于表明针对哪个群组里的哪一条消息进行撤回。例如,第一撤回消息里面包含发送方所在的通信群组的gid,以及第一消息的mid。
关于服务端和接收方的相关细节可参考本文其他相关内容,此处不再赘述。
本申请实施例提供的消息处理方法,对于群组通信场景,消息的发送方在向服务端发送消息之前,将群密码作为公共密钥,利用预设对称加密算法对随机数、群密码和发送方标识进行加密,得到加密发送方信息,然后根据随机数和加密发送方信息确定第一信息,采用自己的私钥对第一信息进行签名,得到第二信息,将第一信息和第二信息确定为第一属性信息,然后对随机数进行签名,得到第二属性信息,用于后续的消息撤回验证。向服务端发送包含第一属性信息、第二属性信息和第一消息内容的第一消息,服务端在接收到第一消息后,可以先对发送方身份进行验签,成功后保存第一属性信息、第二属性信息和第一消息内容,并在满足预设发送条件时,将第一属性信息和第一消息内容发送至群组内其他成员,其他成员可以根据第一信息和第二信息分别进行发送方标识的解密以及发送方身份的验签。在发送方发起消息撤回流程时,重新生成新的加密发送发信息,并确定第三信息,对第三信息进行签名后,得到第四信息,将第三信息和第四信息作为第三属性信息与之前发送第一消息时保存的第三随机数发送至服务端,服务端通过验签第四信息可以得知撤回操作的发起方是否被冒充,若未被冒充,可以验证第三随机数的签名是否为之前保存的第三属性信息,进而验证出发起消息撤回的发起方是否为消息的原发送方。通过采用上述技术方案,第一消息内容在服务端进行存储时,可保证消息的发送方处于保密状态,进而保证消息的通信双方关系链被保密,防止暴露给恶意第三方,且能够保证通信过程中及时发现发送方被篡改的情况,避免已发出的消息被第三方恶意撤回,保证消息通信的准确性和安全性。
图6为本申请实施例提供的另一种消息处理方法的流程示意图,该方法可以由消息处理装置执行,其中该装置可由软件和/或硬件实现,一般可集成在服务器等计算机设备中。如图6所示,该方法包括:
步骤601、接收发送方发送的包含第一信息和第一消息内容的第一消息,其中,所述第一信息由所述发送方利用预设加密算法对发送方标识进行加密得到。
以服务端和发送方的通信协议为HTTPS协议为例,服务端可以从协议头(https header)中得到发送方标识(uid),进而得知发送方的身份,但本申请实施例中,服务端并不会对发送方标识进行保存。
步骤602、保存所述第一信息和所述第一消息内容。
本申请实施例中,服务端不会对发送方的身份信息进行保存,而是仅保存经过加密的发送方标识以及发送方想要发送的消息内容。
步骤603、在满足预设发送条件时,将所述第一信息和所述第一消息内容发送至所述第一消息对应的接收方,以使所述接收方根据所述第一信息进行发送方标识的解密。
本申请实施例提供的消息处理方法,服务端接收消息发送方发送的第一消息,第一消息中包含了第一信息和第一消息内容,第一信息由发送方利用预设加密算法对发送标识进行加密,只有真正的消息接收方能够进行解密,因此,第一信息在服务端保存期间,不会被其他人破解,能够在保证双方正常的消息通信的同时,保证消息的通信双方关系链被保密,防止暴露给恶意第三方。
在一些实施例中,所述接收发送方发送的包含第一信息和第一消息内容的第一消息,包括:接收发送方发送的包含第一属性信息和第一消息内容的第一消息,其中,所述第一属性信息由所述发送方根据所述第一信息和第二信息确定,所述第二信息由所述发送方采用所述发送方的私钥对所述第一信息进行签名得到。所述保存所述第一信息和所述第一消息内容,包括:根据所述发送方的公钥对所述第二信息进行验签,并在验签成功后,保存所述第一属性信息和所述第一消息内容。所述将所述第一信息和所述第一消息内容发送至所述第一消息对应的接收方,以使所述接收方根据所述第一信息进行发送方标识的解密,包括:将所述第一属性信息和所述第一消息内容发送至所述第一消息对应的接收方,以使所述接收方根据所述第一信息进行发送方标识的解密以及在解密成功后根据解密得到的发送方的公钥对所述第一属性信息中的第二信息进行验签。这样设置的好处在于,服务端能够验证第一消息的发送方是否被篡改,保证消息通信的准确性和安全性。
在一些实施例中,所述接收方为群组用户,所述接收发送方发送的包含第一属性信息和第一消息内容的第一消息,包括:接收发送方发送的包含第一属性信息、第二属性信息和第一消息内容的第一消息,其中,所述第二属性信息由所述发送方采用所述发送方的私钥对第三随机数进行签名得到,所述第三随机数由所述发送方生成。所述方法还包括:保存所述第二属性信息。这样设置的好处在于,便于服务端利用所保存的第二属性信息在后续可能发生的消息撤回流程中,对撤回消息的发起者进行验证,防止冒名撤回其他成员消息的情况 发生。
示例性的,可以在服务端的数据库中增设两个字段,分别用于存储第一属性信息和第二属性信息。如前文举例,第一属性信息可记为extra,第二属性信息可记为v,可在数据库中增设“密文source”字段用于存储extra,该字段也可取名为extra,增设“verifySig”字段用于存储v。上述命名仅为举例说明,可根据实际情况进行设置。其中,取名为extra和verifySig可提升安全和隐私保护性,避免轻易暴露这个密文数据的用途。
在一些实施例中,在所述保存所述第二属性信息之后,还包括:接收所述发送方发送的包含第三属性信息和所述第三随机数的针对所述第一消息的第一撤回消息,其中,所述第三属性信息由第三信息和第四信息确定,所述第三信息由所述发送方根据第四随机数和新的加密发送方信息确定,所述第四随机数由所述发送方生成,所述新的加密发送方信息由所述发送方利用所述第二预设加密算法对所述第四随机数、所述群密码和发送方标识进行加密得到,所述第四信息由所述发送方采用所述发送方的私钥对所述第三信息进行签名得到;根据所述发送方的公钥对所述第四信息进行验签,并在验签成功后对所述第二属性信息进行验签,若验签结果与所述第一撤回消息携带的第三随机数一致,则将包含所述第三属性信息的针对所述第一消息的第二撤回消息发送至所述第一消息对应的接收方,第二撤回消息用于指示所述接收方执行相应的消息撤回操作。这样设置的好处在于,可以使群消息在保证合法性的情况下被撤回。
图7为本申请实施例提供的另一种消息处理方法的流程示意图,该方法可以由消息处理装置执行,其中该装置可由软件和/或硬件实现,一般可集成在计算机设备中,该计算机设备具备消息接收功能。如图7所示,该方法包括:
步骤701、接收服务端发送的第一信息和第一消息内容,其中,所述第一信息和所述第一消息内容包含于发送方发送给所述服务端的第一消息中,所述第一信息由所述发送方利用预设加密算法对发送方标识进行加密得到。
步骤702、根据所述第一信息进行发送方标识的解密。
本申请实施例提供的消息处理方法,接收方接收服务端转发的消息发送方发送的第一信息和第一消息内容,第一信息由发送方利用预设加密算法对发送标识进行加密,只有真正的消息接收方能够进行解密,因此,第一信息在服务端保存期间,不会被其他人破解,保证消息的通信双方关系链被保密,防止暴露给恶意第三方,接收方对第一信息进行解密后,可以得到准确的消息发送方,再根据消息发送方和第一消息内容进行后续操作,保证双方通信的准确性和安全性。
在一些实施例中,所述接收服务端发送的第一信息和第一消息内容,包括:接收服务端发送的第一属性信息和第一消息内容,其中,所述第一属性信息包含于所述第一消息中,并由所述发送方根据所述第一信息和第二信息确定,所述第二信息由所述发送方采用所述发送方的私钥对所述第一信息进行签名得到。在所述根据所述第一信息进行发送方标识的解密之后,还包括:若解密成功,则根据解密得到的发送方标识获取对应的发送方的公钥;根据所获取的公钥对所述第二信息进行验签。这样设置的好处在于,接收方在解密得到发送方标识后,可继续验证第一消息的发送方是否被篡改,保证消息通信的准确性和安全性。
在一些实施例中,所述接收方为单一用户,所述第一信息中包含第一随机数、第一随机密钥对中的第一公钥和加密发送方信息,所述第一随机数和所述第一随机密钥对由所述发送方生成,所述加密发送方信息由所述发送方利用第一预设加密算法对所述第一随机数、第一公共密钥和发送方标识进行加密得到,所述第一公共密钥由所述发送方利用预设密钥协商协议基于所述第一随机密钥对中的第一私钥和所述接收方的公钥生成。所述根据所述第一信息进行发送方标识的解密,包括:利用所述预设密钥协商协议基于所述接收方的私钥和所述第一随机密钥对中的第一公钥生成第二公共密钥;根据所述第二公共密钥和所述第一随机数针对所述加密发送方信息进行发送方标识的解密。这样设置的好处在于,对于一对一的消息通信场景,接收方可以根据所接收的信息和仅有自己知道的私钥推演出公共密钥,提升第一信息的加密程度,从而保证发送方标识的安全性。
在一些实施例中,所述加密发送方信息由所述发送方利用第一预设加密算法对所述第一随机数、第一公共密钥对应的第一哈希值和发送方标识进行加密得到;所述根据所述第二公共密钥和所述第一随机数针对所述加密发送方信息进行发送方标识的解密,包括:利用预设哈希算法计算所述第二公共密钥对应的第二哈希值;根据所述第二哈希值和所述第一随机数针对所述加密发送方信息进行发送方标识的解密。这样设置的好处在于,与发送方的公共密钥计算方式匹配,经过哈希运算,可以将公共密钥长度固定,降低后续运算的复杂度。
示例性的,如上文举例,接收方C可以从第一属性信息中读取第一信息payload,获取其中的第一随机数IV和R,若payload中还包含version,则可先将接收方C自己的版本信息与获取的version进行比对,若接收方C自己的版本信息与获取的version不一致,则根据预设兼容策略执行相应的版本适配操作。随后,可利用ECDH基于c c和R计算第二公共密钥P,即ECDH:(c c,R)→P,若通信过程中未出现攻击行为等异常情况,则第二公共密钥和第一公共密钥相同,进而可根据第二公共密钥计算对应的哈希值,即H=SHA256(P),使用第一随机 数IV和H针对source’进行解密,得到source。若解密失败可进行报错。若解密成功,可根据解密得到的source查询其对应的公钥C a,使用C a对第二信息S进行验签,若验签结果与第一信息payload一致,则可证明第一消息的真正发送方就是A,也即验签成功,可进入后续流程,若验签失败,可进行报错等操作。
在一些实施例中,所述接收方为群组用户,所述第一信息中包含第二随机数和加密发送方信息,所述第二随机数由所述发送方生成,所述加密发送方信息由所述发送方利用第二预设加密算法对所述第二随机数、所述群组用户对应的群密码和发送方标识进行加密得到;所述根据所述第一信息进行发送方标识的解密,包括:根据第二随机数和所述群密码针对所述加密发送方信息进行发送方标识的解密。这样设置的好处在于,对于群组消息通信场景,可利用群密码作为公共密钥,在保证安全性的前提下简化加密流程。
示例性的,如上文举例,接收方C可以从第一属性信息中读取第一信息payload,获取其中的第一随机数IV,若payload中还包含version,则可先将接收方C自己的版本信息与获取的version进行比对,若接收方C自己的版本信息与获取的version不一致,则根据预设兼容策略执行相应的版本适配操作。随后,使用第一随机数IV和群密码针对source’进行解密,得到source。若解密失败可进行报错。若解密成功,可根据解密得到的source查询其对应的公钥C a,使用C a对第二信息S进行验签,若验签结果与第一信息payload一致,则可证明第一消息的真正发送方就是A,也即验签成功,可进入后续流程,若验签失败,可进行报错等操作。群组内的其他接收方可同样进行上述操作,此处不再赘述。
在一些实施例中,在所述根据第二随机数和所述群密码针对所述加密发送方信息进行发送方标识的解密之后,还包括:接收所述服务端发送的包含第三属性信息的针对所述第一消息的第二撤回消息,其中,所述第三属性信息包含于所述发送方向所述服务端发送的针对所述第一消息的第一撤回消息中,所述第三属性信息由第三信息和第四信息确定,所述第三信息由所述发送方根据第四随机数和新的加密发送方信息确定,所述第四随机数由所述发送方生成,所述新的加密发送方信息由所述发送方利用所述第二预设加密算法对所述第四随机数、所述群密码和发送方标识进行加密得到,所述第四信息由所述发送方采用所述发送方的私钥对所述第三信息进行签名得到;根据所述第四随机数和所述群密码针对所述新的加密发送方信息进行发送方标识的解密;若解密成功,则根据解密得到的发送方标识获取对应的发送方的公钥;根据所获取的公钥对所述第四信息进行验签,若验签成功,则针对所述第一消息进行相应的撤回操作。这样设置的好处在于,便于接收方验证消息撤回的发起者是否被篡改。
示例性的,如上文举例,接收方在接收到服务端发送的第二撤回消息后, 读取其中第三属性信息extra,进而得到其中的第三信息payload,获取其中的第四随机数IV,采用第四随机数IV和群密码对新的加密发送方信息source’进行解密,若解密失败可报错,若解密成功则可得到发送方标识source,根据解密得到的发送方标识source获取对应的发送方的公钥C a,根据所获取的公钥C a对第四信息S进行验签,若验签成功,则可针对第一消息进行相应的撤回操作,如将第一消息从群组会话界面中删除。
图8为本申请实施例提供的一种一对一消息交互的示意图,如图8所示,交互流程可包括:
步骤801、发送方利用预设加密算法对发送方标识进行加密,得到第一信息。
步骤802、发送方采用发送方的私钥对第一信息进行签名,得到第二信息,根据第一信息和第二信息确定第一属性信息。
步骤803、发送方向服务端发送包含第一属性信息和第一消息内容的第一消息。
步骤804、服务端根据发送方的公钥对第二信息进行验签,在验签成功后保存第一属性信息和第一消息内容。
步骤805、服务端在满足预设发送条件时,向接收方发送第一属性信息和第一消息内容。
步骤806、接收方根据第一信息进行发送方标识的解密,若解密成功,则根据解密得到的发送方标识获取对应的发送方的公钥,根据所获取的公钥对第二信息进行验签。
图9为本申请实施例提供的一种群组消息交互的示意图,如图9所示,交互流程可包括:
步骤901、发送方利用预设加密算法对发送方标识进行加密,得到第一信息。
步骤902、发送方采用发送方的私钥对第一信息进行签名,得到第二信息,根据第一信息和第二信息确定第一属性信息。
步骤903、发送方采用发送方的私钥对第三随机数进行签名,得到第二属性信息,保存第三随机数。
步骤904、发送方向服务端发送包含第一属性信息、第二属性信息和第一消息内容的第一消息。
步骤905、服务端根据发送方的公钥对第二信息进行验签,在验签成功后保存第一属性信息、第二属性信息和第一消息内容。
步骤906、服务端在满足预设发送条件时,向接收方发送第一属性信息和第 一消息内容。
步骤907、接收方根据第一信息进行发送方标识的解密,若解密成功,则根据解密得到的发送方标识获取对应的发送方的公钥,根据所获取的公钥对第二信息进行验签。
步骤908、发送方在检测到针对第一消息的撤回事件被触发时,利用预设加密算法对发送方标识进行加密,得到第三信息。
步骤909、发送方采用发送方的私钥对第三信息进行签名,得到第四信息,并根据第三信息和第四信息确定第三属性信息。
步骤910、发送方向服务端发送包含第三属性信息和第三随机数的针对第一消息的第一撤回消息。
步骤911、服务端根据发送方的公钥对第四信息进行验签,并在验签成功后对第二属性信息进行验签。
步骤912、服务端确定验签结果与第一撤回消息携带的随机数一致,则将包含第三属性信息的针对第一消息的第二撤回消息发送至接收方。
步骤913、接收方根据第三信息进行发送方标识的解密,若解密成功,则根据解密得到的发送方标识获取对应的发送方的公钥,根据所获取的公钥对第四信息进行验签,若验签成功,则针对第一消息进行相应的撤回操作。
图10为本申请实施例提供的一种消息处理装置的结构框图,该装置可由软件和/或硬件实现,一般可集成在作为消息发送方的计算机设备中,可通过执行消息处理方法来进行消息的发送处理。如图10所示,该装置包括:
发送方标识加密模块1001,设置为利用预设加密算法对发送方标识进行加密,得到第一信息;第一消息发送模块1002,设置为向服务端发送包含所述第一信息和第一消息内容的第一消息,第一消息用于指示所述服务端保存所述第一信息和所述第一消息内容,并在满足预设发送条件时,将所述第一信息和所述第一消息内容发送至所述第一消息对应的接收方,供所述接收方根据所述第一信息进行发送方标识的解密。
本申请实施例提供的消息处理装置,消息的发送方在向服务端发送消息之前,先利用预设加密算法对发送方标识进行加密,得到第一信息,再向服务端发送包含第一信息和第一消息内容的第一消息,第一消息用于指示服务端保存第一信息和第一消息内容,并在满足预设发送条件时,将第一信息和第一消息内容发送至第一消息对应的接收方,供接收方根据第一信息进行发送方标识的解密,进而获知第一消息的发送方的身份。通过采用上述技术方案,第一消息内容在服务端进行存储时,第一消息内容对应的发送方的身份是被加密的,只 有真正的消息接收方能够进行解密,因此,能够在保证双方正常的消息通信的同时,保证消息的通信双方关系链被保密,防止暴露给恶意第三方。
图11为本申请实施例提供的另一种消息处理装置的结构框图,该装置可由软件和/或硬件实现,一般可集成在服务器等计算机设备中,可通过执行消息处理方法来进行消息的转发处理。如图11所示,该装置包括:
第一消息接收模块1101,设置为接收发送方发送的包含第一信息和第一消息内容的第一消息,其中,所述第一信息由所述发送方利用预设加密算法对发送方标识进行加密得到;保存模块1102,设置为保存所述第一信息和所述第一消息内容;第二消息发送模块1103,设置为在满足预设发送条件时,将所述第一信息和所述第一消息内容发送至所述第一消息对应的接收方,以使所述接收方根据所述第一信息进行发送方标识的解密。
本申请实施例提供的消息处理装置,服务端接收消息发送方发送的第一消息,第一消息中包含了第一信息和第一消息内容,第一信息由发送方利用预设加密算法对发送标识进行加密,只有真正的消息接收方能够进行解密,因此,第一信息在服务端保存期间,不会被其他人破解,能够在保证双方正常的消息通信的同时,保证消息的通信双方关系链被保密,防止暴露给恶意第三方。
图12为本申请实施例提供的另一种消息处理装置的结构框图,该装置可由软件和/或硬件实现,一般可集成在作为消息接收方的计算机设备中,可通过执行消息处理方法来进行消息的接收处理。如图12所示,该装置包括:
第二消息接收模块1201,设置为接收服务端发送的第一信息和第一消息内容,其中,所述第一信息和所述第一消息内容包含于发送方发送给所述服务端的第一消息中,所述第一信息由所述发送方利用预设加密算法对发送方标识进行加密得到;发送方标识解密模块1202,设置为根据所述第一信息进行发送方标识的解密。
本申请实施例提供的消息处理装置,接收方接收服务端转发的消息发送方发送的第一信息和第一消息内容,第一信息由发送方利用预设加密算法对发送标识进行加密,只有真正的消息接收方能够进行解密,因此,第一信息在服务端保存期间,不会被其他人破解,保证消息的通信双方关系链被保密,防止暴露给恶意第三方,接收方对第一信息进行解密后,可以得到准确的消息发送方,再根据消息发送方和第一消息内容进行后续操作,保证双方通信的准确性和安全性。
本申请实施例提供了一种计算机设备,该计算机设备中可集成本申请实施例提供的消息处理装置。图13为本申请实施例提供的一种计算机设备的结构框 图。计算机设备1300包括存储器1301、处理器1302及存储在存储器1301上并可在处理器1302上运行的计算机程序,所述处理器1302执行所述计算机程序时实现本申请实施例提供的消息处理方法。
本申请实施例还提供一种包含计算机可执行指令的存储介质,所述计算机可执行指令在由计算机处理器执行时用于执行本申请实施例提供的消息处理方法。
上述实施例中提供的消息处理装置、设备以及存储介质可执行本申请任意实施例所提供的消息处理方法,具备执行该方法相应的功能模块和有益效果。未在上述实施例中详尽描述的技术细节,可参见本申请任意实施例所提供的消息处理方法。

Claims (22)

  1. 一种消息处理方法,应用于消息的发送方,包括:
    利用预设加密算法对发送方标识进行加密,得到第一信息;
    向服务端发送包含所述第一信息和第一消息内容的第一消息,其中,所述第一消息用于指示所述服务端保存所述第一信息和所述第一消息内容,并在满足预设发送条件的情况下,将所述第一信息和所述第一消息内容发送至所述第一消息对应的接收方,供所述接收方根据所述第一信息进行所述发送方标识的解密。
  2. 根据权利要求1所述的方法,在所述利用预设加密算法对发送方标识进行加密,得到第一信息之后,还包括:
    采用所述发送方的私钥对所述第一信息进行签名,得到第二信息;
    根据所述第一信息和所述第二信息确定第一属性信息;
    所述向服务端发送包含所述第一信息和第一消息内容的第一消息,包括:
    向所述服务端发送包含所述第一属性信息和所述第一消息内容的第一消息;
    所述第一消息用于指示所述服务端保存所述第一信息和所述第一消息内容,并在满足预设发送条件的情况下,将所述第一信息和所述第一消息内容发送至所述第一消息对应的接收方,供所述接收方根据所述第一信息进行所述发送方标识的解密,包括:
    所述第一消息用于指示所述服务端根据所述发送方的公钥对所述第一属性信息中的所述第二信息进行验签,在验签成功后保存所述第一属性信息和所述第一消息内容,并在满足预设发送条件的情况下,将所述第一属性信息和所述第一消息内容发送至所述第一消息对应的接收方,供所述接收方根据所述第一信息进行所述发送方标识的解密以及在解密成功后根据解密得到的所述发送方的公钥对所述第二信息进行验签。
  3. 根据权利要求2所述的方法,其中,在所述接收方为单一用户的情况下,所述利用预设加密算法对发送方标识进行加密,得到第一信息,包括:
    生成第一随机数和第一随机密钥对;
    利用预设密钥协商协议基于所述第一随机密钥对中的第一私钥和所述接收方的公钥生成第一公共密钥;
    利用第一预设加密算法对所述第一随机数、所述第一公共密钥和所述发送方标识进行加密,得到加密发送方信息;
    根据所述第一随机数、所述第一随机密钥对中的第一公钥和所述加密发送 方信息,确定所述第一信息。
  4. 根据权利要求3所述的方法,其中,所述利用第一预设加密算法对所述第一随机数、所述第一公共密钥和所述发送方标识进行加密,得到加密发送方信息,包括:
    利用预设哈希算法计算所述第一公共密钥对应的第一哈希值;
    利用所述第一预设加密算法对所述第一随机数、所述第一哈希值和所述发送方标识进行加密,得到所述加密发送方信息。
  5. 根据权利要求2所述的方法,其中,在所述接收方为群组用户的情况下,所述利用预设加密算法对发送方标识进行加密,得到第一信息,包括:
    生成第二随机数;
    利用第二预设加密算法对所述第二随机数、所述群组用户对应的群密码和所述发送方标识进行加密,得到加密发送方信息;
    根据所述第二随机数和所述加密发送方信息,确定所述第一信息。
  6. 根据权利要求5所述的方法,在所述确定所述第一信息之后,还包括:
    生成第三随机数;
    采用所述发送方的私钥对所述第三随机数进行签名,得到第二属性信息;
    所述向服务端发送包含所述第一属性信息和所述第一消息内容的第一消息,包括:
    向所述服务端发送包含所述第一属性信息、所述第二属性信息和所述第一消息内容的第一消息。
  7. 根据权利要求6所述的方法,在所述向服务端发送包含所述第一属性信息、所述第二属性信息和所述第一消息内容的第一消息之后,还包括:
    在检测到针对所述第一消息的撤回事件被触发的情况下,生成第四随机数;
    利用所述第二预设加密算法对所述第四随机数、所述群密码和所述发送方标识进行加密,得到新的加密发送方信息;
    根据所述第四随机数和所述新的加密发送方信息,确定第三信息;
    采用所述发送方的私钥对所述第三信息进行签名,得到第四信息;
    根据所述第三信息和所述第四信息确定第三属性信息;
    向所述服务端发送包含所述第三属性信息和所述第三随机数的针对所述第一消息的第一撤回消息,所述第一撤回消息用于指示所述服务端根据所述发送 方的公钥对所述第四信息进行验签,并在验签成功后对所述第二属性信息进行验签,在验签结果与所述第一撤回消息携带的所述第三随机数一致的情况下,将包含所述第三属性信息的针对所述第一消息的第二撤回消息发送至所述第一消息对应的接收方,供所述接收方执行与所述第二撤回消息对应的消息撤回操作。
  8. 一种消息处理方法,应用于服务端,包括:
    接收发送方发送的包含第一信息和第一消息内容的第一消息,其中,所述第一信息由所述发送方利用预设加密算法对发送方标识进行加密得到;
    保存所述第一信息和所述第一消息内容;
    在满足预设发送条件的情况下,将所述第一信息和所述第一消息内容发送至所述第一消息对应的接收方,以使所述接收方根据所述第一信息进行所述发送方标识的解密。
  9. 根据权利要求8所述的方法,其中,所述接收发送方发送的包含第一信息和第一消息内容的第一消息,包括:
    接收所述发送方发送的包含第一属性信息和所述第一消息内容的第一消息,其中,所述第一属性信息由所述发送方根据所述第一信息和第二信息确定,所述第二信息由所述发送方采用所述发送方的私钥对所述第一信息进行签名得到;
    所述保存所述第一信息和所述第一消息内容,包括:
    根据所述发送方的公钥对所述第二信息进行验签,并在验签成功后,保存所述第一属性信息和所述第一消息内容;
    所述将所述第一信息和所述第一消息内容发送至所述第一消息对应的接收方,以使所述接收方根据所述第一信息进行所述发送方标识的解密,包括:
    将所述第一属性信息和所述第一消息内容发送至所述第一消息对应的接收方,以使所述接收方根据所述第一信息进行所述发送方标识的解密以及在解密成功后根据解密得到的所述发送方的公钥对所述第一属性信息中的所述第二信息进行验签。
  10. 根据权利要求9所述的方法,其中,在所述接收方为群组用户的情况下,所述接收所述发送方发送的包含第一属性信息和所述第一消息内容的第一消息,包括:
    接收所述发送方发送的包含所述第一属性信息、第二属性信息和所述第一消息内容的第一消息,其中,所述第二属性信息由所述发送方采用所述发送方的私钥对第三随机数进行签名得到,所述第三随机数由所述发送方生成;
    所述方法还包括:
    保存所述第二属性信息。
  11. 根据权利要求10所述的方法,在所述保存所述第二属性信息之后,还包括:
    接收所述发送方发送的包含第三属性信息和所述第三随机数的针对所述第一消息的第一撤回消息,其中,所述第三属性信息由第三信息和第四信息确定,所述第三信息由所述发送方根据第四随机数和新的加密发送方信息确定,所述第四随机数由所述发送方生成,所述新的加密发送方信息由所述发送方利用所述第二预设加密算法对所述第四随机数、所述群组用户对应的群密码和所述发送方标识进行加密得到,所述第四信息由所述发送方采用所述发送方的私钥对所述第三信息进行签名得到;
    根据所述发送方的公钥对所述第四信息进行验签,并在验签成功后对所述第二属性信息进行验签,在验签结果与所述第一撤回消息携带的所述第三随机数一致的情况下,将包含所述第三属性信息的针对所述第一消息的第二撤回消息发送至所述第一消息对应的接收方,其中,所述第二撤回消息用于指示所述接收方执行与所述第二撤回消息对应的消息撤回操作。
  12. 一种消息处理方法,应用于消息的接收方,包括:
    接收服务端发送的第一信息和第一消息内容,其中,所述第一信息和所述第一消息内容包含于发送方发送给所述服务端的第一消息中,所述第一信息由所述发送方利用预设加密算法对发送方标识进行加密得到;
    根据所述第一信息进行所述发送方标识的解密。
  13. 根据权利要求12所述的方法,其中,所述接收服务端发送的第一信息和第一消息内容,包括:
    接收所述服务端发送的第一属性信息和所述第一消息内容,其中,所述第一属性信息包含于所述第一消息中,并由所述发送方根据所述第一信息和第二信息确定,所述第二信息由所述发送方采用所述发送方的私钥对所述第一信息进行签名得到;
    在所述根据所述第一信息进行所述发送方标识的解密之后,还包括:
    在解密成功的情况下,根据解密得到的所述发送方标识获取所述发送方的公钥;
    根据所获取的公钥对所述第二信息进行验签。
  14. 根据权利要求13所述的方法,其中,在所述接收方为单一用户的情况 下,所述第一信息中包含第一随机数、第一随机密钥对中的第一公钥和加密发送方信息,所述第一随机数和所述第一随机密钥对由所述发送方生成,所述加密发送方信息由所述发送方利用第一预设加密算法对所述第一随机数、第一公共密钥和所述发送方标识进行加密得到,所述第一公共密钥由所述发送方利用预设密钥协商协议基于所述第一随机密钥对中的第一私钥和所述接收方的公钥生成;
    所述根据所述第一信息进行所述发送方标识的解密,包括:
    利用所述预设密钥协商协议基于所述接收方的私钥和所述第一随机密钥对中的第一公钥生成第二公共密钥;
    根据所述第二公共密钥和所述第一随机数针对所述加密发送方信息进行所述发送方标识的解密。
  15. 根据权利要求14所述的方法,其中,所述加密发送方信息由所述发送方利用第一预设加密算法对所述第一随机数、第一公共密钥对应的第一哈希值和所述发送方标识进行加密得到;
    所述根据所述第二公共密钥和所述第一随机数针对所述加密发送方信息进行所述发送方标识的解密,包括:
    利用预设哈希算法计算所述第二公共密钥对应的第二哈希值;
    根据所述第二哈希值和所述第一随机数针对所述加密发送方信息进行所述发送方标识的解密。
  16. 根据权利要求13所述的方法,其中,在所述接收方为群组用户的情况下,所述第一信息中包含第二随机数和加密发送方信息,所述第二随机数由所述发送方生成,所述加密发送方信息由所述发送方利用第二预设加密算法对所述第二随机数、所述群组用户对应的群密码和所述发送方标识进行加密得到;
    所述根据所述第一信息进行发送方标识的解密,包括:
    根据所述第二随机数和所述群密码针对所述加密发送方信息进行所述发送方标识的解密。
  17. 根据权利要求16所述的方法,在所述根据所述第二随机数和所述群密码针对所述加密发送方信息进行所述发送方标识的解密之后,还包括:
    接收所述服务端发送的包含第三属性信息的针对所述第一消息的第二撤回消息,其中,所述第三属性信息包含于所述发送方向所述服务端发送的针对所述第一消息的第一撤回消息中,所述第三属性信息由第三信息和第四信息确定,所述第三信息由所述发送方根据第四随机数和新的加密发送方信息确定,所述 第四随机数由所述发送方生成,所述新的加密发送方信息由所述发送方利用所述第二预设加密算法对所述第四随机数、所述群密码和所述发送方标识进行加密得到,所述第四信息由所述发送方采用所述发送方的私钥对所述第三信息进行签名得到;
    根据所述第四随机数和所述群密码针对所述新的加密发送方信息进行所述发送方标识的解密;
    在解密成功的情况下,根据解密得到的所述发送方标识获取所述发送方的公钥;
    根据所获取的公钥对所述第四信息进行验签,在验签成功的情况下,针对所述第一消息进行所述第二撤回消息对应的撤回操作。
  18. 一种消息处理装置,配置于消息的发送方,包括:
    发送方标识加密模块,设置为利用预设加密算法对发送方标识进行加密,得到第一信息;
    消息发送模块,设置为向服务端发送包含所述第一信息和第一消息内容的第一消息,其中,所述第一消息用于指示所述服务端保存所述第一信息和所述第一消息内容,并在满足预设发送条件的情况下,将所述第一信息和所述第一消息内容发送至所述第一消息对应的接收方,供所述接收方根据所述第一信息进行所述发送方标识的解密。
  19. 一种消息处理装置,配置于服务端,包括:
    消息接收模块,设置为接收发送方发送的包含第一信息和第一消息内容的第一消息,其中,所述第一信息由所述发送方利用预设加密算法对发送方标识进行加密得到;
    保存模块,设置为保存所述第一信息和所述第一消息内容;
    消息发送模块,设置为在满足预设发送条件的情况下,将所述第一信息和所述第一消息内容发送至所述第一消息对应的接收方,以使所述接收方根据所述第一信息进行所述发送方标识的解密。
  20. 一种消息处理装置,配置于消息的接收方,包括:
    消息接收模块,设置为接收服务端发送的第一信息和第一消息内容,其中,所述第一信息和所述第一消息内容包含于发送方发送给所述服务端的第一消息中,所述第一信息由所述发送方利用预设加密算法对发送方标识进行加密得到;
    发送方标识解密模块,设置为根据所述第一信息进行所述发送方标识的解密。
  21. 一种计算机设备,包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机程序,其中,所述处理器执行所述计算机程序时实现如权利要求1-17任一项所述的消息处理方法。
  22. 一种计算机可读存储介质,存储有计算机程序,其中,所述程序被处理器执行时实现如权利要求1-17中任一所述的消息处理方法。
PCT/CN2021/093918 2020-07-28 2021-05-14 消息处理方法、装置、设备及存储介质 WO2022022009A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010737744.7A CN111914291A (zh) 2020-07-28 2020-07-28 消息处理方法、装置、设备及存储介质
CN202010737744.7 2020-07-28

Publications (1)

Publication Number Publication Date
WO2022022009A1 true WO2022022009A1 (zh) 2022-02-03

Family

ID=73280204

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/093918 WO2022022009A1 (zh) 2020-07-28 2021-05-14 消息处理方法、装置、设备及存储介质

Country Status (2)

Country Link
CN (1) CN111914291A (zh)
WO (1) WO2022022009A1 (zh)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023231817A1 (zh) * 2022-05-31 2023-12-07 腾讯科技(深圳)有限公司 数据处理方法、装置、计算机设备及存储介质
CN117834138A (zh) * 2024-03-04 2024-04-05 北卡科技有限公司 一种适用于即时通信的密钥协商方法、***、设备及介质
WO2024098550A1 (zh) * 2022-11-10 2024-05-16 阿里巴巴(中国)有限公司 数据中用户标识的加解密方法、***及设备

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111914291A (zh) * 2020-07-28 2020-11-10 广州市百果园信息技术有限公司 消息处理方法、装置、设备及存储介质
CN114501417A (zh) * 2020-11-12 2022-05-13 华为技术有限公司 一种信息发送方法及装置
CN113204794B (zh) * 2021-07-02 2021-10-15 深圳市深圳通有限公司 交易记录安全存储方法、装置、设备及存储介质
CN113783847B (zh) * 2021-08-24 2023-06-30 上海浦东发展银行股份有限公司 消息交互方法、装置、计算机设备和存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130219166A1 (en) * 2012-02-20 2013-08-22 Motorola Mobility, Inc. Hardware based identity manager
CN103916310A (zh) * 2014-03-28 2014-07-09 北京奇虎科技有限公司 发送即时通信消息的方法、即时通信客户端和服务器
CN108667718A (zh) * 2018-04-26 2018-10-16 济南浪潮高新科技投资发展有限公司 一种即时通信***及其通信方法
CN108833373A (zh) * 2018-05-29 2018-11-16 东北大学 面向关系隐私保护社交网络的即时通信与匿名访问方法
CN111914291A (zh) * 2020-07-28 2020-11-10 广州市百果园信息技术有限公司 消息处理方法、装置、设备及存储介质

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB2415579B (en) * 2004-06-23 2006-12-20 Hewlett Packard Development Co Cryptographic method and apparatus
CN101834806B (zh) * 2010-03-25 2012-10-24 盈世信息科技(北京)有限公司 一种邮件撤回方法及***
CN103166832A (zh) * 2011-12-15 2013-06-19 腾讯科技(深圳)有限公司 一种发送消息的方法和服务器

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130219166A1 (en) * 2012-02-20 2013-08-22 Motorola Mobility, Inc. Hardware based identity manager
CN103916310A (zh) * 2014-03-28 2014-07-09 北京奇虎科技有限公司 发送即时通信消息的方法、即时通信客户端和服务器
CN108667718A (zh) * 2018-04-26 2018-10-16 济南浪潮高新科技投资发展有限公司 一种即时通信***及其通信方法
CN108833373A (zh) * 2018-05-29 2018-11-16 东北大学 面向关系隐私保护社交网络的即时通信与匿名访问方法
CN111914291A (zh) * 2020-07-28 2020-11-10 广州市百果园信息技术有限公司 消息处理方法、装置、设备及存储介质

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023231817A1 (zh) * 2022-05-31 2023-12-07 腾讯科技(深圳)有限公司 数据处理方法、装置、计算机设备及存储介质
WO2024098550A1 (zh) * 2022-11-10 2024-05-16 阿里巴巴(中国)有限公司 数据中用户标识的加解密方法、***及设备
CN117834138A (zh) * 2024-03-04 2024-04-05 北卡科技有限公司 一种适用于即时通信的密钥协商方法、***、设备及介质
CN117834138B (zh) * 2024-03-04 2024-05-24 北卡科技有限公司 一种适用于即时通信的密钥协商方法、***、设备及介质

Also Published As

Publication number Publication date
CN111914291A (zh) 2020-11-10

Similar Documents

Publication Publication Date Title
WO2022022009A1 (zh) 消息处理方法、装置、设备及存储介质
US11533297B2 (en) Secure communication channel with token renewal mechanism
US20180013555A1 (en) Data transmission method and apparatus
US7149311B2 (en) Methods and apparatus for providing networked cryptographic devices resilient to capture
CN108111497B (zh) 摄像机与服务器相互认证方法和装置
US8433066B2 (en) Method for generating an encryption/decryption key
US20180219688A1 (en) Information Transmission Method and Mobile Device
CN109951513B (zh) 基于量子密钥卡的抗量子计算智能家庭量子云存储方法和***
US9942042B1 (en) Key containers for securely asserting user authentication
CN110505055B (zh) 基于非对称密钥池对和密钥卡的外网接入身份认证方法和***
CN111294203B (zh) 信息传输方法
US11438316B2 (en) Sharing encrypted items with participants verification
JP2019514314A (ja) 暗号化メッセージを送受信するために動的公開鍵インフラストラクチャを用いる方法、システム、及び媒体
CN108768613A (zh) 一种基于多种加密算法的密文口令校验方法
CN113347143B (zh) 一种身份验证方法、装置、设备及存储介质
WO2023151479A1 (zh) 数据处理方法及设备
CN115473655B (zh) 接入网络的终端认证方法、装置及存储介质
US20240106633A1 (en) Account opening methods, systems, and apparatuses
WO2023116266A1 (zh) 通信加密方法、***和装置
CN116366364A (zh) 一种用于云电脑的终端数据处理方法及***
CN107623571B (zh) 一种握手处理方法、客户端及服务器
CN115412236A (zh) 一种密钥管理和密码计算的方法、加密方法及装置
CN111212068B (zh) 一种输入法对文字加解密的方法
CN113475038A (zh) 使用半信任中介的安全消息传递
CN112350920A (zh) 基于区块链的即时通讯***

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21848595

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21848595

Country of ref document: EP

Kind code of ref document: A1