CN107786423B - A kind of method and system of instant messaging - Google Patents

A kind of method and system of instant messaging Download PDF

Info

Publication number
CN107786423B
CN107786423B CN201610756597.1A CN201610756597A CN107786423B CN 107786423 B CN107786423 B CN 107786423B CN 201610756597 A CN201610756597 A CN 201610756597A CN 107786423 B CN107786423 B CN 107786423B
Authority
CN
China
Prior art keywords
message
account
terminal
server
connect
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201610756597.1A
Other languages
Chinese (zh)
Other versions
CN107786423A (en
Inventor
彭继录
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Melt World Network Technology Co Ltd
Original Assignee
Beijing Melt World Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Melt World Network Technology Co Ltd filed Critical Beijing Melt World Network Technology Co Ltd
Priority to CN201610756597.1A priority Critical patent/CN107786423B/en
Publication of CN107786423A publication Critical patent/CN107786423A/en
Application granted granted Critical
Publication of CN107786423B publication Critical patent/CN107786423B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/04Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
    • H04L63/0428Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • H04L51/21Monitoring or handling of messages
    • H04L51/23Reliability checks, e.g. acknowledgments or fault reporting
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • H04L51/52User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail for supporting social networking services
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/06Network architectures or network communication protocols for network security for supporting key management in a packet data network
    • H04L63/067Network architectures or network communication protocols for network security for supporting key management in a packet data network using one-time keys

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Computing Systems (AREA)
  • Computer Hardware Design (AREA)
  • General Engineering & Computer Science (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention discloses a kind of methods, devices and systems of instant messaging, belong to instant messaging field.The described method includes: terminal to server sends the first connection CONNECT message, the first account identification is carried in the first CONNECT message;The terminal receives the connection that the server is sent and returns to CONACK message, carries random string in the extension load of the CONACK message;The terminal is based on the random string and encrypts to the first account password, sends the 2nd CONNECT message to server, carries first account identification and encrypted first account password in the 2nd CONNECT message.Using the present invention, account security when carrying out IM business is preferable.

Description

A kind of method and system of instant messaging
Technical field
The present invention relates to instant messaging field, in particular to a kind of methods, devices and systems of instant messaging.
Background technique
MQTT (Message Queuing Telemetry Transport, message queue telemetering transmission) agreement is to be used for Computing capability is limited, and the control equipment that the distance sensor to work under low bandwidth, unstable network environment is corresponding The instant communication protocol communicated, is based on MQTT agreement, and distance sensor can be established by a small amount of bandwidth and control equipment Instant messaging connection, such as: after temperature sensor has detected temperature, temperature data can be published to by service by MQTT agreement Device, temperature data can be subscribed to by MQTT agreement from server by then controlling equipment.
MQTT agreement can apply in IM (Instant Messaging, instant messaging) business, carry out in both sides During instant messaging, IM client of the message sender (i.e. Party A) using installation at the terminal, (even by CONNECT Connecing) message sends username and password to IM server and logged in, and logining successfully rear server can be by CONACK (even Connect return) message to Party A return log in confirmation.Party A can be thought by PUBLISH (publication) message to server transmission later The account identification of the communication message and message receiver (i.e. Party B) to be sent, IM server are receiving communication message and Party B Account identification after, can first check whether Party B has subscribed Party A by SUBSCRIBE (subscription) message and be sent to Party B Communication message, if so, IM server then can send above-mentioned communication message to the terminal of Party B by PUBLISH message.
In the implementation of the present invention, the inventor finds that the existing technology has at least the following problems:
During logging in IM server using CONNECT message, the account and password of user is directly recorded in It, can be directly from can in this way, if stranger is truncated to CONNECT message in the corresponding byte of variable header of CONNECT message Become in header and obtains the account and password of user, thus, account security when carrying out IM business is poor.
Summary of the invention
In order to solve problems in the prior art, the embodiment of the invention provides a kind of method and systems of instant messaging.Institute It is as follows to state technical solution:
In a first aspect, providing a kind of method of instant messaging, which comprises
Terminal to server sends the first connection CONNECT message, carries the first account in the first CONNECT message Family mark;
The terminal receives the connection that the server is sent and returns to CONACK message, and the extension of the CONACK message carries Random string is carried in lotus;
The terminal is based on the random string and encrypts to the first account password, sends second to server CONNECT message carries first account identification in the 2nd CONNECT message and encrypted first account is close Code.
Optionally, added with extension load, the extension of the 2nd CONNECT message in the 2nd CONNECT message Login negotiation information is carried in load;Wherein, the login negotiation information includes at least one of following information information: number According to transmission mode, data compression scheme, client type, client release number.
In this way, the login negotiation information that server can be sent based on terminal carries out login process to the first account.
Optionally, the method also includes:
The terminal sends publication PUBLISH message to the server, carries target account in the PUBLISH message The account identification and account status parameter at family;
The terminal receives the publication response PUBACK message that the server is sent, and the PUBACK message is added with expansion Load is opened up, the parameter of the account status parameter of the target account is carried in the extension load of the PUBACK message Value, shows the parameter value of the account status parameter of the target account.
In this way, user is available to account status information such as presence, the pet names of target account.
Optionally, the first CONNECT message is carried added with extension load, the extension of the first CONNECT message All message expansion types that record has the terminal to support in lotus.
In this way, server can know terminal support all message expansion types, and using corresponding amplifying message with Terminal carries out instant messaging.
Second aspect provides a kind of method of instant messaging, which comprises
The first CONNECT message that server receiving terminal is sent carries the first account in the first CONNECT message Family mark;
The server generates random string, and sends the CONACK message added with extension load to the terminal, Random string is carried in the extension load of the CONACK message;
The server receives the 2nd CONNECT message that the terminal is sent, and carries in the 2nd CONNECT message There are first account identification and encrypted first account password;
The server is based on the random string and encrypted first account password is decrypted, according to institute It states the first account identification and first account password and login process is carried out to the first account.
Optionally, added with extension load, the extension of the 2nd CONNECT message in the 2nd CONNECT message Login negotiation information is carried in load;
It is described that login process, packet are carried out to the first account according to first account identification and first account password It includes:
The server negotiates letter according to first account identification and first account password and the login Breath carries out login process to the first account;
Wherein, the login negotiation information includes at least one of following information information:
Data transfer mode, data compression scheme, client type, client release number.
In this way, the login negotiation information that server can be sent based on terminal carries out login process to the first account.
Optionally, the method also includes:
The server receives the PUBLISH message that the terminal is sent, and carries target account in the PUBLISH message The account identification and account status parameter at family;
The server obtains the parameter value of the account status parameter of the target account;
The server sends PUBACK message to the terminal, and the PUBACK message is described added with extension load Record has the parameter value of the account status parameter of the target account in the extension load of PUBACK message.
In this way, user is available to account status information such as presence, the pet names of target account.
Optionally, the first CONNECT message is carried added with extension load, the extension of the first CONNECT message All message expansion types that record has terminal to support in lotus;
The server sends PUBACK message to the terminal, comprising: if all messages that the terminal is supported expand Opening up includes PUBACK message expansion type in type, and the server then sends PUBACK message to the terminal.
In this way, server can know terminal support all message expansion types, and using corresponding amplifying message with Terminal carries out instant messaging.
The third aspect provides a kind of system of instant messaging, and the system comprises terminal and servers, in which:
The terminal is taken in the first CONNECT message for sending the first CONNECT message to the server With the first account identification;The CONACK message that the server is sent is received, is taken in the extension load of the CONACK message With random string;The first account password is encrypted based on the random string, sends second to server CONNECT message carries first account identification in the 2nd CONNECT message and encrypted first account is close Code;
The server, the first CONNECT message sent for receiving the terminal, the first CONNECT message In carry first account identification;Random string is generated, and is sent to the terminal added with extension load CONACK message carries random string in the extension load of the CONACK message;The server receives the terminal The 2nd CONNECT message sent carries first account identification and encrypted the in the 2nd CONNECT message One account password;The server is based on the random string and encrypted first account password is decrypted, root Login process is carried out to the first account according to first account identification and first account password.
Technical solution provided in an embodiment of the present invention has the benefit that
In the embodiment of the present invention, terminal to server sends the first connection CONNECT message, in the first CONNECT message The first account identification is carried, terminal receives the connection that server is sent and returns to CONACK message, and the extension of CONACK message carries Carry random string in lotus, terminal is based on random string and encrypts to the first account password, sends the to server Two CONNECT messages carry the first account identification and encrypted first account password in the 2nd CONNECT message.In this way, During logging in IM server using CONNECT message, terminal can be based on the random string reconciliation of server transmission Family password is encrypted, and the password of user can not be directly obtained stranger is truncated to CONNECT message, thus, it carries out Account security when IM business is preferable.
Detailed description of the invention
To describe the technical solutions in the embodiments of the present invention more clearly, make required in being described below to embodiment Attached drawing is briefly described, it should be apparent that, drawings in the following description are only some embodiments of the invention, for For those of ordinary skill in the art, without creative efforts, it can also be obtained according to these attached drawings other Attached drawing.
Fig. 1 is a kind of method flow diagram of instant messaging provided in an embodiment of the present invention;
Fig. 2 is a kind of method flow diagram of instant messaging provided in an embodiment of the present invention;
Fig. 3 is a kind of system framework schematic diagram provided in an embodiment of the present invention;
Fig. 4 is a kind of schematic diagram of amplifying message structure provided in an embodiment of the present invention;
Fig. 5 is a kind of structural schematic diagram of terminal provided in an embodiment of the present invention;
Fig. 6 is a kind of structural schematic diagram of server provided in an embodiment of the present invention.
Specific embodiment
To make the object, technical solutions and advantages of the present invention clearer, below in conjunction with attached drawing to embodiment party of the present invention Formula is described in further detail.
The embodiment of the invention provides a kind of method of instant messaging, this method can be jointly real by terminal and server It is existing, wherein terminal can be the terminal for having instant communication function, can be the terminal of instant messaging initiator, is also possible to The terminal of instant messaging answer party can be equipped with instant messaging application program (can be described as IM client) in terminal, and terminal can To be mobile phone, computer etc., server can be the corresponding server of instant messaging application program (can be described as IM server).Eventually Processor, memory, transceiver can be set in end, processor can be used for the relevant treatment of instant messaging, and memory can The data for needing and generating in following treatment processes for storage, transceiver can be used for sending and receiving message and data. Terminal is also provided with screen, input unit, and screen can be used to show interface, instant communication information of IM client etc., Input unit can be used to receive the dependent instruction of user's input.Processor, memory, transmitting-receiving can be set in server Device, processor can be used for the relevant treatment of instant messaging, and memory, which can be used for storing in following treatment processes, to be needed and produce Raw data, transceiver can be used for sending and receiving message and data.In the present embodiment, taking the terminal as an example to scheme Mainly illustrated, can also carry out brief description to other situations at necessity.The frame diagram of system can be as shown in Figure 3.
Below in conjunction with specific embodiment, process flow shown in FIG. 1 is described in detail, content can be as Under:
Step 101, terminal to server sends the first CONNECT message, carries the first account in the first CONNECT message Family mark.
Wherein, CONNECT message is to establish connection, and login service device for terminal and server in MQTT agreement Message.
In an implementation, the IM client that instant messaging is carried out based on MQTT agreement can be installed in the terminal (i.e. terminal) of user End can be clicked to open and install at the terminal when user is desired carries out IM business by the IM client and other users At this moment IM client can show login interface on the screen of terminal, user then can in login interface corresponding input frame The account (i.e. the first account identification) and password of middle input instant messaging account, in turn, terminal is available and cache user is defeated The first account identification and the first account password entered.Later, terminal can record the first account identification to CONNECT message In the variable corresponding byte of header, the first CONNECT message is generated, thus, terminal can then be sent to server carry the First CONNECT message of one account identification.It is noted that extended byte can be added in the first CONNECT message Section (i.e. extension load), supports the extension of CONNECT/CONACK message for tell the server terminal, correspondingly, can be based on existing There is the structure of CONNECT message, modifies remainder bytes length value in the fixed header of CONNECT message, modified residue word It saves length value and is equal to the byte length of variable header and the sum of the byte length of extension load, in this way, can then be reported in CONNECT Successfully addition extends load in text.
Optionally, the message expansion type that terminal can be supported with tell the server terminal, correspondingly, first CONNECT message is added with load is extended, and record has all messages of terminal support in the extension load of the first CONNECT message Expansion type.
In an implementation, it can recorde all messages extension of terminal support in the extension load of the first CONNECT message Type is used to indicate end specifically, Magic Number (magic number) can be set in preceding 2 bytes in extension load Whether end supports message to extend and the compatibility that keeps down, and can be defined as follows two values:
1.0xFF0xFE indicates that client only supports CONNECT/CONNACK message to extend;
2.0xFF0xFF indicates that client supports that CONNECT/CONNACK message extends and PUBACK message expands simultaneously Exhibition.
It is understood that being uniformly processed for facilitation, also can be set in the 2nd CONNECT message identical Magic number.
Step 102, the first CONNECT message that server receiving terminal is sent carries the in the first CONNECT message One account identification.
In an implementation, after terminal to server sends the first CONNECT message, server can receive terminal hair The first CONNECT message sent, and obtain the first account identification carried in the first CONNECT message.
Step 103, server generates random string, and sends the CONACK message added with extension load to terminal, Random string is carried in the extension load of CONACK message.
Wherein, CONACK message is the message in MQTT agreement, for being replied CONNECT message.
In an implementation, server, can be raw by random algorithm after the first CONNECT message for receiving terminal transmission At random string, then random string can be recorded into the extension load of CONACK message, in turn, server can be with The CONACK message for carrying random string is sent to terminal.Meanwhile server can be by random string and the first account Mark carries out corresponding storage.Addition extends the mode of load and adds extension in CONNECT message and carries in CONACK message The mode of lotus is identical, and details are not described herein again.It should be noted that only being added when in the first CONNECT message that terminal is sent When having extension load, server just can send the CONACK message added with extension load to terminal, if the first CONNECT Extension load it has been not added in message, server, can after receiving and carrying the first CONNECT message of the first account identification To refuse the logging request of terminal.
Step 104, the connection that terminal receives that server is sent returns to CONACK message, in the extension load of CONACK message Carry random string.
In an implementation, after server sends CONACK message to terminal, terminal can receive the CONACK message, And obtain the random string recorded in the extension load of the CONACK message.
Step 105, terminal encrypts the first account password based on random string, sends second to server CONNECT message carries the first account identification and encrypted first account password in the 2nd CONNECT message.
It in an implementation, can be based on random string to having delayed after terminal receives the random string of server transmission The first account password deposit, user's input is encrypted, and existing encryption can be selected in encryption herein, therefore And no longer the concrete mode of encryption is defined in the present embodiment.Terminal, can be with after to the encryption of the first account password First account identification and encrypted first account password are recorded into the variable header of CONNECT message, generate second CONNECT message, so that terminal can be sent to server carries the first account identification and encrypted first account password The 2nd CONNECT message.Herein, the 2nd CONNECT message can be the CONNECT message added with extension load.
Optionally, when carrying out Account Logon, terminal can send to server and log in negotiation information, correspondingly, second Added with load is extended in CONNECT message, login negotiation information is carried in the extension load of the 2nd CONNECT message;Its In, logging in negotiation information includes at least one of following information information: data transfer mode, data compression scheme, client Type, client release number.
In an implementation, terminal is available to be mounted on local IM visitor after the first account password is encrypted Client type, the client release number at family end etc. log in negotiation information, while can also obtain the data that terminal is supported and pass Defeated mode, data compression scheme etc. log in negotiation information.It is noted that when login negotiation information is terminal login service device The various information needed comprising but above- mentioned information are not limited only to, the processing of other information is similar, no longer says one by one herein It is bright.After terminal obtains login negotiation information, the extension load that the 2nd CONNECT message is written in negotiation information can will be logged in In, and the first account identification and encrypted first account password are recorded into the variable header of CONNECT message, generates the Two CONNECT messages.
Step 106, the 2nd CONNECT message that server receiving terminal is sent carries the in the 2nd CONNECT message One account identification and encrypted first account password.
In an implementation, terminal to server send the 2nd CONNECT message after, server can receive this second CONNECT message, and obtain the first account identification and encrypted first account password carried in the 2nd CONNECT message.
Step 107, server is decrypted encrypted first account password based on random string, according to the first account Family mark and the first account password carry out login process to the first account.
In an implementation, server, can first basis after obtaining the first account identification and an encrypted account password First account identification determines its corresponding random string, later can be close to encrypted first account based on random string Code is decrypted, and herein, the mode of decryption and the mode of encryption are corresponding, can be what server consulted in advance with terminal, Prior art can be selected, does not do excessive explanation herein.After the completion of decryption, server can be according to the first account identification and first Account password carries out login process to the first account.It should be noted that the login process at this and the login in other agreements Processing is substantially similar, is the prior art, therefore is no longer described in detail.
Optionally, the case where logging in negotiation information, step are carried in the extension load based on above-mentioned 2nd CONNECT message Rapid 107 part processing can be such that according to the first account identification and the first account password, and log in negotiation information, to the One account carries out login process.
In an implementation, after the 2nd CONNECT message that server receives terminal transmission, available second The first account identification and the first account password carried in CONNECT message, and negotiation information is logged in, it later can be according to upper It states information and login process is carried out to the first account.Herein, by taking data compression scheme as an example, terminal passes through the 2nd CONNECT message The data compression scheme that tell the server terminal is supported includes A, B, and server can choose after receiving the 2nd CONNECT message The data compression scheme A that server is also supported, and login process and subsequent is carried out to the first account based on data compression scheme A Instant messaging processing.
Optionally, terminal can also obtain the account status data of other accounts from server, correspondingly, such as Fig. 2 institute Show, the processing after step 107 may include steps of:
Step 201: terminal to server sends publication PUBLISH message, carries target account in PUBLISH message Account identification and account status parameter.
Wherein, account status parameter can be the specific data for reacting target account state, such as presence, account The pet name, account latest tendency etc., PUBLISH message are in MQTT agreement, for transmitting message between terminal and server Message.
In an implementation, when terminal and server establish connection, and after login service device, terminal can be automatically from server The account status parameter of subscription account (i.e. target account), such as presence, the pet name of target account are obtained, specifically, Terminal can first determine the corresponding subscription account of the first account, then by the account identification of target account and account status parameter Record into the payload of PUBLISH, thus terminal can to server send carry target account account identification and The PUBLISH message of account status parameter.In addition, when the specific account status parameter of the desired acquisition target account of user, such as Latest tendency, log of target account etc., the state that can also click target account obtains key, so that terminal can be by target The account identification of account and specific account status reference record are into the payload of PUBLISH message, so that terminal can be with The PUBLISH message of the account identification and account status parameter that carry target account is sent to server.
Step 202, the PUBLISH message that server receiving terminal is sent carries target account in PUBLISH message Account identification and account status parameter;
In an implementation, after terminal to server sends PUBLISH message, server can receive PUBLISH report Text, and obtain the account identification and account status parameter of the target account carried in PUBLISH message.
Step 203, server obtains the parameter value of the account status parameter of target account.
In an implementation, server, can be in local after the account identification and account status parameter for getting target account Memory space in search the corresponding account data of account identification of target account, and above-mentioned account shape is searched in account data The parameter value of state parameter.It is noted that the parameter value of the account status parameter of target account can be target account login After server, after target account is automatically transmitted to server or server receives above-mentioned PUBLISH message, from mesh Mark acquisition at account.
Step 204, server sends PUBACK message to terminal, and PUBACK message is added with extension load, PUBACK report Record has the parameter value of the account status parameter of target account in the extension load of text.
Wherein, PUBACK message is in MQTT agreement, for reply to PUBLISH message the message of response.
In an implementation, server, can be by the parameter after getting the parameter value of account status parameter of target account Value record generates PUBACK message into the extension load of PUBACK message, so that server can send PUBACK to terminal Message.Herein, the processing of addition extension load and the processing that extension load is added in CONNECT message in PUBACK message Similar, details are not described herein again.
Optionally, based on the processing for being provided with magic number in above-mentioned first CONNECT message, correspondingly, the processing of step 204 It can be such that if including PUBACK message expansion type in all message expansion types that the terminal is supported, if server PUBACK message is sent to terminal.
In an implementation, after server receives the first CONNECT message that terminal is sent, available its extends in load Then the magic number of record determines all message expansion types of terminal support according to the value of the evil spirit number.Server is receiving end After the PUBLISH message of account identification and account status parameter that end is sent, carrying target account, terminal can be first judged Whether support PUBACK message to extend, if terminal supports the extension of PUBACK message, sends PUBACK report to terminal if server Text;If terminal does not support PUBACK message to extend, server if, refuses this request, and request failure can be sent to terminal Message.
Step 205, terminal receives the PUBACK message that server is sent, and PUBACK message is added with extension load, The parameter value of the account status parameter of target account, the account of displaying target account are carried in the extension load of PUBACK message The parameter value of state parameter.
In an implementation, the parameter value of the account status parameter of target account is carried to terminal transmission in server After PUBACK message, terminal can receive the PUBACK message, and can get from the extension load of PUBACK message The parameter value can be shown to user by the parameter value of the account status parameter of target account, in turn, terminal.
It should be noted that three kinds of messages of CONNECT message, CONACK message involved in this programme and PUBACK message Message extension, can improve it is existing using MQTT carry out IM business function, in addition to specified otherwise in this programme, using MQTT into Remaining processing of row IM business can refer to existing processing mode.Meanwhile three kinds of amplifying message structures that this programme provides can be with Compatible with former message structure, server and terminal can carve if necessary amplifying message structure being switched to former message structure.Fig. 4 Simply show the structure of amplifying message.
In the embodiment of the present invention, terminal to server sends the first connection CONNECT message, in the first CONNECT message The first account identification is carried, terminal receives the connection that server is sent and returns to CONACK message, and the extension of CONACK message carries Carry random string in lotus, terminal is based on random string and encrypts to the first account password, sends the to server Two CONNECT messages carry the first account identification and encrypted first account password in the 2nd CONNECT message.In this way, During logging in IM server using CONNECT message, terminal can be based on the random string reconciliation of server transmission Family password is encrypted, and the password of user can not be directly obtained stranger is truncated to CONNECT message, thus, it carries out Account security when IM business is preferable.
Based on the same technical idea, the embodiment of the invention also provides a kind of system of instant messaging, system includes eventually End and server, in which:
The terminal is taken in the first CONNECT message for sending the first CONNECT message to the server With the first account identification;The CONACK message that the server is sent is received, is taken in the extension load of the CONACK message With random string;The first account password is encrypted based on the random string, sends second to server CONNECT message carries first account identification in the 2nd CONNECT message and encrypted first account is close Code;
The server, the first CONNECT message sent for receiving the terminal, the first CONNECT message In carry first account identification;Random string is generated, and is sent to the terminal added with extension load CONACK message carries random string in the extension load of the CONACK message;The server receives the terminal The 2nd CONNECT message sent carries first account identification and encrypted the in the 2nd CONNECT message One account password;The server is based on the random string and encrypted first account password is decrypted, root Login process is carried out to the first account according to first account identification and first account password.
In the embodiment of the present invention, terminal to server sends the first connection CONNECT message, in the first CONNECT message The first account identification is carried, terminal receives the connection that server is sent and returns to CONACK message, and the extension of CONACK message carries Carry random string in lotus, terminal is based on random string and encrypts to the first account password, sends the to server Two CONNECT messages carry the first account identification and encrypted first account password in the 2nd CONNECT message.In this way, During logging in IM server using CONNECT message, terminal can be based on the random string reconciliation of server transmission Family password is encrypted, and the password of user can not be directly obtained stranger is truncated to CONNECT message, thus, it carries out Account security when IM business is preferable.
The embodiment of the invention also provides a kind of terminals, referring to FIG. 5, it illustrates use involved in the embodiment of the present invention In the terminal structure schematic diagram of instant messaging, which can be used for implementing the side of the instant messaging provided in above-described embodiment Method.Specifically:
Terminal 500 may include RF (Radio Frequency, radio frequency) circuit 110, include one or more meter The memory 120 of calculation machine readable storage medium storing program for executing, input unit 130, display unit 140, sensor 150, voicefrequency circuit 160, WiFi (wireless fidelity, Wireless Fidelity) module 170, the processing for including one or more than one processing core The components such as device 180 and power supply 190.It will be understood by those skilled in the art that terminal structure shown in Fig. 5 is not constituted pair The restriction of terminal may include perhaps combining certain components or different component cloth than illustrating more or fewer components It sets.Wherein:
RF circuit 110 can be used for receiving and sending messages or communication process in, signal sends and receivees, particularly, by base station After downlink information receives, one or the processing of more than one processor 170 are transferred to;In addition, the data for being related to uplink are sent to Base station.In general, RF circuit 110 includes but is not limited to antenna, at least one amplifier, tuner, one or more oscillators, uses Family identity module (SIM) card, transceiver, coupler, LNA (Low Noise Amplifier, low-noise amplifier), duplex Device etc..In addition, RF circuit 110 can also be communicated with network and other equipment by wireless communication.The wireless communication can make With any communication standard or agreement, and including but not limited to GSM (Global System of Mobile communication, entirely Ball mobile communcations system), GPRS (General Packet Radio Service, general packet radio service), CDMA (Code Division Multiple Access, CDMA), WCDMA (Wideband Code Division Multiple Access, wideband code division multiple access), LTE (Long Term Evolution, long term evolution), Email, SMS (Short Messaging Service, short message service) etc..
Memory 120 can be used for storing software program and module, and processor 180 is stored in memory 120 by operation Software program and module, thereby executing various function application and data processing.Memory 120 can mainly include storage journey Sequence area and storage data area, wherein storing program area can the (ratio of application program needed for storage program area, at least one function Such as sound-playing function, image player function) etc.;Storage data area, which can be stored, uses created number according to terminal 500 According to (such as audio data, phone directory etc.) etc..In addition, memory 120 may include high-speed random access memory, can also wrap Include nonvolatile memory, a for example, at least disk memory, flush memory device or other volatile solid-state parts. Correspondingly, memory 120 can also include Memory Controller, to provide processor 180 and input unit 130 to memory 120 access.
Input unit 130 can be used for receiving the number or character information of input, and generate and user setting and function Control related keyboard, mouse, operating stick, optics or trackball signal input.Specifically, input unit 130 may include touching Sensitive surfaces 131 and other input equipments 132.Touch sensitive surface 131, also referred to as touch display screen or Trackpad are collected and are used Family on it or nearby touch operation (such as user using any suitable object or attachment such as finger, stylus in touch-sensitive table Operation on face 131 or near touch sensitive surface 131), and corresponding attachment device is driven according to preset formula.It is optional , touch sensitive surface 131 may include both touch detecting apparatus and touch controller.Wherein, touch detecting apparatus detection is used The touch orientation at family, and touch operation bring signal is detected, transmit a signal to touch controller;Touch controller is from touch Touch information is received in detection device, and is converted into contact coordinate, then gives processor 180, and can receive processor 180 The order sent simultaneously is executed.Furthermore, it is possible to using multiple types such as resistance-type, condenser type, infrared ray and surface acoustic waves Realize touch sensitive surface 131.In addition to touch sensitive surface 131, input unit 130 can also include other input equipments 132.Specifically, Other input equipments 132 can include but is not limited to physical keyboard, function key (such as volume control button, switch key etc.), One of trace ball, mouse, operating stick etc. are a variety of.
Display unit 140 can be used for showing information input by user or the information and terminal 700 that are supplied to user Various graphical user interface, these graphical user interface can be made of figure, text, icon, video and any combination thereof. Display unit 140 may include display panel 141, optionally, can use LCD (Liquid Crystal Display, liquid crystal Show device), the forms such as OLED (Organic Light-Emitting Diode, Organic Light Emitting Diode) configure display panel 141.Further, touch sensitive surface 131 can cover display panel 141, when touch sensitive surface 131 detects touching on it or nearby After touching operation, processor 180 is sent to determine the type of touch event, is followed by subsequent processing device 180 according to the type of touch event Corresponding visual output is provided on display panel 141.Although touch sensitive surface 131 and display panel 141 are conducts in Fig. 5 Two independent components realize input and input function, but in some embodiments it is possible to by touch sensitive surface 131 and display Panel 141 is integrated and realizes and outputs and inputs function.
Terminal 500 may also include at least one sensor 150, such as optical sensor, motion sensor and other sensings Device.Specifically, optical sensor may include ambient light sensor and proximity sensor, wherein ambient light sensor can be according to environment The light and shade of light adjusts the brightness of display panel 141, and proximity sensor can close display when terminal 700 is moved in one's ear Panel 141 and/or backlight.As a kind of motion sensor, gravity accelerometer can detect in all directions (generally Three axis) acceleration size, can detect that size and the direction of gravity when static, can be used to identify mobile phone posture application (ratio Such as horizontal/vertical screen switching, dependent game, magnetometer pose calibrating), Vibration identification correlation function (such as pedometer, tap);Extremely In other sensors such as gyroscope, barometer, hygrometer, thermometer, the infrared sensors that terminal 500 can also configure, herein It repeats no more.
Voicefrequency circuit 160, loudspeaker 161, microphone 162 can provide the audio interface between user and terminal 500.Audio Electric signal after the audio data received conversion can be transferred to loudspeaker 161, be converted to sound by loudspeaker 161 by circuit 160 Sound signal output;On the other hand, the voice signal of collection is converted to electric signal by microphone 162, after being received by voicefrequency circuit 160 Audio data is converted to, then by after the processing of audio data output processor 180, such as another end is sent to through RF circuit 110 End, or audio data is exported to memory 120 to be further processed.Voicefrequency circuit 160 is also possible that earphone jack, To provide the communication of peripheral hardware earphone Yu terminal 500.
WiFi belongs to short range wireless transmission technology, and terminal 500 can help user's transceiver electronics by WiFi module 170 Mail, browsing webpage and access streaming video etc., it provides wireless broadband internet access for user.Although Fig. 5 is shown WiFi module 170, but it is understood that, and it is not belonging to must be configured into for terminal 500, it can according to need completely Do not change in the range of the essence of invention and omits.
Processor 180 is the control centre of terminal 500, utilizes each portion of various interfaces and connection whole mobile phone Point, by running or execute the software program and/or module that are stored in memory 120, and calls and be stored in memory 120 Interior data execute the various functions and processing data of terminal 500, to carry out integral monitoring to mobile phone.Optionally, processor 180 may include one or more processing cores;Preferably, processor 180 can integrate application processor and modem processor, Wherein, the main processing operation system of application processor, user interface and application program etc., modem processor mainly handles nothing Line communication.It is understood that above-mentioned modem processor can not also be integrated into processor 180.
Terminal 500 further includes the power supply 190 (such as battery) powered to all parts, it is preferred that power supply can pass through electricity Management system and processor 180 are logically contiguous, to realize management charging, electric discharge and power consumption by power-supply management system The functions such as management.Power supply 190 can also include one or more direct current or AC power source, recharging system, power supply event Hinder the random components such as detection circuit, power adapter or inverter, power supply status indicator.
Although being not shown, terminal 500 can also include camera, bluetooth module etc., and details are not described herein.Specifically in this reality It applies in example, the display unit of terminal 500 is touch-screen display, and terminal 500 further includes having memory and one or one Above program, one of them perhaps more than one program be stored in memory and be configured to by one or one with Upper processor execution states one or more than one program includes the instruction for performing the following operation:
Terminal to server sends the first connection CONNECT message, carries the first account in the first CONNECT message Family mark;
The terminal receives the connection that the server is sent and returns to CONACK message, and the extension of the CONACK message carries Random string is carried in lotus;
The terminal is based on the random string and encrypts to the first account password, sends second to server CONNECT message carries first account identification in the 2nd CONNECT message and encrypted first account is close Code.
Optionally, added with extension load, the extension of the 2nd CONNECT message in the 2nd CONNECT message Login negotiation information is carried in load;Wherein, the login negotiation information includes at least one of following information information: number According to transmission mode, data compression scheme, client type, client release number.
Optionally, the method also includes:
The terminal sends publication PUBLISH message to the server, carries target account in the PUBLISH message The account identification and account status parameter at family;
The terminal receives the publication response PUBACK message that the server is sent, and the PUBACK message is added with expansion Load is opened up, the parameter of the account status parameter of the target account is carried in the extension load of the PUBACK message Value, shows the parameter value of the account status parameter of the target account.
Optionally, the first CONNECT message is carried added with extension load, the extension of the first CONNECT message All message expansion types that record has the terminal to support in lotus.
In the embodiment of the present invention, terminal to server sends the first connection CONNECT message, in the first CONNECT message The first account identification is carried, terminal receives the connection that server is sent and returns to CONACK message, and the extension of CONACK message carries Carry random string in lotus, terminal is based on random string and encrypts to the first account password, sends the to server Two CONNECT messages carry the first account identification and encrypted first account password in the 2nd CONNECT message.In this way, During logging in IM server using CONNECT message, terminal can be based on the random string reconciliation of server transmission Family password is encrypted, and the password of user can not be directly obtained stranger is truncated to CONNECT message, thus, it carries out Account security when IM business is preferable.
The embodiment of the invention also provides a kind of server, Fig. 6 is that the structure of server provided in an embodiment of the present invention is shown It is intended to.The server 600 can generate bigger difference because configuration or performance are different, may include in one or more Central processor (central processing units, CPU) 622 (for example, one or more processors) and memory 632, one or more storage application programs 642 or data 644 storage medium 630 (such as one or more sea Amount storage equipment).Wherein, memory 632 and storage medium 630 can be of short duration storage or persistent storage.Storage is stored in be situated between The program of matter 630 may include one or more modules (diagram does not mark), and each module may include in server Series of instructions operation.Further, central processing unit 622 can be set to communicate with storage medium 630, in server The series of instructions operation in storage medium 630 is executed on 600.
Server 600 can also include one or more power supplys 626, one or more wired or wireless networks Interface 650, one or more input/output interfaces 658, one or more keyboards 656, and/or, one or one The above operating system 641, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM etc..
Server 600 may include having perhaps one of them or one of more than one program of memory and one Procedure above is stored in memory, and is configured to execute one or one by one or more than one processor Procedure above includes the instruction for performing the following operation:
The first CONNECT message that server receiving terminal is sent carries the first account in the first CONNECT message Family mark;
The server generates random string, and sends the CONACK message added with extension load to the terminal, Random string is carried in the extension load of the CONACK message;
The server receives the 2nd CONNECT message that the terminal is sent, and carries in the 2nd CONNECT message There are first account identification and encrypted first account password;
The server is based on the random string and encrypted first account password is decrypted, according to institute It states the first account identification and first account password and login process is carried out to the first account.
Optionally, added with extension load, the extension of the 2nd CONNECT message in the 2nd CONNECT message Login negotiation information is carried in load;
It is described that login process, packet are carried out to the first account according to first account identification and first account password It includes:
The server negotiates letter according to first account identification and first account password and the login Breath carries out login process to the first account;
Wherein, the login negotiation information includes at least one of following information information:
Data transfer mode, data compression scheme, client type, client release number.
Optionally, the method also includes:
The server receives the PUBLISH message that the terminal is sent, and carries target account in the PUBLISH message The account identification and account status parameter at family;
The server obtains the parameter value of the account status parameter of the target account;
The server sends PUBACK message to the terminal, and the PUBACK message is described added with extension load Record has the parameter value of the account status parameter of the target account in the extension load of PUBACK message.
Optionally, the first CONNECT message is carried added with extension load, the extension of the first CONNECT message All message expansion types that record has terminal to support in lotus;
The server sends PUBACK message to the terminal, comprising: if all messages that the terminal is supported expand Opening up includes PUBACK message expansion type in type, and the server then sends PUBACK message to the terminal.
In the embodiment of the present invention, terminal to server sends the first connection CONNECT message, in the first CONNECT message The first account identification is carried, terminal receives the connection that server is sent and returns to CONACK message, and the extension of CONACK message carries Carry random string in lotus, terminal is based on random string and encrypts to the first account password, sends the to server Two CONNECT messages carry the first account identification and encrypted first account password in the 2nd CONNECT message.In this way, During logging in IM server using CONNECT message, terminal can be based on the random string reconciliation of server transmission Family password is encrypted, and the password of user can not be directly obtained stranger is truncated to CONNECT message, thus, it carries out Account security when IM business is preferable.
Those of ordinary skill in the art will appreciate that realizing that all or part of the steps of above-described embodiment can pass through hardware It completes, relevant hardware can also be instructed to complete by program, the program can store in a kind of computer-readable In storage medium, storage medium mentioned above can be read-only memory, disk or CD etc..
The foregoing is merely presently preferred embodiments of the present invention, is not intended to limit the invention, it is all in spirit of the invention and Within principle, any modification, equivalent replacement, improvement and so on be should all be included in the protection scope of the present invention.

Claims (9)

1. a kind of method of instant messaging, which is characterized in that the described method includes:
Terminal to server sends the first connection CONNECT message, carries the first account mark in the first CONNECT message Know;
The terminal receives the connection that the server is sent and returns to CONACK message, in the extension load of the CONACK message Carry random string;
The terminal is based on the random string and encrypts to the first account password, sends the 2nd CONNECT to server Message carries first account identification and encrypted first account password in the 2nd CONNECT message.
2. load is extended the method according to claim 1, wherein being added in the 2nd CONNECT message, Login negotiation information is carried in the extension load of the 2nd CONNECT message;Wherein, the login negotiation information includes such as At least one of lower information information: data transfer mode, data compression scheme, client type, client release number.
3. the method according to claim 1, wherein the method also includes:
The terminal sends publication PUBLISH message to the server, carries target account in the PUBLISH message Account identification and account status parameter;
The terminal receives the publication response PUBACK message that the server is sent, and the PUBACK message is carried added with extension Lotus carries the parameter value of the account status parameter of the target account in the extension load of the PUBACK message, shows Show the parameter value of the account status parameter of the target account.
4. the method according to claim 1, wherein the first CONNECT message is added with extension load, institute State all message expansion types that record has the terminal to support in the extension load of the first CONNECT message.
5. a kind of method of instant messaging, which is characterized in that the described method includes:
The first CONNECT message that server receiving terminal is sent carries the first account mark in the first CONNECT message Know;
The server generates random string, and sends the CONACK message added with extension load to the terminal, described Random string is carried in the extension load of CONACK message;
The server receives the 2nd CONNECT message that the terminal is sent, and carries in the 2nd CONNECT message State the first account identification and encrypted first account password;
The server is based on the random string and encrypted first account password is decrypted, according to described the One account identification and first account password carry out login process to the first account.
6. according to the method described in claim 5, it is characterized in that, in the 2nd CONNECT message added with extension load, Login negotiation information is carried in the extension load of the 2nd CONNECT message;
It is described that login process is carried out to the first account according to first account identification and first account password, comprising:
The server is right according to first account identification and first account password and the login negotiation information First account carries out login process;
Wherein, the login negotiation information includes at least one of following information information:
Data transfer mode, data compression scheme, client type, client release number.
7. according to the method described in claim 5, it is characterized in that, the method also includes:
The server receives the PUBLISH message that the terminal is sent, and carries target account in the PUBLISH message Account identification and account status parameter;
The server obtains the parameter value of the account status parameter of the target account;
The server sends PUBACK message to the terminal, and the PUBACK message is described added with extension load Record has the parameter value of the account status parameter of the target account in the extension load of PUBACK message.
8. the method according to the description of claim 7 is characterized in that the first CONNECT message is added with extension load, institute State all message expansion types that record has terminal to support in the extension load of the first CONNECT message;
The server sends PUBACK message to the terminal, comprising: if all message extension classes that the terminal is supported It include PUBACK message expansion type in type, the server then sends PUBACK message to the terminal.
9. a kind of system of instant messaging, which is characterized in that the system comprises terminal and servers, in which:
The terminal carries in the first CONNECT message for sending the first CONNECT message to the server First account identification;The CONACK message that the server is sent is received, is carried in the extension load of the CONACK message Random string;The first account password is encrypted based on the random string, sends the 2nd CONNECT report to server Text carries first account identification and encrypted first account password in the 2nd CONNECT message;
The server is taken in the first CONNECT message for receiving the first CONNECT message of the terminal transmission With first account identification;Random string is generated, and sends the CONACK report added with extension load to the terminal Text carries random string in the extension load of the CONACK message;The server receive that the terminal sends the Two CONNECT messages carry first account identification in the 2nd CONNECT message and encrypted first account are close Code;The server is based on the random string and encrypted first account password is decrypted, according to described the One account identification and first account password carry out login process to the first account.
CN201610756597.1A 2016-08-29 2016-08-29 A kind of method and system of instant messaging Active CN107786423B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610756597.1A CN107786423B (en) 2016-08-29 2016-08-29 A kind of method and system of instant messaging

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610756597.1A CN107786423B (en) 2016-08-29 2016-08-29 A kind of method and system of instant messaging

Publications (2)

Publication Number Publication Date
CN107786423A CN107786423A (en) 2018-03-09
CN107786423B true CN107786423B (en) 2019-10-29

Family

ID=61440653

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610756597.1A Active CN107786423B (en) 2016-08-29 2016-08-29 A kind of method and system of instant messaging

Country Status (1)

Country Link
CN (1) CN107786423B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108965265A (en) * 2018-06-26 2018-12-07 四川斐讯信息技术有限公司 A kind of chat method and system based on MQTT agreement
CN110381057B (en) * 2019-07-17 2022-06-07 上海庆科信息技术有限公司 Communication connection processing method, device, storage medium, processor and system
TWI733426B (en) * 2020-04-29 2021-07-11 健行學校財團法人健行科技大學 Socialized notification system for monitoring information

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101127600B (en) * 2006-08-14 2011-12-07 华为技术有限公司 A method for user access authentication
CN101465735B (en) * 2008-12-19 2011-06-01 北京大学 Network user identification verification method, server and client terminal

Also Published As

Publication number Publication date
CN107786423A (en) 2018-03-09

Similar Documents

Publication Publication Date Title
US20210336780A1 (en) Key updating method, apparatus, and system
CN105824958B (en) A kind of methods, devices and systems of inquiry log
CN104580167B (en) A kind of methods, devices and systems transmitting data
EP3200487B1 (en) Message processing method and apparatus
CN104618217B (en) Share method, terminal, server and the system of resource
CN104978176B (en) Application programming interfaces call method, device and computer readable storage medium
US11579946B2 (en) Method for managing multiple operating systems in a terminal
US20170316781A1 (en) Remote electronic service requesting and processing method, server, and terminal
CN104142868B (en) Establish the method and device of connection
CN103294515A (en) Method, device and system for acquiring application programs
CN104683301B (en) Password storage method and device
WO2018006841A1 (en) Qr code information transmission method, device and apparatus
CN104065693A (en) Method, device and system for accessing network data in webpage applications
US9961177B2 (en) Method and device for adding contact information
WO2016192511A1 (en) Method and apparatus for remotely deleting information
WO2015070769A1 (en) Data transfer method and apparatus
CN107786423B (en) A kind of method and system of instant messaging
CN104363590A (en) Access point connection method and device
CN109495769A (en) Video communication method, terminal, smart television, server and storage medium
CN105553718B (en) Guidance information display methods and device
CN105577712B (en) A kind of file uploading method, device and system
CN104391629A (en) Method for sending message in orientation manner, method for displaying message, server and terminal
CN104092657A (en) Information transmission method, device and system
CN108958854B (en) Window display method and device and terminal
CN105703808A (en) Method and device for transmitting data

Legal Events

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