CN107786423A - 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
CN107786423A
CN107786423A CN201610756597.1A CN201610756597A CN107786423A CN 107786423 A CN107786423 A CN 107786423A CN 201610756597 A CN201610756597 A CN 201610756597A CN 107786423 A CN107786423 A CN 107786423A
Authority
CN
China
Prior art keywords
messages
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.)
Granted
Application number
CN201610756597.1A
Other languages
Chinese (zh)
Other versions
CN107786423B (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.Methods described includes:Terminal to server sends the first connection CONNECT messages, and the first account identification is carried in the first CONNECT messages;The terminal receives the connection that the server is sent and returns to CONACK messages, and random string is carried in the extension load of the CONACK messages;The first account password is encrypted based on the random string for the terminal, sends the 2nd CONNECT messages to server, the first account password after first account identification and encryption is carried in the 2nd CONNECT messages.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, more particularly to a kind of methods, devices and systems of instant messaging.
Background technology
MQTT (Message Queuing Telemetry Transport, message queue remote measurement transmission) agreement is to be used for Computing capability is limited, and the control device that the distance sensor being operated under low bandwidth, unstable network environment is corresponding The instant communication protocol communicated, based on MQTT agreements, distance sensor can be established by a small amount of bandwidth and control device Instant messaging connects, such as:After temperature sensor has detected temperature, temperature data can be published to by service by MQTT agreements Device, then control device temperature data can be subscribed at server by MQTT agreements.
MQTT agreements can be applied in IM (Instant Messaging, instant messaging) business, carried out in both sides During instant messaging, message sender (i.e. Party A) (is connected using the IM clients being arranged in terminal by CONNECT Connecing) message sends username and password to IM servers and logged in, and logining successfully rear server can be by CONACK (even Connect return) message to Party A return log in confirm.Party A can be sent to server by PUBLISH (issue) messages and be thought afterwards The account identification for the communication message and message receiver (i.e. Party B) to be sent, IM servers are receiving communication message and Party B Account identification after, can first check whether Party B have subscribed Party A by SUBSCRIBE (subscription) message and be sent to Party B Communication message, if it is, IM servers can then pass through PUBLISH messages sends above-mentioned communication message to the terminal of Party B.
During the present invention is realized, inventor has found that prior art at least has problems with:
During IM servers are logged in using CONNECT messages, the account and password of user are directly recorded in , so, can be directly from can if stranger is truncated to CONNECT messages in byte corresponding to the variable header of CONNECT messages Become in header and obtain the account and password of user, so as to which account security when carrying out IM business is poor.
The content of the invention
In order to solve problem of the prior art, the embodiments of the invention provide a kind of method and system of instant messaging.Institute It is as follows to state technical scheme:
First aspect, there is provided a kind of method of instant messaging, methods described include:
Terminal to server sends the first connection CONNECT messages, and the first account is carried in the first CONNECT messages Family identifies;
The terminal receives the connection that the server is sent and returns to CONACK messages, and the extension of the CONACK messages carries Random string is carried in lotus;
The first account password is encrypted based on the random string for the terminal, and second is sent to server CONNECT messages, the first account carried in the 2nd CONNECT messages after first account identification and encryption are close Code.
Optionally, added with extension load, the extension of the 2nd CONNECT messages in the 2nd CONNECT messages Login negotiation information is carried in load;Wherein, the login negotiation information includes at least one of following information information:Number According to transmission means, data compression scheme, client type, client release number.
So, server can carry out login process based on the login negotiation information that terminal is sent to the first account.
Optionally, methods described also includes:
The terminal sends issue PUBLISH messages to the server, and target account is carried in the PUBLISH messages The account identification and account status parameter at family;
The terminal receives the issue response PUBACK messages that the server is sent, and the PUBACK messages are 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 messages Value, show the parameter value of the account status parameter of the target account.
So, user can get the account status information such as the presence of target account, pet name.
Optionally, the first CONNECT messages carry added with extension load, the extension of the first CONNECT messages Record has all message expansion types that the terminal is supported in lotus.
So, server can know terminal support all message expansion types, and amplifying message corresponding to use with Terminal carries out instant messaging.
Second aspect, there is provided a kind of method of instant messaging, methods described include:
The first CONNECT messages that server receiving terminal is sent, the first account is carried in the first CONNECT messages Family identifies;
The server generates random string, and sends the CONACK messages added with extension load to the terminal, Random string is carried in the extension load of the CONACK messages;
The server receives the 2nd CONNECT messages that the terminal is sent, and is carried in the 2nd CONNECT messages There is the first account password after first account identification and encryption;
The first account password after the encryption is decrypted based on the random string for the server, according to institute State 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 messages in the 2nd CONNECT messages Login negotiation information is carried in load;
It is described that login process, bag are carried out to the first account according to first account identification and first account password Include:
The server consults letter according to first account identification and first account password, and described log in Breath, login process is carried out 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.
So, server can carry out login process based on the login negotiation information that terminal is sent to the first account.
Optionally, methods described also includes:
The server receives the PUBLISH messages that the terminal is sent, and target account is carried in the PUBLISH messages 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 messages to the terminal, and the PUBACK messages are 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 messages.
So, user can get the account status information such as the presence of target account, pet name.
Optionally, the first CONNECT messages carry added with extension load, the extension of the first CONNECT messages Record has all message expansion types that terminal is supported in lotus;
The server sends PUBACK messages to the terminal, including:If all messages that the terminal is supported expand Exhibition type includes PUBACK message expansion types, and the server then sends PUBACK messages to the terminal.
So, server can know terminal support all message expansion types, and amplifying message corresponding to use with Terminal carries out instant messaging.
The third aspect, there is provided a kind of system of instant messaging, the system include terminal and server, wherein:
The terminal, for sending the first CONNECT messages to the server, taken in the first CONNECT messages With the first account identification;The CONACK messages that the server is sent are received, are taken in the extension load of the CONACK messages With random string;The first account password is encrypted based on the random string, second is sent to server CONNECT messages, the first account carried in the 2nd CONNECT messages after first account identification and encryption are close Code;
The server, the first CONNECT messages sent for receiving the terminal, the first CONNECT messages In carry first account identification;Random string is generated, and is sent to the terminal added with extension load CONACK messages, random string is carried in the extension load of the CONACK messages;The server receives the terminal The 2nd CONNECT messages sent, the after first account identification and encryption is carried in the 2nd CONNECT messages One account password;The first account password after the encryption is decrypted based on the random string for the server, root Login process is carried out to the first account according to first account identification and first account password.
The beneficial effect that technical scheme provided in an embodiment of the present invention is brought is:
In the embodiment of the present invention, terminal to server sends the first connection CONNECT messages, in the first CONNECT messages The first account identification is carried, the connection that terminal the reception server is sent returns to CONACK messages, and the extension of CONACK messages carries Random string is carried in lotus, the first account password is encrypted based on random string for terminal, and the is sent to server Two CONNECT messages, the first account password after the first account identification and encryption is carried in the 2nd CONNECT messages.So, During IM servers are logged in using CONNECT messages, terminal can the random string reconciliation based on server transmission Family password is encrypted, and the password of user can not be also directly obtained by being truncated to CONNECT messages even if stranger, so as to carry out Account security during IM business is preferable.
Brief description of the drawings
Technical scheme in order to illustrate the embodiments of the present invention more clearly, make required in being described below to embodiment Accompanying drawing is briefly described, it should be apparent that, drawings in the following description are only some embodiments of the present invention, for For those of ordinary skill in the art, on the premise of not paying creative work, other can also be obtained according to these accompanying drawings Accompanying 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 representation of terminal provided in an embodiment of the present invention;
Fig. 6 is a kind of structural representation of server provided in an embodiment of the present invention.
Embodiment
To make the object, technical solutions and advantages of the present invention clearer, below in conjunction with accompanying drawing to embodiment party of the present invention Formula is described in further detail.
The embodiments of the invention provide 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 possessing instant communication function, can be instant messaging initiator terminal or The terminal of instant messaging answer party, instant messaging application program (can be described as IM clients) can be installed in terminal, terminal can To be mobile phone, computer etc., server can be server corresponding to instant messaging application program (can be described as IM servers).Eventually Processor, memory, transceiver can be provided with end, processor can be used for the relevant treatment of instant messaging, and memory can Need to can be used for receiving and sending message and data with caused data, transceiver for storing in following processing procedures. Terminal is also provided with screen, input block, and screen can be used for showing interface, instant communication information of IM clients etc., Input block can be used for receiving the dependent instruction of user's input.Processor, memory, transmitting-receiving can be provided with server Device, processor can be used for the relevant treatment of instant messaging, and memory, which can be used for storing in following processing procedures, to be needed and produce Raw data, transceiver can be used for receiving and sending message and data.In the present embodiment, to scheme so that terminal is mobile phone as an example Mainly illustrated, can also brief description be carried out to other situations at necessity.The frame diagram of system can be as shown in Figure 3.
Below in conjunction with embodiment, the handling process shown in Fig. 1 is described in detail, content can be as Under:
Step 101, terminal to server sends the first CONNECT messages, and the first account is carried in the first CONNECT messages Family identifies.
Wherein, CONNECT messages are in MQTT agreements, establish and connect for terminal and server, and login service device Message.
In force, the IM client that instant messaging is carried out based on MQTT agreements can be installed in the terminal (i.e. terminal) of user End, when user wants to carry out IM business with other users by the IM clients, opening can be clicked on and be arranged in terminal IM clients, at this moment, login interface can be shown 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, and then, terminal can obtain and cache user is defeated The first account identification and the first account password entered.Afterwards, terminal can record the first account identification to CONNECT messages In byte corresponding to variable header, the first CONNECT messages are generated, the is carried so as to which, terminal can then be sent to server First CONNECT messages of one account identification.It is noted that extended byte can be added with the first CONNECT messages Section (extending load), the extension of CONNECT/CONACK messages is supported for notification server terminal, accordingly, can be based on existing There is the structure of CONNECT messages, change remainder bytes length value in the fixed header of CONNECT messages, amended remaining word Save length value and be equal to the byte length of variable header and the byte length sum of extension load, so, then can be reported in CONNECT Successfully addition extends load in text.
Optionally, the message expansion type that terminal can be supported with notification server terminal, accordingly, first CONNECT messages record all messages for having terminal to support added with load is extended in the extension load of the first CONNECT messages Expansion type.
In force, all messages extension of terminal support can be recorded in the extension load of the first CONNECT messages Type, specifically, Magic Number (magic number) can be provided with preceding 2 bytes in extending load, for indicating end Whether end supports message to extend and the compatibility that keeps down, and can be defined as follows two values:
1.0xFF0xFE, represent that client only supports CONNECT/CONNACK messages to extend;
2.0xFF0xFF, represent that client supports CONNECT/CONNACK messages to extend simultaneously, and PUBACK messages expand Exhibition.
It is understood that for facilitation, it is uniformly processed, identical can also be provided with the 2nd CONNECT messages Magic number.
Step 102, the first CONNECT messages that server receiving terminal is sent, the is carried in the first CONNECT messages One account identification.
In force, after terminal to server sends the first CONNECT messages, server can receive terminal hair The first CONNECT messages sent, and obtain the first account identification carried in the first CONNECT messages.
Step 103, server generation random string, and the CONACK messages added with extension load are sent to terminal, Random string is carried in the extension load of CONACK messages.
Wherein, CONACK messages are in MQTT agreements, for the message replied CONNECT messages.
In force, server can be given birth to after the first CONNECT messages of terminal transmission are received by random algorithm Into random string, then random string can be recorded into the extension load of CONACK messages, and then, server can be with The CONACK messages for carrying random string are sent to terminal.Meanwhile server can be by random string and the first account Mark carries out corresponding storage.The mode of addition extension load carries with adding extension in CONNECT messages in CONACK messages The mode of lotus is identical, and here is omitted.It should be noted that only added when in the first CONNECT messages that terminal is sent When having extension load, server just can send the CONACK messages added with extension load to terminal, if the first CONNECT Extension load it has been not added with message, server, can after receiving and carrying the first CONNECT messages of the first account identification To refuse the logging request of terminal.
Step 104, the connection that terminal the reception server is sent returns to CONACK messages, in the extension load of CONACK messages Carry random string.
In force, after server sends CONACK messages to terminal, terminal can receive the CONACK messages, And obtain the random string recorded in the extension load of the CONACK messages.
Step 105, the first account password is encrypted based on random string for terminal, and second is sent to server CONNECT messages, the first account password after the first account identification and encryption is carried in the 2nd CONNECT messages.
In force, after terminal receives the random string of server transmission, random string can be based on to having delayed 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 being encrypted to the first account password The first account password after first account identification and encryption is recorded into the variable header of CONNECT messages, generation second CONNECT messages, so as to which terminal can send the first account password after carrying the first account identification and encryption to server The 2nd CONNECT messages.Herein, the 2nd CONNECT messages can be the CONNECT messages added with extension load.
Optionally, when carrying out Account Logon, terminal can send to server and log in negotiation information, accordingly, second Added with load is extended in CONNECT messages, login negotiation information is carried in the extension load of the 2nd CONNECT messages;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 force, terminal can be obtained installed in local IM visitors after the first account password is encrypted The client type at family end, client release number 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, it includes but are not limited to above- mentioned information, and 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 negotiation information writes the 2nd CONNECT messages can will be logged in In, and the first account password after the first account identification and encryption is recorded into the variable header of CONNECT messages, generation the Two CONNECT messages.
Step 106, the 2nd CONNECT messages that server receiving terminal is sent, the is carried in the 2nd CONNECT messages The first account password after one account identification and encryption.
In force, terminal to server send the 2nd CONNECT messages after, server can receive this second CONNECT messages, and obtain the first account password after the first account identification carried in the 2nd CONNECT messages and encryption.
Step 107, the first account password after encryption is decrypted based on random string for server, according to the first account Family identifies and the first account password carries out login process to the first account.
In force, server, can first basis after the account password after obtaining the first account identification and encryption First account identification determines its corresponding random string, afterwards can be close to the first account after encryption based on random string Code is decrypted, and herein, the mode of decryption is corresponding with the mode encrypted, and can be that server consults 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 prior art, therefore be no longer described in detail.
Optionally, the situation for logging in negotiation information, step are carried in the extension load based on above-mentioned 2nd CONNECT messages Rapid 107 part processing can be as follows:According to the first account identification and the first account password, and negotiation information is logged in, to the One account carries out login process.
In force, after the 2nd CONNECT messages that server receives terminal transmission, second can be obtained The first account identification and the first account password carried in CONNECT messages, and negotiation information is logged in, afterwards can be according to upper State 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 messages The data compression scheme that notification server terminal is supported includes A, B, and server can select after receiving the 2nd CONNECT messages The data compression scheme A that server is also supported, and login process and follow-up is carried out based on data compression scheme A to the first account Instant messaging is handled.
Optionally, terminal can also obtain the account status data of other accounts at server, accordingly, such as Fig. 2 institutes Show, the processing after step 107 may include steps of:
Step 201:Terminal to server sends issue PUBLISH messages, and target account is carried in PUBLISH messages 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 messages are in MQTT agreements, for transmitting message between terminal and server Message.
In force, establish and connect when terminal and server, and after login service device, terminal can be automatically at server Obtain the account status parameter of subscription account (i.e. target account), the presence of such as target account, the pet name, specifically, Terminal can first determine corresponding to the first account subscription account, then by the account identification of target account and account status parameter Record into PUBLISH payload, so as to terminal can to server send carry target account account identification and The PUBLISH messages of account status parameter.In addition, when the specific account status parameter of the desired acquisition target account of user, such as The latest tendency of target account, daily record etc., the state that can also click on target account obtains button, so as to which terminal can be by target The account identification of account and specific account status reference record are into the payload of PUBLISH messages, so as to which terminal can be with The PUBLISH messages of the account identification and account status parameter that carry target account are sent to server.
Step 202, the PUBLISH messages that server receiving terminal is sent, target account is carried in PUBLISH messages Account identification and account status parameter;
In force, after terminal to server sends PUBLISH messages, server can receive PUBLISH reports Text, and obtain the account identification and account status parameter of the target account carried in PUBLISH messages.
Step 203, server obtains the parameter value of the account status parameter of target account.
In force, server, can be in local after the account identification of target account and account status parameter is got Memory space in search the account identification of target account corresponding to account data, and above-mentioned account shape is searched in account data The parameter value of state parameter.Logged in it is noted that the parameter value of the account status parameter of target account can be target account After server, after target account is automatically transmitted to server, or server receives above-mentioned PUBLISH messages, from mesh Mark what is obtained at account.
Step 204, server sends PUBACK messages to terminal, and PUBACK messages are added with extension load, PUBACK reports Record has the parameter value of the account status parameter of target account in the extension load of text.
Wherein, PUBACK messages are in MQTT agreements, for PUBLISH messages reply the message of response.
In force, server, can be by the parameter after the parameter value of account status parameter of target account is got Value record generates PUBACK messages into the extension load of PUBACK messages, so as to which server can send PUBACK to terminal Message.Herein, the processing of addition extension load and the processing of the addition extension load in CONNECT messages in PUBACK messages Similar, here is omitted.
Optionally, based on the processing that magic number is provided with above-mentioned first CONNECT messages, accordingly, the processing of step 204 Can be as follows:If all message expansion types that the terminal is supported include PUBACK message expansion types, server is then PUBACK messages are sent to terminal.
In force, after server receives the first CONNECT messages of terminal transmission, it can be obtained and extended in load The magic number of record, all message expansion types of terminal support are then determined according to the value of the magic number.Server is receiving end After the PUBLISH messages of account identification and account status parameter that end is sent, carrying target account, terminal can be first judged PUBACK messages whether are supported to extend, if terminal supports the extension of PUBACK messages, server then sends PUBACK reports to terminal Text;If terminal does not support PUBACK messages to extend, server then refuses this request, and request failure can be sent to terminal Message.
Step 205, the PUBACK messages that terminal the reception server is sent, PUBACK messages are added with extension load, The parameter value of the account status parameter of target account, the account of display target account are carried in the extension load of PUBACK messages The parameter value of state parameter.
In force, the parameter value for the account status parameter for carrying target account is sent to terminal in server After PUBACK messages, terminal can receive the PUBACK messages, and can be got from the extension load of PUBACK messages The parameter value of the account status parameter of target account, and then, the parameter value can be shown to user by terminal.
It should be noted that it is related to CONNECT messages, CONACK messages and PUBACK messages three kinds of messages in this programme Message extends, and can improve the existing function that IM business is carried out using MQTT, in addition to specified otherwise in this programme, be entered using MQTT Remaining processing of row IM business refers 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 when necessary carve amplifying message structure switching to former message structure.Fig. 4 The simple structure for showing amplifying message.
In the embodiment of the present invention, terminal to server sends the first connection CONNECT messages, in the first CONNECT messages The first account identification is carried, the connection that terminal the reception server is sent returns to CONACK messages, and the extension of CONACK messages carries Random string is carried in lotus, the first account password is encrypted based on random string for terminal, and the is sent to server Two CONNECT messages, the first account password after the first account identification and encryption is carried in the 2nd CONNECT messages.So, During IM servers are logged in using CONNECT messages, terminal can the random string reconciliation based on server transmission Family password is encrypted, and the password of user can not be also directly obtained by being truncated to CONNECT messages even if stranger, so as to carry out Account security during IM business is preferable.
Based on identical technical concept, the embodiment of the present invention additionally provides a kind of system of instant messaging, and system is included eventually End and server, wherein:
The terminal, for sending the first CONNECT messages to the server, taken in the first CONNECT messages With the first account identification;The CONACK messages that the server is sent are received, are taken in the extension load of the CONACK messages With random string;The first account password is encrypted based on the random string, second is sent to server CONNECT messages, the first account carried in the 2nd CONNECT messages after first account identification and encryption are close Code;
The server, the first CONNECT messages sent for receiving the terminal, the first CONNECT messages In carry first account identification;Random string is generated, and is sent to the terminal added with extension load CONACK messages, random string is carried in the extension load of the CONACK messages;The server receives the terminal The 2nd CONNECT messages sent, the after first account identification and encryption is carried in the 2nd CONNECT messages One account password;The first account password after the encryption is decrypted based on the random string for the server, 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 messages, in the first CONNECT messages The first account identification is carried, the connection that terminal the reception server is sent returns to CONACK messages, and the extension of CONACK messages carries Random string is carried in lotus, the first account password is encrypted based on random string for terminal, and the is sent to server Two CONNECT messages, the first account password after the first account identification and encryption is carried in the 2nd CONNECT messages.So, During IM servers are logged in using CONNECT messages, terminal can the random string reconciliation based on server transmission Family password is encrypted, and the password of user can not be also directly obtained by being truncated to CONNECT messages even if stranger, so as to carry out Account security during IM business is preferable.
The embodiment of the present invention additionally provides a kind of terminal, refer to Fig. 5, and it illustrates the use involved by the embodiment of the present invention In the terminal structure schematic diagram of instant messaging, the terminal can be used in implementation above-described embodiment the side of the instant messaging provided Method.Specifically:
Terminal 500 can include RF (Radio Frequency, radio frequency) circuit 110, include one or more meters The memory 120 of calculation machine readable storage medium storing program for executing, input block 130, display unit 140, sensor 150, voicefrequency circuit 160, WiFi (wireless fidelity, Wireless Fidelity) module 170, include one or the processing of more than one processing core The part such as device 180 and power supply 190.It will be understood by those skilled in the art that the terminal structure shown in Fig. 5 is not formed pair The restriction of terminal, it can include than illustrating more or less parts, either combine some parts or different part cloth Put.Wherein:
RF circuits 110 can be used for receive and send messages or communication process in, the reception and transmission of signal, especially, by base station After downlink information receives, transfer to one or more than one processor 170 is handled;In addition, it is sent to up data are related to Base station.Generally, RF circuits 110 include but is not limited to antenna, at least one amplifier, tuner, one or more oscillators, use Family identity module (SIM) card, transceiver, coupler, LNA (Low Noise Amplifier, low-noise amplifier), duplex Device etc..In addition, RF circuits 110 can also be communicated by radio communication with network and other equipment.The radio 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, WCDMA), LTE (Long Term Evolution, Long Term Evolution), Email, SMS (Short Messaging Service, Short Message Service) etc..
Memory 120 can be used for storage software program and module, and processor 180 is stored in memory 120 by operation Software program and module, so as to perform various function application and data processing.Memory 120 can mainly include storage journey Sequence area and storage data field, wherein, storing program area can storage program area, the application program (ratio needed at least one function Such as sound-playing function, image player function) etc.;Storage data field can store uses created number according to terminal 500 According to (such as voice data, phone directory etc.) etc..In addition, memory 120 can 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 block 130 to memory 120 access.
Input block 130 can be used for the numeral or character information for receiving input, and generation is set with user and function Control relevant keyboard, mouse, action bars, optics or the input of trace ball signal.Specifically, input block 130 may include to touch Sensitive surfaces 131 and other input equipments 132.Touch sensitive surface 131, also referred to as touch display screen or Trackpad, collect and use Family on or near it touch operation (such as user using any suitable object or annex such as finger, stylus in touch-sensitive table Operation on face 131 or near touch sensitive surface 131), and corresponding attachment means are driven according to formula set in advance.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 the signal that touch operation is brought is detected, transmit a signal to touch controller;Touch controller is from touch Touch information is received in detection means, and is converted into contact coordinate, then gives processor 180, and can reception processing device 180 The order sent simultaneously is performed.Furthermore, it is possible to using polytypes such as resistance-type, condenser type, infrared ray and surface acoustic waves Realize touch sensitive surface 131.Except touch sensitive surface 131, input block 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 or more in trace ball, mouse, action bars etc..
Display unit 140 can be used for display by the information of user's input or be supplied to the information and terminal 700 of user Various graphical user interface, these graphical user interface can be made up of figure, text, icon, video and its any combination. Display unit 140 may include display panel 141, optionally, can use LCD (Liquid Crystal Display, liquid crystal Show device), the form 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 or near it After touching operation, processor 180 is sent to determine the type of touch event, is followed by subsequent processing type of the device 180 according to touch event Corresponding visual output is provided on display panel 141.Although in Figure 5, touch sensitive surface 131 and display panel 141 are conducts Two independent parts come realize input and input function, but in some embodiments it is possible to by touch sensitive surface 131 with display Panel 141 is integrated and realizes input and output 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 transducer, wherein, ambient light sensor can be according to environment The light and shade of light adjusts the brightness of display panel 141, and proximity transducer can close display when terminal 700 is moved in one's ear Panel 141 and/or backlight.As one kind of motion sensor, gravity accelerometer can detect in all directions (generally Three axles) acceleration size, size and the direction of gravity are can detect that when static, available for identification 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 The other sensors such as the gyroscope that can also configure in terminal 500, barometer, hygrometer, thermometer, infrared ray sensor, herein Repeat no more.
Voicefrequency circuit 160, loudspeaker 161, microphone 162 can provide the COBBAIF between user and terminal 500.Audio Electric signal after the voice data received conversion can be transferred to loudspeaker 161, sound is converted to by loudspeaker 161 by circuit 160 Sound signal exports;On the other hand, the voice signal of collection is converted to electric signal by microphone 162, after being received by voicefrequency circuit 160 Voice data is converted to, then after voice data output processor 180 is handled, through RF circuits 110 to be sent to such as another end End, or voice data is exported to memory 120 further to handle.Voicefrequency circuit 160 is also possible that earphone jack, To provide the communication of peripheral hardware earphone and terminal 500.
WiFi belongs to short range wireless transmission technology, and terminal 500 can help user's transceiver electronicses by WiFi module 170 Mail, browse webpage and access streaming video etc., it has provided the user wireless broadband internet and accessed.Although Fig. 5 is shown WiFi module 170, but it is understood that, it is simultaneously not belonging to must be configured into for terminal 500, can exist as needed completely Do not change in the essential scope of invention and omit.
Processor 180 is the control centre of terminal 500, utilizes various interfaces and each portion of connection whole mobile phone Point, by running or performing the software program and/or module that are stored in memory 120, and call and be stored in memory 120 Interior data, the various functions and processing data of terminal 500 are performed, so as 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, application processor mainly handles operating system, user interface and application program etc., and modem processor mainly handles nothing Line communicates.It is understood that above-mentioned modem processor can not also be integrated into processor 180.
Terminal 500 also includes the power supply 190 (such as battery) to all parts power supply, it is preferred that power supply can pass through electricity Management system and processor 180 are logically contiguous, so as 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, recharging system, power supply event The random component such as barrier detection circuit, power supply changeover device or inverter, power supply status indicator.
Although being not shown, terminal 500 can also include camera, bluetooth module etc., will not be repeated here.Specifically in this reality Apply in example, the display unit of terminal 500 is touch-screen display, and terminal 500 also includes memory, and one or one More than program, one of them or more than one program storage in memory, and be configured to by one or one with Upper computing device states one or more than one program bag contains the instruction for being used for being operated below:
Terminal to server sends the first connection CONNECT messages, and the first account is carried in the first CONNECT messages Family identifies;
The terminal receives the connection that the server is sent and returns to CONACK messages, and the extension of the CONACK messages carries Random string is carried in lotus;
The first account password is encrypted based on the random string for the terminal, and second is sent to server CONNECT messages, the first account carried in the 2nd CONNECT messages after first account identification and encryption are close Code.
Optionally, added with extension load, the extension of the 2nd CONNECT messages in the 2nd CONNECT messages Login negotiation information is carried in load;Wherein, the login negotiation information includes at least one of following information information:Number According to transmission means, data compression scheme, client type, client release number.
Optionally, methods described also includes:
The terminal sends issue PUBLISH messages to the server, and target account is carried in the PUBLISH messages The account identification and account status parameter at family;
The terminal receives the issue response PUBACK messages that the server is sent, and the PUBACK messages are 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 messages Value, show the parameter value of the account status parameter of the target account.
Optionally, the first CONNECT messages carry added with extension load, the extension of the first CONNECT messages Record has all message expansion types that the terminal is supported in lotus.
In the embodiment of the present invention, terminal to server sends the first connection CONNECT messages, in the first CONNECT messages The first account identification is carried, the connection that terminal the reception server is sent returns to CONACK messages, and the extension of CONACK messages carries Random string is carried in lotus, the first account password is encrypted based on random string for terminal, and the is sent to server Two CONNECT messages, the first account password after the first account identification and encryption is carried in the 2nd CONNECT messages.So, During IM servers are logged in using CONNECT messages, terminal can the random string reconciliation based on server transmission Family password is encrypted, and the password of user can not be also directly obtained by being truncated to CONNECT messages even if stranger, so as to carry out Account security during IM business is preferable.
The embodiment of the present invention additionally provides a kind of server, and 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 produce bigger difference because configuration or performance are different, can 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 Measure storage device).Wherein, memory 632 and storage medium 630 can be of short duration storage or persistently storage.Storage is stored in be situated between The program of matter 630 can include one or more modules (diagram does not mark), and each module can include in server Series of instructions operation.Further, central processing unit 622 could be arranged to communicate with storage medium 630, in server The series of instructions operation in storage medium 630 is performed 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 Above operating system 641, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM etc..
Server 600 can include memory, and one or more than one program, one of them or one Procedure above is stored in memory, and be configured to by one either more than one computing device it is one or one Procedure above includes the instruction for being used for being operated below:
The first CONNECT messages that server receiving terminal is sent, the first account is carried in the first CONNECT messages Family identifies;
The server generates random string, and sends the CONACK messages added with extension load to the terminal, Random string is carried in the extension load of the CONACK messages;
The server receives the 2nd CONNECT messages that the terminal is sent, and is carried in the 2nd CONNECT messages There is the first account password after first account identification and encryption;
The first account password after the encryption is decrypted based on the random string for the server, according to institute State 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 messages in the 2nd CONNECT messages Login negotiation information is carried in load;
It is described that login process, bag are carried out to the first account according to first account identification and first account password Include:
The server consults letter according to first account identification and first account password, and described log in Breath, login process is carried out 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, methods described also includes:
The server receives the PUBLISH messages that the terminal is sent, and target account is carried in the PUBLISH messages 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 messages to the terminal, and the PUBACK messages are 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 messages.
Optionally, the first CONNECT messages carry added with extension load, the extension of the first CONNECT messages Record has all message expansion types that terminal is supported in lotus;
The server sends PUBACK messages to the terminal, including:If all messages that the terminal is supported expand Exhibition type includes PUBACK message expansion types, and the server then sends PUBACK messages to the terminal.
In the embodiment of the present invention, terminal to server sends the first connection CONNECT messages, in the first CONNECT messages The first account identification is carried, the connection that terminal the reception server is sent returns to CONACK messages, and the extension of CONACK messages carries Random string is carried in lotus, the first account password is encrypted based on random string for terminal, and the is sent to server Two CONNECT messages, the first account password after the first account identification and encryption is carried in the 2nd CONNECT messages.So, During IM servers are logged in using CONNECT messages, terminal can the random string reconciliation based on server transmission Family password is encrypted, and the password of user can not be also directly obtained by being truncated to CONNECT messages even if stranger, so as to carry out Account security during IM business is preferable.
One of ordinary skill in the art will appreciate that hardware can be passed through by realizing all or part of step of above-described embodiment To complete, by program the hardware of correlation can also be instructed to complete, described program can be stored in a kind of computer-readable In storage medium, storage medium mentioned above can be read-only storage, disk or CD etc..
The foregoing is only presently preferred embodiments of the present invention, be not intended to limit the invention, it is all the present invention spirit and Within principle, any modification, equivalent substitution and improvements made etc., it should be included in the scope of the protection.

Claims (9)

  1. A kind of 1. method of instant messaging, it is characterised in that methods described includes:
    Terminal to server sends the first connection CONNECT messages, and the first account mark is carried in the first CONNECT messages Know;
    The terminal receives the connection that the server is sent and returns to CONACK messages, in the extension load of the CONACK messages Carry random string;
    The first account password is encrypted based on the random string for the terminal, and the 2nd CONNECT is sent to server Message, the first account password after first account identification and encryption is carried in the 2nd CONNECT messages.
  2. 2. according to the method for claim 1, it is characterised in that extension load is added with the 2nd CONNECT messages, Login negotiation information is carried in the extension load of the 2nd CONNECT messages;Wherein, the login negotiation information is included such as At least one of lower information information:Data transfer mode, data compression scheme, client type, client release number.
  3. 3. according to the method for claim 1, it is characterised in that methods described also includes:
    The terminal sends issue PUBLISH messages to the server, and target account is carried in the PUBLISH messages Account identification and account status parameter;
    The terminal receives the issue response PUBACK messages that the server is sent, and the PUBACK messages carry added with extension Lotus, the parameter value of the account status parameter of the target account is carried in the extension load of the PUBACK messages, shown Show the parameter value of the account status parameter of the target account.
  4. 4. according to the method for claim 1, it is characterised in that the first CONNECT messages are added with extension load, institute Stating record in the extension load of the first CONNECT messages has all message expansion types that the terminal is supported.
  5. A kind of 5. method of instant messaging, it is characterised in that methods described includes:
    The first CONNECT messages that server receiving terminal is sent, the first account mark is carried in the first CONNECT messages Know;
    The server generates random string, and sends the CONACK messages added with extension load to the terminal, described Random string is carried in the extension load of CONACK messages;
    The server receives the 2nd CONNECT messages that the terminal is sent, and is carried in the 2nd CONNECT messages State the first account password after the first account identification and encryption;
    The first account password after the encryption is decrypted based on the random string for the server, according to described One account identification and first account password carry out login process to the first account.
  6. 6. according to the method for claim 5, it is characterised in that extension load is added with the 2nd CONNECT messages, Login negotiation information is carried in the extension load of the 2nd CONNECT messages;
    It is described that login process is carried out to the first account according to first account identification and first account password, including:
    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. 7. according to the method for claim 5, it is characterised in that methods described also includes:
    The server receives the PUBLISH messages that the terminal is sent, and target account is carried in the PUBLISH messages 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 messages to the terminal, and the PUBACK messages are 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 messages.
  8. 8. according to the method for claim 7, it is characterised in that the first CONNECT messages are added with extension load, institute Stating record in the extension load of the first CONNECT messages has all message expansion types that terminal is supported;
    The server sends PUBACK messages to the terminal, including:If all message extension classes that the terminal is supported Type includes PUBACK message expansion types, and the server then sends PUBACK messages to the terminal.
  9. A kind of 9. system of instant messaging, it is characterised in that the system includes terminal and server, wherein:
    The terminal, for sending the first CONNECT messages to the server, carried in the first CONNECT messages First account identification;The CONACK messages that the server is sent are received, are carried in the extension load of the CONACK messages Random string;The first account password is encrypted based on the random string, the 2nd CONNECT reports are sent to server Text, the first account password after first account identification and encryption is carried in the 2nd CONNECT messages;
    The server, for receiving the first CONNECT messages of the terminal transmission, taken in the first CONNECT messages With first account identification;Random string is generated, and sends the CONACK added with extension load to the terminal and reports Text, random string is carried in the extension load of the CONACK messages;The server receive that the terminal sends the Two CONNECT messages, the first account carried in the 2nd CONNECT messages after first account identification and encryption are close Code;The first account password after the encryption is decrypted based on the random string for the server, according to described 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 true CN107786423A (en) 2018-03-09
CN107786423B 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)

Cited By (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
CN110381057A (en) * 2019-07-17 2019-10-25 上海庆科信息技术有限公司 Processing method, device, storage medium, processor and the system of communication connection
TWI733426B (en) * 2020-04-29 2021-07-11 健行學校財團法人健行科技大學 Socialized notification system for monitoring information

Citations (2)

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

Patent Citations (2)

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

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
OASIS: "《MQTT Version 3.1.1(OASIS Standard)》", 29 October 2014 *
关庆余等: ""MQTT协议在Android平台上的研究与应用"", 《计算机***应用》 *
盖荣丽等: ""基于MQTT的企业消息推送***"", 《计算机***应用》 *

Cited By (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
CN110381057A (en) * 2019-07-17 2019-10-25 上海庆科信息技术有限公司 Processing method, device, storage medium, processor and the system of communication connection
TWI733426B (en) * 2020-04-29 2021-07-11 健行學校財團法人健行科技大學 Socialized notification system for monitoring information

Also Published As

Publication number Publication date
CN107786423B (en) 2019-10-29

Similar Documents

Publication Publication Date Title
CN105824958B (en) A kind of methods, devices and systems of inquiry log
CN105900466B (en) Message processing method and device
CN104618217B (en) Share method, terminal, server and the system of resource
US10304461B2 (en) Remote electronic service requesting and processing method, server, and terminal
WO2015090248A1 (en) Server overload protection method and device
CN111064713B (en) Node control method and related device in distributed system
CN104376353A (en) Two-dimension code generating method, terminal and server and two-dimension code reading method, terminal and server
CN104580167A (en) Data transmission method, device and system
CN104683301B (en) Password storage method and device
CN104065693A (en) Method, device and system for accessing network data in webpage applications
WO2016192511A1 (en) Method and apparatus for remotely deleting information
CN104699501B (en) A kind of method and device for running application program
CN104660769B (en) A kind of methods, devices and systems for adding associated person information
CN107465802A (en) A kind of methods, devices and systems for showing communication message
CN106791084A (en) The synchronous method and mobile terminal of personalizing parameters
CN104363590A (en) Access point connection method and device
CN107995151B (en) Login verification method, device and system
CN107872791B (en) Access point connection method and device
CN107786423B (en) A kind of method and system of instant messaging
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
WO2017000495A1 (en) Method and device for adding contacts
CN105703808A (en) Method and device for transmitting data
CN104580251B (en) A kind of method and apparatus for carrying out authorizing quick registration

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