WO2017215452A1 - 一种连接建立方法、装置和设备 - Google Patents

一种连接建立方法、装置和设备 Download PDF

Info

Publication number
WO2017215452A1
WO2017215452A1 PCT/CN2017/086914 CN2017086914W WO2017215452A1 WO 2017215452 A1 WO2017215452 A1 WO 2017215452A1 CN 2017086914 W CN2017086914 W CN 2017086914W WO 2017215452 A1 WO2017215452 A1 WO 2017215452A1
Authority
WO
WIPO (PCT)
Prior art keywords
user equipment
authentication code
channel
connection
server
Prior art date
Application number
PCT/CN2017/086914
Other languages
English (en)
French (fr)
Inventor
王文超
张春晖
蔡艳明
赵骥
Original Assignee
阿里巴巴集团控股有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 阿里巴巴集团控股有限公司 filed Critical 阿里巴巴集团控股有限公司
Publication of WO2017215452A1 publication Critical patent/WO2017215452A1/zh
Priority to US16/216,652 priority Critical patent/US10868801B2/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/04Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
    • H04L63/0428Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/08Network architectures or network communication protocols for network security for authentication of entities
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/08Network architectures or network communication protocols for network security for authentication of entities
    • H04L63/083Network architectures or network communication protocols for network security for authentication of entities using passwords
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/08Network architectures or network communication protocols for network security for authentication of entities
    • H04L63/0876Network architectures or network communication protocols for network security for authentication of entities based on the identity of the terminal or configuration, e.g. MAC address, hardware or software configuration or device fingerprint
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/08Network architectures or network communication protocols for network security for authentication of entities
    • H04L63/0884Network architectures or network communication protocols for network security for authentication of entities by delegation of authentication, e.g. a proxy authenticates an entity to be authenticated on behalf of this entity vis-à-vis an authentication entity
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/08Network architectures or network communication protocols for network security for authentication of entities
    • H04L63/0892Network architectures or network communication protocols for network security for authentication of entities by using authentication-authorization-accounting [AAA] servers or protocols
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/141Setup of application sessions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/146Markers for unambiguous identification of a particular session, e.g. session cookie or URL-encoding
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/55Push-based network services
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/0816Key establishment, i.e. cryptographic processes or cryptographic protocols whereby a shared secret becomes available to two or more parties, for subsequent use
    • H04L9/0819Key transport or distribution, i.e. key establishment techniques where one party creates or otherwise obtains a secret value, and securely transfers it to the other(s)
    • H04L9/0825Key transport or distribution, i.e. key establishment techniques where one party creates or otherwise obtains a secret value, and securely transfers it to the other(s) using asymmetric-key encryption or public key infrastructure [PKI], e.g. key signature or public key certificates
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/0861Generation of secret information including derivation or calculation of cryptographic keys or passwords
    • H04L9/0869Generation of secret information including derivation or calculation of cryptographic keys or passwords involving random numbers or seeds
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3247Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving digital signatures
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/2803Home automation networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • H04L12/403Bus networks with centralised control, e.g. polling

Definitions

  • the present invention relates to the field of computer application technologies, and in particular, to a connection establishment method, apparatus and device.
  • the present invention provides a connection establishment method, apparatus, and device, so as to improve the security of interaction between the cloud and the client.
  • connection establishment method comprising:
  • the user equipment obtains an authentication code
  • the parameter information is used to establish a channel with the connection server.
  • the acquiring, by the user equipment, the authentication code includes: the user equipment acquiring an authentication code from the identity server.
  • the acquiring, by the user equipment, the authentication code from the identifier server includes:
  • the data including the authentication code further includes: a unique identifier of the user equipment.
  • the sending the data including the authentication code to the management server includes:
  • the signature value, the unique identifier of the user equipment, the authentication code, and the application key are sent to the management server.
  • transmitting a unique identifier of the user equipment to the identity server, receiving the authentication code, and performing the signature are performed by a security chip in the user equipment.
  • the data including the authentication code is sent to the management server in the form of HTTP POST;
  • the parameter information is received in the form of an HTTP response.
  • the parameter information includes:
  • a seed key seedKey for adding/decrypting transmission data and connection parameters for adding/decrypting transmission data and connection parameters.
  • the parameter information for establishing a channel that is returned by the management server after the authentication is passed by using the data including the authentication code includes:
  • the message body of the message is decrypted to obtain the connection parameter.
  • connection parameters include:
  • Session ID IP address and port number of the connection server.
  • establishing, by using the parameter information, a channel between the connection server and the connection server includes:
  • the seed key is used to encrypt/decrypt data transmitted on the cloud channel.
  • the method further includes:
  • the data is sent and received asynchronously on the channel.
  • receiving data in an asynchronous manner on the channel includes:
  • the data packets sent through the channel are received and reassembled in a state machine manner.
  • receiving and reassembling data packets sent through the channel by using a state machine includes:
  • the packet is received and the packet length is unknown, if the variable length code of the full length is received but the data packet is not received intact, the packet is entered into the packet and the packet length is known; if a new fragment is received and is variable Long code and data packets are received intact, then enter the completion of the receiving state;
  • each fragment belonging to the data packet After completing the packet receiving state, each fragment belonging to the data packet is reorganized and enters a normal receiving state.
  • the method further includes:
  • the application data is extracted from the decrypted data packet and is called back to the upper layer service module for processing.
  • transmitting data asynchronously on the channel includes:
  • the request message is hooked to the end of the remote procedure call protocol RPC send chain.
  • the method further includes:
  • the channel is closed.
  • the channel is closed.
  • the method further includes:
  • the user equipment listens for network events, and if the network is abnormal, the channel is closed.
  • the method further includes:
  • the invention also provides a method for establishing a secure connection, the method comprising:
  • the management server receives data that is sent by the user equipment and includes an authentication code
  • the parameter information for establishing the channel is returned to the user equipment, so that the user equipment establishes a channel with the connection server.
  • the data including the authentication code further includes unique identification information of the user equipment
  • the authentication using the data including the authentication code includes:
  • the management server sends the unique identification information of the user equipment and the authentication code to the identification server;
  • the data including the authentication code further includes unique identification information of the user equipment:
  • the authentication using the data including the authentication code includes:
  • the management server sends the unique identification information of the user equipment to the identifier server;
  • the authentication code sent by the user equipment is authenticated by using an authentication code obtained from the identity server.
  • the data including the authentication code further includes an application key and signature information
  • the authentication using the data including the authentication code further includes:
  • the signature information sent by the user equipment is verified by using the application secret, the unique identifier of the user equipment, the authentication code, and the application key; if the verification fails, the authentication fails.
  • the data including the authentication code is sent to the management server in the form of HTTP POST;
  • the parameter information is returned to the user equipment in the form of an HTTP response.
  • the parameter information includes:
  • a seed key used to encrypt/decrypt transmission data and connection parameters is a seed key used to encrypt/decrypt transmission data and connection parameters.
  • the message header of the message returned by the management server to the user equipment carries a seed key encrypted by using the unique identifier of the user equipment, and the message body of the message carries the The connection parameter after the seed key is encrypted.
  • the connection parameter includes: a session identifier, an IP address of the connection server, and a port number.
  • connection establishment method comprising:
  • the connection server receives a connection request sent by the user equipment by using parameter information for establishing a channel, and establishes a channel with the user equipment;
  • the parameter information is returned to the user equipment by the management server after the authentication code is sent by using the authentication code sent by the user equipment.
  • the parameter information includes:
  • a seed key used to encrypt/decrypt transmission data and connection parameters is a seed key used to encrypt/decrypt transmission data and connection parameters.
  • connection parameters include:
  • Session ID IP address and port number of the connection server.
  • connection between the connection server and the user equipment includes:
  • TCP long connection Establishing a TCP long connection with the user equipment, where the TCP long connection is established by the user equipment by using the connection parameter request;
  • the data transmitted on the cloud channel is encrypted/decrypted using a seed key.
  • the method further includes: the connection server synchronizing a correspondence between the session identifier and the seed key from the management server;
  • the seed key corresponding to the session identifier carried by the data packet is used on the channel.
  • the method further includes:
  • connection server periodically sends a heartbeat message through the channel
  • the channel is closed.
  • connection establishment method comprising:
  • the identification server allocates and sends an authentication code to the user equipment
  • the result of the authentication is used by the management server to return parameter information for establishing a channel to the user equipment according to the result of the authentication.
  • the identifier server allocates and sends the authentication code to the user equipment, including:
  • the identifier server After receiving the unique identifier information sent by the user equipment, the identifier server allocates and returns an authentication code to the user equipment.
  • the receiving, by the management server, the information for authentication, and the authenticating the user equipment with the management server includes:
  • the authentication code After receiving the authentication code of the user equipment provided by the management server, the authentication code is authenticated and the authentication result is returned to the management server.
  • the authenticating the received authentication code comprises:
  • the determined authentication code is compared with the received authentication code. If they are consistent, the authentication is passed; otherwise, the authentication fails.
  • the receiving, by the management server, the information for authentication, and the authenticating the user equipment with the management server includes:
  • the authentication code corresponding to the unique identification information is returned to the management server, so that the management server performs authentication by using the received authentication code.
  • the authentication code corresponding to the unique identification information of the user equipment maintained by the identifier server has an aging time.
  • the present invention provides a connection establishing apparatus, which is provided in a user equipment, and the apparatus includes:
  • An authentication code obtaining module configured to obtain an authentication code
  • a parameter obtaining module configured to send data that includes the authentication code to the management server, and receive parameter information used to establish a channel that is returned by the management server by using the data that includes the authentication code after the authentication is passed;
  • a connection processing module is configured to establish a channel with the connection server by using the parameter information.
  • the present invention also provides a connection establishing device, which is disposed on a management server, and the device includes:
  • An authentication code receiving module configured to receive data that is sent by the user equipment and includes an authentication code
  • An authentication processing module configured to perform authentication by using the data including the authentication code
  • the parameter processing module is configured to return parameter information for establishing a channel to the user equipment after the authentication is passed, so that the user equipment establishes a channel with the connection server.
  • connection establishing device which is disposed at a connection server, and the device includes:
  • connection processing module configured to receive a connection request sent by the user equipment by using parameter information for establishing a channel, and establish a channel between the connection server and the user equipment;
  • the parameter information is returned to the user equipment by the management server after the authentication code is sent by using the authentication code sent by the user equipment.
  • the present invention also provides a connection establishing apparatus, which is disposed on an identification server, and the identification server includes:
  • An allocation module configured to allocate and send an authentication code to the user equipment
  • An authentication module configured to receive information for authentication sent by the management server, and perform authentication on the user equipment with the management server;
  • the result of the authentication is used by the management server to return parameter information for establishing a channel to the user equipment according to the result of the authentication.
  • the invention also provides an apparatus, including
  • One or more processors are One or more processors;
  • One or more programs the one or more programs being stored in the memory, executed by the one or more processors to:
  • the parameter information is used to establish a channel between the user equipment and the connection server.
  • the parameter information for establishing the channel can be obtained from the management server, and then the channel is established with the connection server, and the establishment manner of the channel can be Improve the security of interaction between the cloud and the client.
  • FIG. 1 is a schematic structural diagram of a system according to an embodiment of the present invention
  • FIG. 2 is a flowchart of a main method according to an embodiment of the present invention.
  • FIG. 3 is a flowchart of a detailed method according to an embodiment of the present invention.
  • FIG. 4 is a schematic diagram of a state machine according to an embodiment of the present invention.
  • FIG. 5 is a structural diagram of an apparatus installed on a user equipment according to an embodiment of the present disclosure
  • FIG. 6 is a structural diagram of an apparatus installed on a management server according to an embodiment of the present invention.
  • FIG. 7 is a structural diagram of an apparatus installed on a connection server according to an embodiment of the present invention.
  • FIG. 8 is a structural diagram of an apparatus installed on an identification server according to an embodiment of the present invention.
  • FIG. 9 is a schematic structural diagram of a device according to an embodiment of the present invention.
  • the word “if” as used herein may be interpreted as “when” or “when” or “in response to determining” or “in response to detecting.”
  • the phrase “if determined” or “if detected (conditions or events stated)” may be interpreted as “when determined” or “in response to determination” or “when detected (stated condition or event) “Time” or “in response to a test (condition or event stated)”.
  • the system may include a user equipment, a management server, and a connection server, and may further include an identification server.
  • the user equipment refers to the user equipment, and may include, but is not limited to, such as: smart mobile terminal, smart home appliance, network device, wearable device, smart medical device, PC (personal computer), and the like.
  • the smart mobile device may include, for example, a mobile phone, a tablet computer, a notebook computer, a PDA (Personal Digital Assistant), and the like.
  • Smart home appliances may include, for example, smart televisions, smart air conditioners, smart water heaters, smart refrigerators, smart air purifiers, and the like.
  • Network devices may include, for example, switches, wireless APs, servers, and the like.
  • Wearable devices may include, for example, smart watches, smart glasses, smart bracelets, and the like.
  • Intelligent medical devices may include, for example, smart thermometers, smart blood pressure meters, smart blood glucose meters, and the like.
  • the management server and the connection server may be cloud devices.
  • the management server may be a stand-alone server, and the connection server may be set up in multiple (such as in the form of a server cluster); for example, the management server and the connection server may be set to the same one.
  • the management server is mainly responsible for negotiating with the user equipment to establish parameter information of the channel. After obtaining the parameter information of the channel, the user equipment establishes a channel with the connection server, and then the data transmitted between the user end and the cloud is transmitted through the channel. This ensures safety.
  • the identity server can be a standalone server or it can be set up on the same server as the management server.
  • the identifier server is mainly responsible for allocating an authentication code for the user equipment, maintaining the unique identification information of the user equipment and the correspondence between the authentication codes, and performing authentication on the authentication code provided by the management server and returning the authentication result; Can return to the management server for the unique identification information of the user device provided by the management server
  • the corresponding authentication code will be detailed in the subsequent embodiments.
  • each server is named, for example, a management server, an identification server, and a connection server.
  • the purpose of the naming is mainly for the sake of clarity of description. In actual applications, the name is named, but the same or Servers with similar functions are covered by this application.
  • each server for the division of each server, for example, the management server, the identification server, and the connection server are logical divisions from the perspective of functions mainly implemented by the servers.
  • each server may be deployed on one computer device.
  • each server can also be deployed in multiple computer devices; or the number of each server can be flexibly set according to actual business requirements.
  • the connection server can be multiple, and each connection server can provide different
  • the management server may be multiple, including a superior management server and a lower management server, and each of the lower management servers may be responsible for different user devices.
  • FIG. 2 is a flowchart of a main method according to an embodiment of the present invention. As shown in FIG. 2, the method mainly includes the following steps:
  • the user equipment obtains an authentication code.
  • the authentication code is used for providing authentication to the management server.
  • the form of the authentication code is not limited as long as it has certain randomness and uniqueness within a certain time range.
  • the identification server can allocate and perform maintenance to the user equipment. After the identifier server allocates an authentication code to the user equipment, the mapping between the unique identifier information of the user equipment and the authentication code can be locally maintained. The details will be detailed in the subsequent embodiments.
  • the user equipment transmits data containing the authentication code to the management server.
  • the unique identification information of the user equipment is sent to the management server while the authentication code is sent, so that the management server authenticates the authentication code by using the unique identification information.
  • the management server authenticates using the data including the authentication code.
  • the management server may provide the authentication code to the identification server, and after the authentication server authenticates the authentication code, return the authentication result to the management server.
  • the unique identifier information of the user equipment may be provided to the identifier server, and the authentication code corresponding to the unique identifier information returned by the server is received, and then the authentication code sent by the user equipment is authenticated by using the authentication code.
  • the former implementation is preferred in view of higher security.
  • the data that is sent by the user equipment and includes the authentication code may further include signature information, which is used by the management server for verification, and is specifically described in the following embodiments.
  • the parameter information for establishing the channel is returned to the user equipment.
  • the parameter information used to establish the channel may include: a seed key (seedKey) and a connection parameter.
  • seedKey is a key used to encrypt/decrypt the transmission data
  • connection parameter is used to establish a connection between the user equipment and the connection server, and may include, for example, a sid, an IP address and a port number of the connection server, and the like.
  • the above data containing the authentication code can be sent in the form of HTTP POST, and the parameter information can be sent in the form of an HTTP response.
  • the user equipment establishes a channel with the connection server by using parameter information, and data to be transmitted between the subsequent user end and the cloud is transmitted through the channel.
  • the establishment of the channel mainly includes three aspects: on the one hand, the process of establishing a long connection between the user equipment and the connection server by using the connection parameter, and the process of establishing the cloud channel on the other hand; on the other hand, configuring the data on the cloud channel plus / The decryption uses seedKey.
  • the content of these aspects will be described in detail in the subsequent embodiments.
  • FIG. 3 is a flowchart of a detailed method according to an embodiment of the present invention, where a CCP module and an ID2 module are two modules in a user equipment, and a CCP module is a system level execution module, or an application level execution module, if an application The level of the execution module requires the ID2 module to open access to the application-level module.
  • the ID2 module may be a module set in a secure execution environment in the user equipment, for example, in the form of a security chip.
  • the unique identifier of the user equipment is represented by ID2.
  • the CCP is an abbreviation of the Cloud Channel Protocol. For the channel protocol between the cloud and the client, other protocol types may be used. In the embodiment of the present invention, the CCP protocol is taken as an example, as shown in FIG. 3, The method can include the following steps:
  • the CCP module requests ID2 from the ID2 module.
  • the ID2 that is not falsified and illegally obtained is used as the unique identifier of the user equipment, and the ID2 is solidified in the security chip, and the security chip is used as the ID2 module in the embodiment of the present invention. That is, only the ID2 module has the right to process ID2, and other modules can request ID2 from the ID2 module.
  • the CCP channel between the user equipment and the connection server of the cloud needs to be established first for data transmission.
  • the CCP module can request ID2 from the ID2 module.
  • the ID2 module requests an authentication code from the identity server, where the request carries the ID2 of the user equipment.
  • the identifier server maintains the ID2 of all the legal devices, and in the embodiment of the present invention, the identifier server allocates an authentication code for each legal user device.
  • the identity server may first perform the validity verification on the ID2 carried in the request. If the ID2 is the ID2 of the legal device, the user equipment is assigned an authentication code; otherwise, the user equipment is refused to be assigned an authentication code.
  • the ID2 module obtains an authentication code that identifies the server.
  • the connection parameter of the identification server may be preset. After the connection between the ID2 module and the identification server is established, a pre-agreed key (the pre-agreed key may be pre-written into the ID2 module) may be used for the ID2.
  • the authentication code is encrypted and decrypted; the key negotiation may be performed after the connection is established, and then the ID2 and the authentication code are encrypted and decrypted by using the negotiated key.
  • the ID2 module signs the ID2, the authentication code, the appkey, and the appsecret, the ID2, the authentication code, the appkey, and the signature information are provided to the CCP module.
  • the manner of signature is not limited, and an RSA algorithm or the like can be employed.
  • the signature is performed on the four parameters ID2, authentication code, appkey, and appsecret, but the data sent does not include appsecret.
  • the appkey is derived from the CCP module, that is, the ID2 module first obtains the appkey from the CCP module before signing, and then performs the above-mentioned signature processing, and then provides the ID2, the authentication code, the appkey, and the signature information to The CCP module is not shown in the process diagram.
  • the acquisition and signature of the above authentication code are performed in the ID2 module. Since the ID2 module is a security chip and belongs to a secure execution environment, the authentication code cannot be obtained and falsified by the outside world, thereby enhancing security.
  • the CCP module sends the ID2, the authentication code, the application key (appkey), and the signature information to the management server via HTTP POST.
  • the management server sends the ID2 and the authentication code to the identity server.
  • the management server performs verification by using the ID2, the authentication code, the appkey, and the signature information of the user equipment, and obtains an authentication result of the identification server for the authentication code.
  • the process of verifying the signature may include: first determining the corresponding application secret (appsecret) by using the appkey. Here, it is necessary to pre-maintain the appsecret corresponding to each appkey in the management server; and then sign the signature with the determined appsecret.
  • the information is verified, that is, the ID2, the authentication code, the appkey, and the appsecret are locally signed, and the obtained signature information is compared with the signature information sent by the user equipment. If they are consistent, the verification is passed; otherwise, the verification fails.
  • the authentication code corresponding to the ID2 is determined. Since the authentication code is allocated by the identification server for each user equipment, and the authentication code corresponding to each ID2 is locally maintained in the identification server, the authentication code corresponding to the ID2 provided by the management server may be determined, and then the determined authentication code and the reception code are received. The authentication codes to be compared are compared. If they are consistent, the authentication is passed, otherwise the authentication fails.
  • the authentication code may be randomly generated or randomly selected from the authentication code pool.
  • the authentication code maintained by the identifier server is aging time. When the aging time is reached, the authentication code is invalid.
  • the management server provides ID2 to the identification server, and the identification server is not responsible for authenticating the authentication code, but returns the authentication code corresponding to the ID2 to the management server.
  • the authentication code returned by the user equipment is authenticated by the management server by using the authentication code returned by the identity server. If they are inconsistent, the authentication fails. However, considering the security factor, the security of the former implementation is higher, so the former implementation is preferred.
  • the verification of the authentication code by the above checksum may be performed sequentially in any order, or may be performed simultaneously. Only when the verification of the authentication code is successful, the authentication is passed. If one of the authentication is unsuccessful, the authentication is considered to be unsuccessful.
  • the verification may be performed first. If the verification fails, the authentication of the authentication code may be ignored or not performed; if the verification is successful, the authentication of the authentication code may be further considered or performed. It is also possible to perform authentication on the authentication code first. If the authentication is successful, further verification is performed; if the authentication fails, no verification is performed.
  • the parameter information used to establish the channel is sent to the user equipment in the form of an HTTP response, where the parameter information used to establish the channel may include a seedKey and a connection parameter, and the connection parameters include, for example, sid, apid, Connect to the server's IP address and port number.
  • the sid indicates the session id, which is generated by the management server and is used to identify a session between the user device and the connection server.
  • the data packet between the subsequent user device and the connection server carries the sid.
  • Apid indicates the application identifier of the user equipment, which is used to identify the application. Each channel belonging to the same application uses the same apid. The apid is optional.
  • the parameter information for establishing the channel that is sent to the user equipment is also encrypted.
  • the specific manner may be: the message header of the HTTP response message returned by the management server to the user equipment carries the seedKey encrypted by using the ID2 of the user equipment, and the message The body carries the connection parameters encrypted by the seedKey.
  • the CCP module provides an HTTP response to the ID2 module.
  • the ID2 module parses the HTTP response to obtain the parameter information for establishing the channel therein and provides it to the CCP module.
  • the parsing process may include: decrypting the header of the HTTP response message by using the ID2 of the user equipment to obtain a seedKey; and decrypting the message body by using the seedKey to obtain connection parameters such as sid, apid, IP address of the connection server, and Port number.
  • the CCP module can also provide the header of the HTTP response message to the ID2 module, and the ID2 module utilizes the ID2. Decrypt the header of the HTTP response message to get the seedKey; then provide the seedKey to the CCP module. The CCP module uses the seedKey to decrypt the message body of the HTTP response message, and obtains connection parameters such as sid, apid, IP address of the connection server, and port number. This implementation is not shown in the figure.
  • the CCP module establishes a TCP long connection with the connection server using the connection parameters.
  • the TCP long connection establishment process is a prior art and will not be described in detail herein.
  • the CCP connection message is exchanged between the CCP module and the connection server, thereby establishing a CCP channel between the user equipment and the connection server. That is, the CCP module sends a CCP connection request to the connection server, and the connection server sends a CCP connection confirmation to the CCP module.
  • the CCP protocol is used as an example. Therefore, when a channel is established in this step, the CCP connection packet is exchanged. If other channel protocols are used, other channel protocol type connection packets are performed.
  • the data transmitted on the cloud channel is encrypted/decrypted by the seed key between the user equipment and the connection server.
  • the management server After the management server allocates the sid and the seedKey to the user device, it synchronizes it to the connection server. That is, the connection server can synchronize the correspondence between the sid and the seedKey from the management server.
  • the data packet sent by the subsequent user equipment on the channel carries the sid, and the connection server can know what seedKey is used on the channel, that is, the seedKey corresponding to the sid.
  • the user equipment encrypts the data packet sent to the connection server by seedKey, and uses the seedKey to decrypt the data packet from the connection server.
  • the connection server encrypts the data packets sent to the user equipment by seedKey, and uses the seedKey to decrypt the data packets from the user equipment.
  • the embodiment of the present invention may adopt a state machine.
  • the way to receive the packet can be as shown in FIG. 4, and mainly includes four states: a normal receiving state, an unacknowledged state in the packet receiving and packet length, a known state in the packet receiving period, and a completed packet receiving state.
  • the packet In the case where the packet is received and the packet length is unknown, if a new fragment is received, but the variable length code is not received intact, it continues to be in the packet and the packet length is unknown; if the variable length code reception is complete, but If the entire data packet has not been received, it will enter the receiving and the packet length is known. If a new fragment is received and the variable length encoding is received completely, the packet will be completed. state.
  • each fragment belonging to the same data packet is reassembled and reported to the module that parses the data packet, and then enters the normal receiving state.
  • the protocol type When parsing the received data packet, the protocol type may be determined according to the packet header, and the payload length may be obtained according to the variable length code; then the payload is decrypted by using the seedKey. After completion, the PUSHACK message can be constructed and sent asynchronously to the connection server.
  • the application data may be extracted from the decrypted data packet and called back to the upper layer service module for processing.
  • the CCP channel can be closed, and then the CCP module can re-execute the process shown in FIG. 3, thereby re-establishing the CCP channel between the user equipment and the connection server.
  • the CCP uses the data field of the synchronous async variable to buffer the message chain to be sent. Therefore, in the embodiment of the present invention, the Request message can be constructed by using the data to be sent, and then the Request message is hung to the end of the RPC transmission chain.
  • the seed to be transmitted is encrypted using the seedKey.
  • the connection server periodically sends a heartbeat message Ping. For example, the connection server sends a Ping to the user equipment every 70 seconds. After receiving the Ping, the user equipment returns a heartbeat response Pong. If the connection server does not receive Pong for more than the set length, the CCP channel is closed.
  • the CCP channel can also be closed.
  • the CCP module can re-execute the process shown in Figure 3 to re-establish the CCP channel between the user equipment and the connection server.
  • the user equipment can listen to registered network events, and if the network is abnormal, the CCP channel is closed. After the network is restored, the CCP module can re-execute the process shown in Figure 3 to re-establish the CCP channel between the user equipment and the connection server.
  • FIG. 5 is a structural diagram of an apparatus installed on a user equipment according to an embodiment of the present disclosure, where the apparatus is used to perform operations performed by a user equipment in the foregoing method embodiment.
  • the device may include: an authentication code obtaining module 01, a parameter obtaining module 02, and a connection processing module 03, and may further include a data processing module 04, a heartbeat maintenance module 05, and a network monitoring module 06.
  • the main functions of each component module are as follows:
  • the authentication code acquisition module 01 is responsible for obtaining the authentication code. Specifically, the authentication code obtaining module 01 may obtain an authentication code from the identity server, that is, send the unique identifier of the user equipment to the identifier server, and receive an authentication code returned by the identifier server for the unique identifier of the user equipment.
  • the parameter obtaining module 02 is responsible for transmitting the data including the authentication code to the management server; and the receiving management server uses the data including the authentication code to perform the parameter information for establishing the channel returned after the authentication is passed.
  • the data including the authentication code further includes: a unique identifier of the user equipment.
  • the authentication code acquisition module 01 can sign the unique identifier of the user equipment, the authentication code, the appkey, and the appsecret.
  • the parameter acquisition module 02 sends the signature value obtained by the authentication code acquisition module 01, the unique identifier of the user equipment, the authentication code, and the appkey to the management server.
  • the above-mentioned authentication code acquisition module 01 is actually equivalent to the ID2 module in the above method embodiment, which can be disposed on the security chip of the user equipment.
  • the parameter obtaining module 02 may send the data including the authentication code to the management server in the form of an HTTP POST; and receive parameter information for establishing a channel that is sent in the form of an HTTP response.
  • the parameter information used to establish the channel may include: a seedKey for adding/decrypting the transmission data and a connection parameter.
  • the connection parameters may include: sid, the IP address of the connection server, and the port number.
  • the parameter obtaining module 02 may first receive the message returned by the management server when receiving the parameter information returned by the management server; and then decrypt the message header of the received message by using the unique identifier of the user equipment to obtain a seedKey; and then use the seedKey. Decrypt the message body of the message to get the connection parameters.
  • the connection processing module 03 is responsible for establishing a channel with the connection server using the parameter information for establishing the channel.
  • the connection parameter may be first used to establish a TCP long connection with the connection server; then the channel connection request is sent to the connection server, and the channel connection confirmation returned by the connection server is received, thereby establishing a cloud channel with the connection server; and subsequently utilizing the seedKey Accelerate/decrypt data transmitted on the cloud channel.
  • the data processing module 04 is responsible for transmitting and receiving data asynchronously on the channel. Specifically, the data packet sent through the channel can be received and reassembled by using a state machine. As shown in FIG. 4, the following states and migration modes can be included:
  • the protocol header of the data packet is received (if the channel adopts the CCP protocol, it is the CCP protocol. Header), but the length variable length code does not receive complete, then enters the receiving and the packet length is unknown; if the complete packet is received, it enters the completed receiving state.
  • the packet is received and the packet length is unknown, if the new fragment is received but the variable length code is not received intact, it continues to be in the packet and the packet length is unknown; if the length is variable, the length of the code is complete. However, if the entire data packet is not received, it enters the receiving packet and the packet length is known. If the new fragment is received, the variable length and long code receiving is complete, and the packet is completed.
  • each fragment belonging to the same data packet is reassembled and reported to the module that parses the data packet, and then enters the normal receiving state.
  • connection processing module 03 parses the data packet received through the channel, if the parsing data packet is a PUSH message, the application data is extracted from the decrypted data packet and is called back to the upper layer service module for processing. If the connection processing module 03 performs a callback and a status abnormality occurs, the channel is closed.
  • the request message can be constructed by using the data to be sent, and the request message is hung to the end of the RPC transmission chain.
  • the heartbeat maintenance module 05 is responsible for returning the heartbeat response after receiving the heartbeat message through the channel; if the heartbeat message is not received through the channel for more than the set duration, the connection processing module 03 is triggered to close the channel.
  • the network monitoring module 06 is responsible for monitoring network events. If an abnormality occurs in the network, the connection processing module 03 is triggered to close the channel.
  • the authentication code acquisition module 01 is triggered to re-execute the operation of acquiring the authentication code to re-establish the channel with the connection server.
  • FIG. 6 is a structural diagram of an apparatus installed on a management server according to an embodiment of the present invention, where the apparatus is used to perform operations performed by a management server in a method embodiment.
  • the apparatus may include an authentication code receiving module 11, an authentication processing module 12, and a parameter processing module 13.
  • the main functions of each component module are as follows:
  • the authentication code receiving module 11 is responsible for receiving data including the authentication code sent by the user equipment.
  • the authentication processing module 12 is responsible for authenticating with data containing the authentication code.
  • the data including the authentication code further includes the unique identification information of the user equipment, and the authentication processing module 12 can adopt the following two implementation manners when performing authentication:
  • the first mode the authentication processing module 12 sends the unique identification information and the authentication code of the user equipment to the identification service. Obtaining an authentication result of the authentication code returned by the identification server.
  • the identification server is responsible for authenticating the authentication code. After the identification server receives the unique identification information and the authentication code sent by the management server, it determines the authentication code corresponding to the unique identifier information maintained locally, and the authentication will be determined. The code is compared with the received authentication code. If it is consistent, the result of the successful authentication is returned. If it fails, the result of the authentication failure is returned.
  • the second method is: the authentication processing module 12 sends the unique identifier information of the user equipment to the identifier server; acquires an authentication code corresponding to the unique identifier information returned by the identifier server; and sends the identifier to the user equipment by using the authentication code obtained from the identifier server.
  • the authentication code is used for authentication.
  • the data including the authentication code may further include the appkey and the signature information.
  • the authentication processing module 12 may further perform: determining an appsecret corresponding to the locally maintained appkey; using the appsecret, the user equipment The unique identifier, the authentication code, and the appkey verify the signature information sent by the user equipment; if the verification fails, the authentication fails. That is to say, the authentication performed by the authentication processing module 12 may include verification of the signature and authentication of the authentication code, both of which pass the authentication, and if there is a failure, the authentication fails.
  • the parameter processing module 13 is responsible for returning parameter information for the channel to the user equipment after the authentication is passed, so that the user equipment establishes a channel with the connection server.
  • the authentication code receiving module 11 receives the data including the authentication code sent by the HTTP POST format, and the parameter processing module 13 returns the parameter information for establishing the channel to the user equipment in the form of an HTTP response.
  • the parameter information used to establish the channel may include: a seedKey for adding/decrypting the transmission data and a connection parameter
  • the connection parameter may include: sid, an IP address and a port number of the connection server.
  • the message header of the message returned by the parameter processing module 13 to the user equipment carries the seed key encrypted by the unique identifier of the user equipment, and the message body of the message carries the connection parameter encrypted by the seedKey.
  • FIG. 7 is a structural diagram of an apparatus installed on a connection server according to an embodiment of the present invention.
  • the apparatus may include: a connection processing module 21, and may further include a data processing module 22, a synchronization module 23, and a heartbeat maintenance module 24.
  • the main functions of each component module are as follows:
  • the connection processing module 21 is responsible for receiving a connection request sent by the user equipment by using the parameter information for establishing the channel, and establishing a channel between the connection server and the user equipment, wherein the parameter information is returned by the management server by using the authentication code sent by the user equipment. To the user equipment.
  • the parameter information used to establish the channel includes: a seedKey for adding/decrypting the transmission data and a connection parameter.
  • the connection parameters may include: isd, the IP address of the connection server, and the port number.
  • the connection processing module 21 establishes a TCP long connection between the connection server and the user equipment.
  • the TCP long connection is established by the user equipment by using a connection parameter request; receiving a channel connection request sent by the user equipment, and sending a channel connection confirmation to the user equipment, thereby establishing a cloud channel with the user equipment.
  • the subsequent data processing module 22 uses the seedKey to add/decrypt data transmitted on the cloud channel.
  • the synchronization module 23 is responsible for synchronizing the correspondence between the sid and the seed key from the management server. After receiving the data packet through the channel, the data processing module 22 determines that the seed key corresponding to the sid carried by the data packet is used on the channel, and the seed key pair is adopted. The transmitted data is subjected to encryption/decryption processing.
  • the heartbeat maintenance module 24 periodically sends a heartbeat message through the channel; if the heartbeat response is not received through the channel beyond the set duration, the connection processing module is triggered to close the channel.
  • FIG. 8 is a structural diagram of an apparatus installed on an identification server according to an embodiment of the present invention.
  • the apparatus may include: an allocation module 31 and an authentication module 32.
  • the main functions of each component module are as follows:
  • the assignment module 31 is responsible for allocating and transmitting an authentication code for the user equipment. Specifically, after receiving the unique identifier information sent by the user equipment, the allocating module 31 allocates and returns an authentication code to the user equipment.
  • the authentication code may be randomly generated or randomly selected from the authentication code pool.
  • mapping between the unique identification information and the authentication code is maintained locally, and each authentication code has an aging time. After the aging time expires, the authentication code is invalid.
  • the authentication module 32 is responsible for receiving the information for authentication sent by the management server, and performing authentication on the user equipment with the management server.
  • the result of the authentication is used by the management server to return to the user equipment for establishing a channel according to the result of the authentication. Parameter information.
  • authentication module 32 There are two implementations of the authentication module 32:
  • the first implementation manner after receiving the authentication code of the user equipment provided by the management server, the authentication module 32 authenticates the received authentication code and returns an authentication result to the management server.
  • the authentication module 32 may determine, by using the unique identification information of the user equipment that is received together with the authentication code of the user equipment, the locally maintained authentication code corresponding to the unique identification information of the user equipment; and the determined authentication code is received and received. The authentication code is compared. If they are consistent, the authentication is passed; otherwise, the authentication fails.
  • the second implementation manner after receiving the unique identification information of the user equipment provided by the management server, the authentication module 32 returns an authentication code corresponding to the unique identification information to the management server, so that the management server performs authentication by using the received authentication code.
  • the above method and apparatus provided by the embodiments of the present invention may be embodied and executed in a computer program embodied in a device.
  • the device may include one or more processors, and also includes a memory and one or more programs, as shown in FIG.
  • the one or more programs are stored in a memory and executed by the one or more processors to implement the method flow and/or device operations illustrated in the above-described embodiments of the present invention.
  • the method flow executed by one or more of the above processors may include:
  • the parameter information is used to establish a channel between the user equipment and the connection server.
  • connection server may be an application server that provides specific services for the object connection device in the cloud.
  • connection server at this time may be a video server, and the connection parameters include seedkey, session identifier, IP address and port number of the video server.
  • the smart TV can further utilize the IP address and port number of the obtained video server to establish a CCP channel with the video server. On the CCP channel, the data interaction between the smart TV and the video server is encrypted by seedkey, and the above is adopted.
  • the session ID in the connection parameter identifies the session on that channel. This ensures a secure connection between the smart TV and the video server.
  • the modules described as separate components may or may not be physically separated.
  • the components displayed as modules may or may not be physical modules, that is, may be located in one place, or may be distributed to multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
  • each functional module in each embodiment of the present invention may be integrated into one processing module, or each module may exist physically separately, or two or more modules may be integrated into one module.
  • the above integrated modules can be implemented in the form of hardware or in the form of hardware plus software function modules.
  • the above integrated module implemented in the form of a software function module can be stored in a computer readable storage In the medium.
  • the software function modules described above are stored in a storage medium and include instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor to perform the methods of the various embodiments of the present invention. Part of the steps.
  • the foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and the like, which can store program codes. .

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Hardware Design (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Accounting & Taxation (AREA)
  • Power Engineering (AREA)
  • Mobile Radio Communication Systems (AREA)
  • Computer And Data Communications (AREA)

Abstract

本发明提供了一种连接建立方法、装置和设备,其中方法包括:用户设备获取认证码;将包含认证码的数据发送给管理服务器;接收所述管理服务器利用所述包含认证码的数据进行认证通过后返回的用于建立通道的参数信息;利用所述参数信息,建立与连接服务器之间的安全通道。通过本发明能够提高云端与用户端之间交互的安全性。

Description

一种连接建立方法、装置和设备
本申请要求2016年06月14日递交的申请号为201610421385.8、发明名称为“一种连接建立方法、装置和设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本发明涉及计算机应用技术领域,特别涉及一种连接建立方法、装置和设备。
背景技术
随着云计算的不断发展,基于云端的服务逐渐普及,云端与用户终端之间的交互越来越频繁,如何保证云端与用户端之间数据传输的安全性成为亟待解决的问题。
发明内容
有鉴于此,本发明提供了一种连接建立方法、装置和设备,以便于提高云端与用户端之间交互的安全性。
具体技术方案如下:
本发明提供了一种连接建立方法,该方法包括:
用户设备获取认证码;
将包含认证码的数据发送给管理服务器;
接收所述管理服务器利用所述包含认证码的数据进行认证通过后返回的用于建立通道的参数信息;
利用所述参数信息,建立与连接服务器之间的通道。
根据本发明一优选实施方式,所述用户设备获取认证码包括:所述用户设备从标识服务器获取认证码。
根据本发明一优选实施方式,所述用户设备从标识服务器获取认证码包括:
所述用户设备发送所述用户设备的唯一标识给标识服务器;
接收所述标识服务器针对所述用户设备的唯一标识返回的认证码。
根据本发明一优选实施方式,所述包含认证码的数据还包括:所述用户设备的唯一标识。
根据本发明一优选实施方式,所述将包含认证码的数据发送给管理服务器包括:
对所述用户设备的唯一标识、认证码、应用密钥以及应用秘密进行签名;
将签名值、所述用户设备的唯一标识、认证码以及应用密钥发送给所述管理服务器。
根据本发明一优选实施方式,向所述标识服务器发送用户设备的唯一标识、接收所述认证码以及所述进行签名由所述用户设备中的安全芯片执行。
根据本发明一优选实施方式,所述包含认证码的数据通过HTTP POST的形式发送给所述管理服务器;
所述参数信息通过HTTP响应的形式接收。
根据本发明一优选实施方式,所述参数信息包括:
用于对传输数据进行加/解密的种子密钥seedKey以及连接参数。
根据本发明一优选实施方式,接收所述管理服务器利用所述包含认证码的数据进行认证通过后返回的用于建立通道的参数信息包括:
接收所述管理服务器返回的消息;
利用所述用户设备的唯一标识对接收到的消息的消息头进行解密,得到所述种子密钥;
利用所述种子密钥,对所述消息的消息体进行解密,得到所述连接参数。
根据本发明一优选实施方式,所述连接参数包括:
会话标识、连接服务器的IP地址和端口号。
根据本发明一优选实施方式,利用所述参数信息,建立与连接服务器之间的通道包括:
利用所述连接参数,与所述连接服务器建立TCP长连接;
向所述连接服务器发送通道连接请求,以及接收所述连接服务器返回的通道连接确认,从而建立与所述连接服务器之间的云通道;
利用所述种子密钥对所述云通道上传输的数据进行加/解密。
根据本发明一优选实施方式,该方法还包括:
在所述通道上采用异步方式收发数据。
根据本发明一优选实施方式,在所述通道上采用异步方式接收数据包括:
采用状态机的方式接收和重组通过所述通道发送来的数据包。
根据本发明一优选实施方式,采用状态机的方式接收和重组通过所述通道发送来的数据包包括:
在正常接收状态下,若收到协议头且长度可变长编码未接收完整,则进入收包中且 包长未知状态;
在收包中且包长未知状态下,若收到完整长度的可变长编码但数据包未接收完整,则进入收包中且包长已知状态;若收到新的分片且可变长编码和数据包均接收完整,则进入完成收包状态;
在收包中且包长已知状态下,若收到新的分片且数据包接收完整,则进入完成收包状态;
在完成收包状态下,对属于该数据包的各分片进行重组后进入正常接收状态。
根据本发明一优选实施方式,该方法还包括:
对通过所述通道接收到的数据包进行解析;
若解析所述数据包为PUSH消息时,从解密后的数据包中提取应用数据并回调给上层业务模块处理。
根据本发明一优选实施方式,在所述通道上采用异步方式发送数据包括:
利用要发送的数据构造请求消息;
将所述请求消息挂到远程过程调用协议RPC发送链的链尾。
根据本发明一优选实施方式,该方法还包括:
通过所述通道接收到心跳消息后,返回心跳响应;
若超过设定时长未通过所述通道收到心跳消息,则关闭所述通道。
根据本发明一优选实施方式,若在执行所述回调时,出现状态异常,则关闭所述通道。
根据本发明一优选实施方式,该方法还包括:
所述用户设备监听网络事件,若网络出现异常,则关闭所述通道。
根据本发明一优选实施方式,在所述关闭所述通道之后,还包括:
转至执行所述获取认证码的步骤,以重新建立与连接服务器之间的通道。
本发明还提供了一种安全连接建立方法,该方法包括:
管理服务器接收用户设备发送的包含认证码的数据;
利用所述包含认证码的数据进行认证通过后,向所述用户设备返回用于建立通道的参数信息,以便所述用户设备建立与连接服务器之间的通道。
根据本发明一优选实施方式,所述包含认证码的数据还包括所述用户设备的唯一标识信息;
利用所述包含认证码的数据进行认证包括:
所述管理服务器将所述用户设备的唯一标识信息和所述认证码发送给标识服务器;
获取所述标识服务器返回的对所述认证码的认证结果。
根据本发明一优选实施方式,所述包含认证码的数据还包括所述用户设备的唯一标识信息:
利用所述包含认证码的数据进行认证包括:
所述管理服务器将所述用户设备的唯一标识信息发送给标识服务器;
获取所述标识服务器返回的所述唯一标识信息对应的认证码;
利用从所述标识服务器获取的认证码,对所述用户设备发送的认证码进行认证。
根据本发明一优选实施方式,所述包含认证码的数据还包括应用密钥和签名信息;
利用所述包含认证码的数据进行认证还包括:
所述管理服务器确定本地维护的所述应用密钥对应的应用秘密;
利用所述应用秘密、所述用户设备的唯一标识、认证码以及应用密钥对所述用户设备发送的签名信息进行校验;如果校验失败,则认证失败。
根据本发明一优选实施方式,所述包含认证码的数据通过HTTP POST的形式发送给所述管理服务器;
所述参数信息通过HTTP响应的形式返回给所述用户设备。
根据本发明一优选实施方式,所述参数信息包括:
用于对传输数据进行加/解密的种子密钥以及连接参数。
根据本发明一优选实施方式,所述管理服务器向所述用户设备返回的消息的消息头中携带利用所述用户设备的唯一标识加密后的种子密钥,所述消息的消息体携带利用所述种子密钥加密后的连接参数。
根据本发明一优选实施方式,所述连接参数包括:会话标识、连接服务器的IP地址和端口号。
本发明还提供了一种连接建立方法,该方法包括:
连接服务器接收用户设备利用用于建立通道的参数信息发送的连接请求,建立与所述用户设备之间的通道;
其中所述参数信息是管理服务器利用用户设备发送的认证码进行认证通过后返回给所述用户设备的。
根据本发明一优选实施方式,所述参数信息包括:
用于对传输数据进行加/解密的种子密钥以及连接参数。
根据本发明一优选实施方式,所述连接参数包括:
会话标识、连接服务器的IP地址和端口号。
根据本发明一优选实施方式,连接服务器建立与用户设备之间的通道包括:
建立与所述用户设备之间的TCP长连接,该TCP长连接是所述用户设备利用所述连接参数请求建立的;
接收所述用户设备发送的通道连接请求,以及向所述用户设备发送通道连接确认,从而建立与所述用户设备之间的云通道;
利用种子密钥对所述云通道上传输的数据进行加/解密。
根据本发明一优选实施方式,该方法还包括:所述连接服务器从所述管理服务器同步会话标识和种子密钥之间的对应关系;
通过所述通道接收到数据包后,确定在该通道上采用该数据包所携带的会话标识对应的种子密钥。
根据本发明一优选实施方式,该方法还包括:
所述连接服务器周期性地通过所述通道发送心跳消息;
若超过设定时长未通过所述通道接收到心跳响应,则关闭所述通道。
本发明还提供了一种连接建立方法,该方法包括:
标识服务器为用户设备分配并发送认证码;
接收管理服务器发送的用于认证的信息,并配合所述管理服务器对所述用户设备进行认证;
其中所述认证的结果用于所述管理服务器依据认证通过的结果向用户设备返回用于建立通道的参数信息。
根据本发明一优选实施方式,所述标识服务器为用户设备分配并发送认证码包括:
所述标识服务器接收到所述用户设备发送的唯一标识信息后,向所述用户设备分配并返回认证码。
根据本发明一优选实施方式,所述接收管理服务器发送的用于认证的信息,并配合所述管理服务器对所述用户设备进行认证包括:
接收到管理服务器提供的所述用户设备的认证码后,对接收到的认证码进行认证并向管理服务器返回认证结果。
根据本发明一优选实施方式,所述对接收到的认证码进行认证包括:
利用连同所述用户设备的认证码一起接收到的用户设备的唯一标识信息,确定本地 维护的与所述用户设备的唯一标识信息对应的认证码;
将确定出的认证码与接收到的认证码进行比对,如果一致,则认证通过;否则认证失败。
根据本发明一优选实施方式,所述接收管理服务器发送的用于认证的信息,并配合所述管理服务器对所述用户设备进行认证包括:
接收到管理服务器提供的所述用户设备的唯一标识信息后,向所述管理服务器返回所述唯一标识信息对应的认证码,以便所述管理服务器利用接收到的认证码进行认证。
根据本发明一优选实施方式,所述标识服务器本地维护的与所述用户设备的唯一标识信息对应的认证码具有老化时间。
本发明提供了一种连接建立装置,设置于用户设备,该装置包括:
认证码获取模块,用于获取认证码;
参数获取模块,用于将包含认证码的数据发送给管理服务器;接收所述管理服务器利用所述包含认证码的数据进行认证通过后返回的用于建立通道的参数信息;
连接处理模块,用于利用所述参数信息,建立与连接服务器之间的通道。
本发明还提供了一种连接建立装置,设置于管理服务器,该装置包括:
认证码接收模块,用于接收用户设备发送的包含认证码的数据;
认证处理模块,用于利用所述包含认证码的数据进行认证;
参数处理模块,用于在所述认证通过后,向所述用户设备返回用于建立通道的参数信息,以便所述用户设备建立与连接服务器之间的通道。
本发明还提供了一种连接建立装置,设置于连接服务器,该装置包括:
连接处理模块,用于接收用户设备利用用于建立通道的参数信息发送的连接请求,建立所述连接服务器与用户设备之间的通道;
其中所述参数信息是管理服务器利用用户设备发送的认证码进行认证通过后返回给所述用户设备的。
本发明还提供了一种连接建立装置,设置于标识服务器,该标识服务器包括:
分配模块,用于为用户设备分配并发送认证码;
认证模块,用于接收管理服务器发送的用于认证的信息,并配合所述管理服务器对所述用户设备进行认证;
其中所述认证的结果用于所述管理服务器依据认证通过的结果向用户设备返回用于建立通道的参数信息。
本发明还提供了一种设备,包括
一个或者多个处理器;
存储器;
一个或者多个程序,所述一个或者多个程序存储在所述存储器中,被所述一个或者多个处理器执行以实现如下操作:
获取认证码;
将包含认证码的数据发送给管理服务器;
接收所述管理服务器利用所述包含认证码的数据进行认证通过后返回的用于建立通道的参数信息;
利用所述参数信息,建立用户设备与连接服务器之间的通道。
由以上技术方案可以看出,本发明中用户设备需在管理服务器处认证通过后,才能够从管理服务器获取用于建立通道的参数信息,进而与连接服务器建立通道,这种通道的建立方式能够提高云端与用户端之间交互的安全性。
附图说明
图1为本发明实施例提供的系统架构图;
图2为本发明实施例提供的主要方法流程图;
图3为本发明实施例提供的详细方法流程图;
图4为本发明实施例提供的状态机示意图;
图5为本发明实施例提供的设置于用户设备的装置结构图;
图6为本发明实施例提供的设置于管理服务器的装置结构图;
图7为本发明实施例提供的设置于连接服务器的装置结构图;
图8为本发明实施例提供的一种设置于标识服务器的装置结构图;
图9为本发明实施例提供的设备结构示意图。
具体实施方式
为了使本发明的目的、技术方案和优点更加清楚,下面结合附图和具体实施例对本发明进行详细描述。
在本发明实施例中使用的术语是仅仅出于描述特定实施例的目的,而非旨在限制本 发明。在本发明实施例和所附权利要求书中所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚地表示其他含义。
应当理解,本文中使用的术语“和/或”仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,本文中字符“/”,一般表示前后关联对象是一种“或”的关系。
取决于语境,如在此所使用的词语“如果”可以被解释成为“在……时”或“当……时”或“响应于确定”或“响应于检测”。类似地,取决于语境,短语“如果确定”或“如果检测(陈述的条件或事件)”可以被解释成为“当确定时”或“响应于确定”或“当检测(陈述的条件或事件)时”或“响应于检测(陈述的条件或事件)”。
为了方便对本发明的理解,首先对本发明所基于的系统架构进行描述。如图1所示,该系统可以包括用户设备、管理服务器和连接服务器,还可以进一步包括标识服务器。其中用户设备指的是用户端的设备,可以包括但不限于诸如:智能移动终端、智能家电设备、网络设备、可穿戴式设备、智能医疗设备、PC(个人计算机)等。其中智能移动设备可以包括诸如手机、平板电脑、笔记本电脑、PDA(个人数字助理)等。智能家电设备可以包括诸如智能电视、智能空调、智能热水器、智能冰箱、智能空气净化器等等。网络设备可以包括诸如交换机、无线AP、服务器等。可穿戴式设备可以包括诸如智能手表、智能眼镜、智能手环等等。智能医疗设备可以包括诸如智能体温计、智能血压仪、智能血糖仪等等。
管理服务器和连接服务器可以是云端设备,例如,管理服务器可以为一个独立的服务器,连接服务器可以设置多个(如以服务器集群的形式存在);又例如,管理服务器和连接服务器可以设置为同一个服务器,或者,当有多个连接服务器时,管理服务器可以和某一个连接服务器设置为同一服务器,本申请不对管理服务器和连接服务器的存在方式做任何限制。其中管理服务器主要负责与用户设备协商建立通道的参数信息,用户设备在得到通道的参数信息后,与连接服务器之间建立通道,之后用户端与云端之间传输的数据就通过该通道进行传输,从而保证安全。
标识服务器可以是一个独立的服务器,也可以和管理服务器设置在同一个服务器中。在本发明实施例中,标识服务器主要负责为用户设备分配认证码,维护用户设备的唯一标识信息以及认证码之间的对应关系,可以针对管理服务器提供的认证码进行认证并返回认证结果;也可以针对管理服务器提供的用户设备的唯一标识信息向管理服务器返回 对应的认证码,具体将在后续实施例中详述。
本申请实施例中,对于各服务器进行了命名,例如,管理服务器、标识服务器、连接服务器,该命名的目的主要是为了描述清晰起见,实际应用中,被命名为其他名称、但能够实现相同或类似功能的服务器,均属于本申请的保护范围。
本申请实施例中,对于各个服务器的划分,例如,管理服务器、标识服务器、连接服务器,是从各服务器主要实现的功能角度进行的逻辑划分,实际应用中,各个服务器可以部署在一台计算机设备中;或者,各个服务器也可以部署在多台计算机设备中;或者,各个服务器的数量,分别可以根据实际的业务需求进行灵活设置,例如,连接服务器可以为多个,每一个连接服务器可以提供不同的服务;又例如,管理服务器可以为多个,包括上级管理服务器和下级管理服务器,每个下级管理服务器可以负责不同用户设备。
图2为本发明实施例提供的主要方法流程图,如图2所示,该方法主要包括以下步骤:
在201中,用户设备获取认证码。
认证码是用于提供给管理服务器进行认证时使用的,在本发明实施例中对认证码的形式并不加以限制,只要其具有一定的随机性和一定时间范围内的唯一性即可。对于认证码,可以由标识服务器向用户设备分配并进行维护。标识服务器为用户设备分配认证码后,可以在本地维护用户设备的唯一标识信息与认证码之间的对应关系。具体将在后续实施例中进行详述。
在202中,用户设备将包含认证码的数据发送给管理服务器。
在本发明实施例中,在发送认证码的同时将用户设备的唯一标识信息发送给管理服务器,以便管理服务器利用该唯一标识信息对认证码进行认证。
在203中,管理服务器利用包含认证码的数据进行认证。
在进行认证时,管理服务器可以将该认证码提供给标识服务器,由标识服务器对该认证码进行认证后,返回认证结果给管理服务器。也可以将用户设备的唯一标识信息提供给标识服务器,并接收标识服务器返回的该唯一标识信息对应的认证码,然后利用该认证码对用户设备发送的认证码进行认证。考虑到更高的安全性,优选前一种实现方式。
更进一步地,用户设备发送的包含认证码的数据还可以包括签名信息,该签名信息用于管理服务器进行校验使用,具体将在后续实施例中详述。
在204中,认证通过后,向用户设备返回用于建立通道的参数信息。
其中用于建立通道的参数信息可以包括:种子密钥(seedKey)和连接参数。其中seedKey是用于对传输数据进行加/解密的密钥;连接参数用于建立用户设备与连接服务器之间的连接,可以包括诸如sid、连接服务器的IP地址和端口号等。
上述包含认证码的数据可以通过HTTP POST的形式发送,参数信息可以通过HTTP响应的形式发送。
在205中,用户设备利用参数信息,建立与连接服务器之间的通道,后续用户端与云端之间要传输的数据通过该通道进行传输。
建立通道主要包括三方面的内容:一方面是利用连接参数建立用户设备与连接服务器之间的长连接的过程,另一方面建立云通道的过程;在一方面是配置该云通道上数据加/解密采用seedKey。这几个方面的内容将在后续实施例中进行详细描述。
下面结合一个具体的实施例,对上述方法进行详细描述。图3为本发明实施例提供的详细方法流程图,其中CCP模块和ID2模块为用户设备中的两个模块,CCP模块为系统级别的执行模块,也可以是应用级别的执行模块,若为应用级别的执行模块,则需要ID2模块向该应用级别的模块开放访问权限。ID2模块可以为用户设备中设置于安全执行环境的模块,例如采用安全芯片的形式,在本实施例中用户设备的唯一标识采用ID2表示。CCP是云通道协议(Cloud Channel Protocol)的简称,对于云端与用户端之间的通道协议也可以采用其他协议类型,在本发明实施例中以CCP协议为例,如图3中所示,该方法可以包括以下步骤:
在301中,CCP模块向ID2模块请求ID2。
在本发明实施例中采用固化于用户设备的芯片中,不可篡改和非法获取的ID2作为用户设备的唯一标识,该ID2固化于安全芯片中,该安全芯片在本发明实施例中作为ID2模块,即只有ID2模块具有对ID2进行处理的权限,其他模块可以向ID2模块请求ID2。
当用户设备需要与云端进行交互时,需要首先建立用户设备与云端的连接服务器之间的CCP通道以进行数据传输,此时可以由CCP模块向ID2模块请求ID2。
在302中,ID2模块向标识服务器请求认证码,该请求中携带该用户设备的ID2。
在本发明实施例中标识服务器维护有所有合法设备的ID2,并且在本发明实施例中由标识服务器为各合法的用户设备分配认证码。标识服务器接收到请求后,可以首先对请求中携带的ID2进行合法性验证,如果该ID2为合法设备的ID2,则为该用户设备分配认证码;否则,拒绝为该用户设备分配认证码。
在303中,ID2模块获取标识服务器返回的认证码。
需要说明的是,ID2模块与标识服务器之间的信息交互通过ID2模块和标识服务器之间的通道发送。在ID2模块中可以预置标识服务器的连接参数,在ID2模块与标识服务器之间建立连接后,可以采用预先约定的密钥(该预先约定的密钥可以预先写入ID2模块)对上述ID2、认证码进行加解密;也可以在连接建立后进行密钥的协商,然后利用协商的密钥对上述ID2、认证码进行加解密。
在304中,ID2模块对ID2、认证码、appkey和appsecret进行签名后,将ID2、认证码、appkey以及签名信息提供给CCP模块。
在此对签名的方式并不加以限制,可以采用诸如RSA算法等。
需要注意的是,在进行签名时是对ID2、认证码、appkey和appsecret这四个参数进行的,但发送的数据中并不包含appsecret。另外,appkey是来源于CCP模块的,也就是说,ID2模块在进行签名之前,首先从CCP模块获取appkey,然后再执行上述签名的处理后,再将ID2、认证码、appkey和签名信息提供给CCP模块,该过程图中未示出。
上述认证码的获取和签名都在ID2模块进行,由于ID2模块是一块安全芯片,属于安全执行环境,因此认证码无法被外界获取和篡改,加强了安全性。
在305中,CCP模块将ID2、认证码、应用密钥(appkey)以及签名信息通过HTTP POST形式发送给管理服务器。
在306中,管理服务器将ID2和认证码发送给标识服务器。
在307中,管理服务器利用该用户设备的ID2、认证码、appkey以及签名信息进行校验,以及获取标识服务器对认证码的认证结果。
对签名进行校验的过程可以包括:首先利用appkey确定对应的应用秘密(appsecret),在此需要说明的是,在管理服务器中预先维护有各appkey对应的appsecret;然后利用确定出的appsecret对签名信息进行验证,即在本地对ID2、认证码、appkey和appsecret进行签名,将得到的签名信息与用户设备发送的签名信息进行比对,如果一致,则校验通过;否则校验失败。
对于标识服务器而言,在接收到管理服务器发送的ID2和认证码后,确定该ID2对应的认证码。由于认证码是标识服务器针对各用户设备分配的,并且在标识服务器本地维护了各ID2对应的认证码,因此可以确定出管理服务器提供的ID2对应的认证码,然后将确定出的认证码与接收到的认证码进行比对,如果一致,则认证通过,否则认证失败。其中,认证码的分配方式可以是随机生成的,也可以从认证码池中随机选择的一个认证码。
需要说明的是,标识服务器维护的认证码是存在老化时间的,当达到老化时间后,该认证码失效。
除了上述认证的实现方式之外,还存在另一种实现方式:管理服务器将ID2提供给标识服务器,标识服务器并不负责进行认证码的认证,而是将该ID2对应的认证码返回给管理服务器,由管理服务器利用标识服务器返回的认证码对用户设备提供的认证码进行认证,如果不一致,则认证失败。但考虑到安全性的因素,前一种实现方式的安全性更高,因此优选前一种实现方式。
需要说明的是,上述校验和对认证码的认证可以采用任意的顺序先后执行,也可以同时执行。只有校验和对认证码的认证均成功时,才算认证通过,有一个不成功,则认为认证失败。
或者,可以先进行校验,如果校验失败,则可以不考虑或者不进行对认证码的认证;如果校验成功,则进一步考虑或者进行对认证码的认证。也可以先进行对认证码的认证,如果认证成功,再进一步进行校验;如果认证失败,则不用进行校验。
在308中,如果认证通过,则将用于建立通道的参数信息通过HTTP响应的形式发送给用户设备,其中用于建立通道的参数信息可以包括seedKey和连接参数,连接参数包括诸如sid、apid、连接服务器的IP地址和Port号。
sid表示会话id,由管理服务器生成,用于标识用户设备与连接服务器之间一次连接的会话,后续用户设备与连接服务器之间的数据包都要携带该sid。
apid表示用户设备的应用标识,其是用于标识应用的,属于同一应用的各通道都采用相同的apid。该apid是可选的内容。
其中发送给用户设备的用于建立通道的参数信息也是经过加密的,具体方式可以为:管理服务器向用户设备返回的HTTP响应消息的消息头中携带利用用户设备的ID2进行加密后的seedKey,消息体中携带利用seedKey加密后的连接参数。
在309中,CCP模块将HTTP响应提供给ID2模块。
在310中,ID2模块解析HTTP响应得到其中的用于建立通道的参数信息并提供给CCP模块。
解析过程可以包括:利用用户设备的ID2对HTTP响应消息的消息头进行解密,得到seedKey;再利用seedKey对消息体进行解密,得到诸如sid、apid、连接服务器的IP地址和Port号等连接参数。
也可以CCP模块将HTTP响应消息的消息头提供给ID2模块,由ID2模块利用ID2 对HTTP响应消息的消息头进行解密,得到seedKey;然后将seedKey提供给CCP模块。CCP模块利用seedKey对HTTP响应消息的消息体进行解密,得到诸如sid、apid、连接服务器的IP地址和Port号等连接参数。该种实现方式图中未示出。
在311中,CCP模块利用连接参数与连接服务器建立TCP长连接。
TCP长连接建立过程为已有技术,在此不再详述。
在312中,CCP模块和连接服务器之间进行CCP连接报文的交互,从而建立用户设备与连接服务器之间的CCP通道。即CCP模块向连接服务器发送CCP连接请求,连接服务器向CCP模块发送CCP连接确认。
由于本实施例是以CCP协议为例进行描述,因此本步骤中进行通道建立时,交互的是CCP连接报文,若采用其他通道协议,则进行其他通道协议类型的连接报文。
在313中,用户设备和连接服务器之间通过seedKey对云通道上传输的数据进行加/解密。
管理服务器在分配sid和seedKey给用户设备后,会将其同步给连接服务器,也就是说,连接服务器可以从管理服务器同步sid和seedKey之间的对应关系。后续用户设备在通道上发送来的数据包会携带sid,连接服务器通过该sid就能够获知在该通道上采用什么seedKey,即该sid对应的seedKey。
用户设备对于发送给连接服务器的数据包采用seedKey进行加密,对于来自连接服务器的数据包采用seedKey进行解密。连接服务器对于发送给用户设备的数据包采用seedKey进行加密,对于来自用户设备的数据包采用seedKey进行解密。
在CCP通道上传输数据时,可以采用异步的方式收发数据。下面分别对数据的接收和发送机制进行详述。
通过CCP通道接收数据时,由于服务端返回的TCP数据是零散的、分片的且可能跨越CCP多包的,因此为了能够正确解析CCP的每个数据包,本发明实施例可以采用状态机的方式接收数据包。状态机示意图可以如图4所示,主要包括四个状态:正常接收状态、收包中且包长未知状态、收包中且包长已知状态以及完成收包状态。
在正常接收状态下,若收到数据包的CCP协议头,但可变长编码并未接收完整,则进入收包中且包长未知状态;若收到完整数据包,则进入完成收包状态。
在收包中且包长未知状态下,若收到新的分片,但可变长编码未接收完整,则继续处于收包中且包长未知状态下;若可变长编码接收完整,但整个数据包未接收完,则进入收包中且包长已知状态;若收到新的分片,可变长编码接收完整,则进入完成收包状 态。
在收包中且包长已知状态下,若收到新的分片且整个数据包已接收完,则进入完成收包状态;若收到新的分片但整个数据包未接收完,则继续处于收包中且包长已知状态下。
在完成收包状态下,对属于同一数据包的各分片进行重组,并上报给对数据包进行解析的模块后进入正常接收状态。
在对于接收到的数据包进行解析时,可以根据包头判断协议类型,根据可变长编码获取payload(净荷)长度;然后利用seedKey对payload进行解密。完成之后,可以构造PUSHACK消息并异步发送给连接服务器。
若解析该数据包的协议类型为PUSH消息时,可以从解密后的数据包中提取应用数据并回调给上层业务模块处理。其中用户设备在执行该回调时,如果出现异常,可以关闭CCP通道,然后CCP模块可以重新执行图3所示流程,从而重新建立用户设备与连接服务器之间的CCP通道。
在通过CCP通道发送数据时,为了满足跨线程的需求,CCP使用同步async变量的data字段来缓存要发送的报文链。因此,在本发明实施例中,可以利用要发送的数据构造Request消息,然后将Request消息挂到RPC发送链的链尾。其中利用要发送的数据构造Request消息时,使用seedKey对要发送的数据进行加密。
另外,为了保证通道的可靠性,在CCP通道上存在一个心跳检测机制,即连接服务器周期性地发送心跳消息Ping,例如,连接服务器每隔70秒向用户设备发送一个Ping。用户设备接收到Ping后返回心跳响应Pong。若连接服务器超过设定时长未接收到Pong,则关闭该CCP通道。
在用户设备侧周期性地检测是否接收到Ping,例如每10秒检测一次是否接收到Ping。若用户设备超过设定时长未接收到Ping,例如超过120秒未接收到Ping,则也可以关闭该CCP通道。当CCP通道由于上述原因被关闭后,CCP模块可以重新执行图3所示流程,从而重新建立用户设备与连接服务器之间的CCP通道。
另外,用户设备可以对注册的网络事件进行监听,如果网络出现异常,则关闭该CCP通道。当网络恢复后,CCP模块可以重新执行图3所示流程,从而重新建立用户设备与连接服务器之间的CCP通道。
以上是对本发明所提供方法进行的详细描述,下面结合具体实施例对本发明提供的装置进行详细描述。
图5为本发明实施例提供的设置于用户设备的装置结构图,该装置用于完成上述方法实施例中用户设备所执行的操作。如图5所示,该装置可以包括:认证码获取模块01、参数获取模块02和连接处理模块03,还可以进一步包括数据处理模块04、心跳维护模块05和网络监听模块06。各组成模块的主要功能如下:
认证码获取模块01负责获取认证码。具体地,认证码获取模块01可以从标识服务器获取认证码,即发送用户设备的唯一标识给标识服务器;接收标识服务器针对用户设备的唯一标识返回的认证码。
参数获取模块02负责将包含认证码的数据发送给管理服务器;接收管理服务器利用包含认证码的数据进行认证通过后返回的用于建立通道的参数信息。
其中包含认证码的数据还包括:用户设备的唯一标识。另外,认证码获取模块01可以对用户设备的唯一标识、认证码、appkey以及appsecret进行签名。参数获取模块02在将包含认证码的数据发送给管理服务器时,将认证码获取模块01得到的签名值、用户设备的唯一标识、认证码以及appkey发送给管理服务器。
上述的认证码获取模块01实际上相当于上述方法实施例中的ID2模块,其可以设置于用户设备的安全芯片。
参数获取模块02可以将包含认证码的数据通过HTTP POST的形式发送给管理服务器;接收通过HTTP响应的形式发送的用于建立通道的参数信息。
其中,用于建立通道的参数信息可以包括:用于对传输数据进行加/解密的seedKey以及连接参数。连接参数可以包括:sid、连接服务器的IP地址和端口号。
具体地,参数获取模块02在接收管理服务器返回的参数信息时,可以首先接收管理服务器返回的消息;然后利用用户设备的唯一标识对接收到的消息的消息头进行解密,得到seedKey;再利用seedKey,对消息的消息体进行解密,得到连接参数。
连接处理模块03负责利用用于建立通道的参数信息,建立与连接服务器之间的通道。具体地,可以首先利用连接参数,与连接服务器建立TCP长连接;然后向连接服务器发送通道连接请求,以及接收连接服务器返回的通道连接确认,从而建立与连接服务器之间的云通道;后续利用seedKey对云通道上传输的数据进行加/解密。
数据处理模块04负责在通道上采用异步方式收发数据。具体地,可以采用状态机的方式接收和重组通过通道发送来的数据包,如图4中所示,可以包括以下几种状态和迁移方式:
在正常接收状态下,若收到数据包的协议头(若通道采用CCP协议,则为CCP协 议头),但长度可变长编码并未接收完整,则进入收包中且包长未知状态;若收到完整数据包,则进入完成收包状态。
在收包中且包长未知状态下,若收到新的分片,但长度可变长编码未接收完整,则继续处于收包中且包长未知状态下;若长度可变长编码接收完整,但整个数据包未接收完,则进入收包中且包长已知状态;若收到新的分片,长度可变长编码接收完整,则进入完成收包状态。
在收包中且包长已知状态下,若收到新的分片且整个数据包已接收完,则进入完成收包状态;若收到新的分片但整个数据包未接收完,则继续处于收包中且包长已知状态下。
在完成收包状态下,对属于同一数据包的各分片进行重组,并上报给对数据包进行解析的模块后进入正常接收状态。
连接处理模块03在对通过通道接收到的数据包进行解析时,若解析数据包为PUSH消息时,从解密后的数据包中提取应用数据并回调给上层业务模块处理。若连接处理模块03在执行回调时,出现状态异常,则关闭该通道。
数据处理模块03在通道上采用异步方式发送数据时,可以利用要发送的数据构造请求消息,将请求消息挂到RPC发送链的链尾。
心跳维护模块05负责通过通道接收到心跳消息后,返回心跳响应;若超过设定时长未通过通道收到心跳消息,则触发连接处理模块03关闭通道。
网络监听模块06负责监听网络事件,若网络出现异常,则触发连接处理模块03关闭通道。
对于上述情况,连接处理模块03在关闭通道后,触发认证码获取模块01重新执行获取认证码的操作,以重新建立与连接服务器之间的通道。
图6为本发明实施例提供的设置于管理服务器的装置结构图,该装置用于完成方法实施例中管理服务器所执行的操作。如图6所示,该装置可以包括:认证码接收模块11、认证处理模块12和参数处理模块13。各组成模块的主要功能如下:
认证码接收模块11负责接收用户设备发送的包含认证码的数据。
认证处理模块12负责利用包含认证码的数据进行认证。
上述包含认证码的数据还包括用户设备的唯一标识信息,认证处理模块12在进行认证时,可以采用以下两种实现方式:
第一种方式:认证处理模块12将用户设备的唯一标识信息和认证码发送给标识服务 器;获取标识服务器返回的对所述认证码的认证结果。
这种方式实际上是由标识服务器负责对认证码进行认证,即标识服务器接收到管理服务器发送的唯一标识信息和认证码后,确定本地维护的该唯一标识信息对应的认证码,将确定的认证码与接收到的认证码进行比对,如果一致,则返回认证成功的结果,如果失败,则返回认证失败的结果。
第二种方式:认证处理模块12将用户设备的唯一标识信息发送给标识服务器;获取标识服务器返回的唯一标识信息对应的认证码;利用从标识服务器获取的认证码,对所述用户设备发送的认证码进行认证。
更进一步地,包含认证码的数据还可以包括appkey和签名信息,这种情况下,认证处理模块12在进行认证时,可以进一步执行:确定本地维护的appkey对应的appsecret;利用appsecret、用户设备的唯一标识、认证码以及appkey对用户设备发送的签名信息进行校验;如果校验失败,则认证失败。也就是说,认证处理模块12进行的认证可以包括对签名的校验以及对认证码的认证,两者都通过则认证通过,有其一失败,则认证失败。
参数处理模块13负责在认证通过后,向用户设备返回用于通道的参数信息,以便用户设备建立与连接服务器之间的通道。
上述的认证码接收模块11接收通过HTTP POST形式发送的包含认证码的数据;参数处理模块13将用于建立通道的参数信息通过HTTP响应的形式返回给用户设备。
其中用于建立通道的参数信息可以包括:用于对传输数据进行加/解密的seedKey以及连接参数,连接参数可以包括:sid、连接服务器的IP地址和端口号。参数处理模块13向用户设备返回的消息的消息头中携带利用用户设备的唯一标识加密后的seedKey,消息的消息体携带利用seedKey加密后的连接参数。
图7为本发明实施例提供的设置于连接服务器的装置结构图,如图7所示,该装置可以包括:连接处理模块21,还可以包括数据处理模块22、同步模块23和心跳维护模块24。各组成模块的主要功能如下:
连接处理模块21负责接收用户设备利用用于建立通道的参数信息发送的连接请求,建立连接服务器与用户设备之间的通道,其中参数信息是管理服务器利用用户设备发送的认证码进行认证通过后返回给所述用户设备的。
其中,用于建立通道的参数信息包括:用于对传输数据进行加/解密的seedKey以及连接参数。连接参数可以包括:isd、连接服务器的IP地址和端口号。
在建立通道时,连接处理模块21建立连接服务器与用户设备之间的TCP长连接, 该TCP长连接是用户设备利用连接参数请求建立的;接收用户设备发送的通道连接请求,以及向用户设备发送通道连接确认,从而建立与用户设备之间的云通道。后续数据处理模块22利用seedKey对云通道上传输的数据进行加/解密。
同步模块23负责从管理服务器同步sid和seedKey之间的对应关系;数据处理模块22通过通道接收到数据包后,确定在该通道上采用该数据包所携带的sid对应的seedKey,采用该seedKey对传输的数据进行加/解密处理。
另外,为了保证通道的可靠性,心跳维护模块24周期性地通过通道发送心跳消息;若超过设定时长未通过通道接收到心跳响应,则触发连接处理模块关闭通道。
对于标识服务器可以采用如图8中所示的结构。图8为本发明实施例提供的一种设置于标识服务器的装置结构图,如图8所示,该装置可以包括:分配模块31和认证模块32。各组成模块的主要功能如下:
分配模块31负责为用户设备分配并发送认证码。具体地,分配模块31接收到用户设备发送的唯一标识信息后,向用户设备分配并返回认证码。其中,认证码的分配方式可以是随机生成的,也可以从认证码池中随机选择的一个认证码。
另外,在标识服务器本地会维护唯一标识信息与认证码之间的对应关系,且各认证码具有老化时间,到达老化时间后,认证码失效。
认证模块32负责接收管理服务器发送的用于认证的信息,并配合管理服务器对所述用户设备进行认证;其中认证的结果用于所述管理服务器依据认证通过的结果向用户设备返回用于建立通道的参数信息。
认证模块32可以存在两种实现方式:
第一种实现方式:认证模块32接收到管理服务器提供的所述用户设备的认证码后,对接收到的认证码进行认证并向管理服务器返回认证结果。
具体地,认证模块32可以利用连同用户设备的认证码一起接收到的用户设备的唯一标识信息,确定本地维护的与用户设备的唯一标识信息对应的认证码;将确定出的认证码与接收到的认证码进行比对,如果一致,则认证通过;否则认证失败。
第二种实现方式:认证模块32接收到管理服务器提供的用户设备的唯一标识信息后,向管理服务器返回唯一标识信息对应的认证码,以便管理服务器利用接收到的认证码进行认证。
本发明实施例提供的上述方法和装置可以设置并运行于设备中的计算机程序体现。该设备可以包括一个或多个处理器,还包括存储器和一个或多个程序,如图9中所示。 其中该一个或多个程序存储于存储器中,被上述一个或多个处理器执行以实现本发明上述实施例中所示的方法流程和/或装置操作。例如,被上述一个或多个处理器执行的方法流程,可以包括:
获取认证码;
将包含认证码的数据发送给管理服务器;
接收管理服务器利用包含认证码的数据进行认证通过后返回的用于建立通道的参数信息;
利用该参数信息,建立用户设备与连接服务器之间的通道。
本发明实施例提供的上述方法和装置可以广泛地应用于各种领域,例如可以应用于物联网中各种智能家电设备、智能汽车等与云端服务器之间的安全通信。其中连接服务器可以是云端为物联设备提供具体服务的应用服务器。
举一个例子,在智能电视中的安全芯片中预先写入为该智能电视分配的ID2,基于该ID2从标识服务器获取认证码,并基于该认证码在管理服务器处通过认证后,从管理服务器获取连接服务器的连接参数。此时的连接服务器可以为视频服务器,连接参数包括seedkey、会话标识、视频服务器的IP地址和端口号。智能电视可以进一步利用获取到的视频服务器的IP地址和端口号,与视频服务器建立CCP通道,在该CCP通道上,智能电视与视频服务器之间进行的数据交互均采用seedkey进行加密,并且采用上述连接参数中的会话标识来标识该通道上的会话。这样就保证了智能电视与视频服务器之间的安全连接。
在本发明所提供的几个实施例中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述模块的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。
所述作为分离部件说明的模块可以是或者也可以不是物理上分开的,作为模块显示的部件可以是或者也可以不是物理模块,即可以位于一个地方,或者也可以分布到多个网络模块上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。
另外,在本发明各个实施例中的各功能模块可以集成在一个处理模块中,也可以是各个模块单独物理存在,也可以两个或两个以上模块集成在一个模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用硬件加软件功能模块的形式实现。
上述以软件功能模块的形式实现的集成的模块,可以存储在一个计算机可读取存储 介质中。上述软件功能模块存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)或处理器(processor)执行本发明各个实施例所述方法的部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。
以上所述仅为本发明的较佳实施例而已,并不用以限制本发明,凡在本发明的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本发明保护的范围之内。

Claims (81)

  1. 一种连接建立方法,其特征在于,该方法包括:
    用户设备获取认证码;
    将包含认证码的数据发送给管理服务器;
    接收所述管理服务器利用所述包含认证码的数据进行认证通过后返回的用于建立通道的参数信息;
    利用所述参数信息,建立与连接服务器之间的通道。
  2. 根据权利要求1所述的方法,其特征在于,所述用户设备获取认证码包括:所述用户设备从标识服务器获取认证码。
  3. 根据权利要求2所述的方法,其特征在于,所述用户设备从标识服务器获取认证码包括:
    所述用户设备发送所述用户设备的唯一标识给标识服务器;
    接收所述标识服务器针对所述用户设备的唯一标识返回的认证码。
  4. 根据权利要求1所述的方法,其特征在于,所述包含认证码的数据还包括:所述用户设备的唯一标识。
  5. 根据权利要求4所述的方法,其特征在于,所述将包含认证码的数据发送给管理服务器包括:
    对所述用户设备的唯一标识、认证码、应用密钥以及应用秘密进行签名;
    将签名值、所述用户设备的唯一标识、认证码以及应用密钥发送给所述管理服务器。
  6. 根据权利要求5所述的方法,其特征在于,向所述标识服务器发送用户设备的唯一标识、接收所述认证码以及所述进行签名由所述用户设备中的安全芯片执行。
  7. 根据权利要求1所述的方法,其特征在于,所述包含认证码的数据通过HTTP POST的形式发送给所述管理服务器;
    所述参数信息通过HTTP响应的形式接收。
  8. 根据权利要求1所述的方法,其特征在于,所述参数信息包括:
    用于对传输数据进行加/解密的种子密钥以及连接参数。
  9. 根据权利要求8所述的方法,其特征在于,接收所述管理服务器利用所述包含认证码的数据进行认证通过后返回的用于建立通道的参数信息包括:
    接收所述管理服务器返回的消息;
    利用所述用户设备的唯一标识对接收到的消息的消息头进行解密,得到所述种子密 钥;
    利用所述种子密钥,对所述消息的消息体进行解密,得到所述连接参数。
  10. 根据权利要求8或9所述的方法,其特征在于,所述连接参数包括:
    会话标识、连接服务器的IP地址和端口号。
  11. 根据权利要求8所述的方法,其特征在于,利用所述参数信息,建立与连接服务器之间的通道包括:
    利用所述连接参数,与所述连接服务器建立TCP长连接;
    向所述连接服务器发送通道连接请求,以及接收所述连接服务器返回的通道连接确认,从而建立与所述连接服务器之间的云通道;
    利用所述种子密钥对所述云通道上传输的数据进行加/解密。
  12. 根据权利要求1所述的方法,其特征在于,该方法还包括:
    在所述通道上采用异步方式收发数据。
  13. 根据权利要求12所述的方法,其特征在于,在所述通道上采用异步方式接收数据包括:
    采用状态机的方式接收和重组通过所述通道发送来的数据包。
  14. 根据权利要求13所述的方法,其特征在于,采用状态机的方式接收和重组通过所述通道发送来的数据包包括:
    在正常接收状态下,若收到协议头且长度可变长编码未接收完整,则进入收包中且包长未知状态;
    在收包中且包长未知状态下,若收到完整长度的可变长编码但数据包未接收完整,则进入收包中且包长已知状态;若收到新的分片且可变长编码和数据包均接收完整,则进入完成收包状态;
    在收包中且包长已知状态下,若收到新的分片且数据包接收完整,则进入完成收包状态;
    在完成收包状态下,对属于该数据包的各分片进行重组后进入正常接收状态。
  15. 根据权利要求1或12所述的方法,其特征在于,该方法还包括:
    对通过所述通道接收到的数据包进行解析;
    若解析所述数据包为PUSH消息时,从解密后的数据包中提取应用数据并回调给上层业务模块处理。
  16. 根据权利要求12所述的方法,其特征在于,在所述通道上采用异步方式发送 数据包括:
    利用要发送的数据构造请求消息;
    将所述请求消息挂到远程过程调用协议RPC发送链的链尾。
  17. 根据权利要求1所述的方法,其特征在于,该方法还包括:
    通过所述通道接收到心跳消息后,返回心跳响应;
    若超过设定时长未通过所述通道收到心跳消息,则关闭所述通道。
  18. 根据权利要求15所述的方法,其特征在于,若在执行所述回调时,出现状态异常,则关闭所述通道。
  19. 根据权利要求1所述的方法,其特征在于,该方法还包括:
    所述用户设备监听网络事件,若网络出现异常,则关闭所述通道。
  20. 根据权利要求17、18或19所述的方法,其特征在于,在所述关闭所述通道之后,还包括:
    转至执行所述获取认证码的步骤,以重新建立与连接服务器之间的通道。
  21. 一种连接建立方法,其特征在于,该方法包括:
    管理服务器接收用户设备发送的包含认证码的数据;
    利用所述包含认证码的数据进行认证通过后,向所述用户设备返回用于建立通道的参数信息,以便所述用户设备建立与连接服务器之间的通道。
  22. 根据权利要求21所述的方法,其特征在于,所述包含认证码的数据还包括所述用户设备的唯一标识信息;
    利用所述包含认证码的数据进行认证包括:
    所述管理服务器将所述用户设备的唯一标识信息和所述认证码发送给标识服务器;
    获取所述标识服务器返回的对所述认证码的认证结果。
  23. 根据权利要求21所述的方法,其特征在于,所述包含认证码的数据还包括所述用户设备的唯一标识信息:
    利用所述包含认证码的数据进行认证包括:
    所述管理服务器将所述用户设备的唯一标识信息发送给标识服务器;
    获取所述标识服务器返回的所述唯一标识信息对应的认证码;
    利用从所述标识服务器获取的认证码,对所述用户设备发送的认证码进行认证。
  24. 根据权利要求22或23所述的方法,其特征在于,所述包含认证码的数据还包括应用密钥和签名信息;
    利用所述包含认证码的数据进行认证还包括:
    所述管理服务器确定本地维护的所述应用密钥对应的应用秘密;
    利用所述应用秘密、所述用户设备的唯一标识、认证码以及应用密钥对所述用户设备发送的签名信息进行校验;如果校验失败,则认证失败。
  25. 根据权利要求21所述方法,其特征在于,所述包含认证码的数据通过HTTP POST的形式发送给所述管理服务器;
    所述参数信息通过HTTP响应的形式返回给所述用户设备。
  26. 根据权利要求21所述方法,其特征在于,所述参数信息包括:
    用于对传输数据进行加/解密的种子密钥以及连接参数。
  27. 根据权利要求26所述的方法,其特征在于,所述管理服务器向所述用户设备返回的消息的消息头中携带利用所述用户设备的唯一标识加密后的种子密钥,所述消息的消息体携带利用所述种子密钥加密后的连接参数。
  28. 根据权利要求26或27所述的方法,其特征在于,所述连接参数包括:
    会话标识、连接服务器的IP地址和端口号。
  29. 一种连接建立方法,其特征在于,该方法包括:
    连接服务器接收用户设备利用用于建立通道的参数信息发送的连接请求,建立与所述用户设备之间的通道;
    其中所述参数信息是管理服务器利用用户设备发送的认证码进行认证通过后返回给所述用户设备的。
  30. 根据权利要求29所述的方法,其特征在于,所述参数信息包括:
    用于对传输数据进行加/解密的种子密钥以及连接参数。
  31. 根据权利要求29所述的方法,其特征在于,所述连接参数包括:
    会话标识、连接服务器的IP地址和端口号。
  32. 根据权利要求29所述的方法,其特征在于,连接服务器建立与用户设备之间的通道包括:
    建立与所述用户设备之间的TCP长连接,该TCP长连接是所述用户设备利用所述连接参数请求建立的;
    接收所述用户设备发送的通道连接请求,以及向所述用户设备发送通道连接确认,从而建立与所述用户设备之间的云通道;
    利用种子密钥对所述云通道上传输的数据进行加/解密。
  33. 根据权利要求31所述的方法,其特征在于,该方法还包括:所述连接服务器从所述管理服务器同步会话标识和种子密钥之间的对应关系;
    通过所述通道接收到数据包后,确定在该通道上采用该数据包所携带的会话标识对应的种子密钥。
  34. 根据权利要求29所述的方法,其特征在于,该方法还包括:
    所述连接服务器周期性地通过所述通道发送心跳消息;
    若超过设定时长未通过所述通道接收到心跳响应,则关闭所述通道。
  35. 一种连接建立方法,其特征在于,该方法包括:
    标识服务器为用户设备分配并发送认证码;
    接收管理服务器发送的用于认证的信息,并配合所述管理服务器对所述用户设备进行认证;
    其中所述认证的结果用于所述管理服务器依据认证通过的结果向用户设备返回用于建立通道的参数信息。
  36. 根据权利要求35所述的方法,其特征在于,所述标识服务器为用户设备分配并发送认证码包括:
    所述标识服务器接收到所述用户设备发送的唯一标识信息后,向所述用户设备分配并返回认证码。
  37. 根据权利要求35所述的方法,其特征在于,所述接收管理服务器发送的用于认证的信息,并配合所述管理服务器对所述用户设备进行认证包括:
    接收到管理服务器提供的所述用户设备的认证码后,对接收到的认证码进行认证并向管理服务器返回认证结果。
  38. 根据权利要求37所述的方法,其特征在于,所述对接收到的认证码进行认证包括:
    利用连同所述用户设备的认证码一起接收到的用户设备的唯一标识信息,确定本地维护的与所述用户设备的唯一标识信息对应的认证码;
    将确定出的认证码与接收到的认证码进行比对,如果一致,则认证通过;否则认证失败。
  39. 根据权利要求35所述的方法,其特征在于,所述接收管理服务器发送的用于认证的信息,并配合所述管理服务器对所述用户设备进行认证包括:
    接收到管理服务器提供的所述用户设备的唯一标识信息后,向所述管理服务器返回 所述唯一标识信息对应的认证码,以便所述管理服务器利用接收到的认证码进行认证。
  40. 根据权利要求38或39所述的方法,其特征在于,所述标识服务器本地维护的与所述用户设备的唯一标识信息对应的认证码具有老化时间。
  41. 一种连接建立装置,设置于用户设备,其特征在于,该装置包括:
    认证码获取模块,用于获取认证码;
    参数获取模块,用于将包含认证码的数据发送给管理服务器;接收所述管理服务器利用所述包含认证码的数据进行认证通过后返回的用于建立通道的参数信息;
    连接处理模块,用于利用所述参数信息,建立与连接服务器之间的通道。
  42. 根据权利要求41所述的装置,其特征在于,所述认证码获取模块,具体用于从标识服务器获取认证码。
  43. 根据权利要求42所述的装置,其特征在于,所述认证码获取模块,具体执行:
    发送所述用户设备的唯一标识给标识服务器;
    接收所述标识服务器针对所述用户设备的唯一标识返回的认证码。
  44. 根据权利要求41所述的装置,其特征在于,所述包含认证码的数据还包括:所述用户设备的唯一标识。
  45. 根据权利要求44所述的装置,其特征在于,所述认证码获取模块,还用于对所述用户设备的唯一标识、认证码、应用密钥以及应用秘密进行签名;
    所述参数获取模块在将包含认证码的数据发送给管理服务器时,具体执行:将所述认证码获取模块得到的签名值、所述用户设备的唯一标识、认证码以及应用密钥发送给所述管理服务器。
  46. 根据权利要求43或45所述的装置,其特征在于,所述认证码获取模块设置于所述用户设备的安全芯片。
  47. 根据权利要求41所述的装置,其特征在于,所述参数获取模块将所述包含认证码的数据通过HTTP POST的形式发送给所述管理服务器;接收通过HTTP响应的形式发送的所述参数信息。
  48. 根据权利要求41所述的装置,其特征在于,所述参数信息包括:
    用于对传输数据进行加/解密的种子密钥以及连接参数。
  49. 根据权利要求48所述的装置,其特征在于,所述参数获取模块在接收所述管理服务器返回的用于建立连接的参数信息时,具体执行:
    接收所述管理服务器返回的消息;
    利用所述用户设备的唯一标识对接收到的消息的消息头进行解密,得到所述种子密钥;
    利用所述种子密钥,对所述消息的消息体进行解密,得到所述连接参数。
  50. 根据权利要求46或49所述的装置,其特征在于,所述连接参数包括:
    会话标识、连接服务器的IP地址和端口号。
  51. 根据权利要求48所述的装置,其特征在于,所述连接处理模块,具体用于:
    利用所述连接参数,与所述连接服务器建立TCP长连接;
    向所述连接服务器发送通道连接请求,以及接收所述连接服务器返回的通道连接确认,从而建立与所述连接服务器之间的云通道;
    利用所述种子密钥对所述云通道上传输的数据进行加/解密。
  52. 根据权利要求41所述的装置,其特征在于,该装置还包括:
    数据处理模块,用于在所述通道上采用异步方式收发数据。
  53. 根据权利要求52所述的装置,其特征在于,所述数据处理模块,具体用于采用状态机的方式接收和重组通过所述通道发送来的数据包。
  54. 根据权利要求53所述的装置,其特征在于,所述数据处理模块在采用状态机的方式接收和重组通过所述通道发送来的数据包时,具体执行:
    在正常接收状态下,若收到协议头且长度可变长编码未接收完整,则进入收包中且包长未知状态;
    在收包中且包长未知状态下,若收到完整长度的可变长编码但数据包未接收完整,则进入收包中且包长已知状态;若收到新的分片且可变长编码和数据包均接收完整,则进入完成收包状态;
    在收包中且包长已知状态下,若收到新的分片且数据包接收完整,则进入完成收包状态;
    在完成收包状态下,对属于该数据包的各分片进行重组后进入正常接收状态。
  55. 根据权利要求41或52所述的装置,其特征在于,所述连接处理模块,还用于对通过所述通道接收到的数据包进行解析;若解析所述数据包为PUSH消息时,从解密后的数据包中提取应用数据并回调给上层业务模块处理。
  56. 根据权利要求52所述的装置,其特征在于,所述数据处理模块在所述通道上采用异步方式发送数据时,具体执行:
    利用要发送的数据构造请求消息;
    将所述请求消息挂到远程过程调用协议RPC发送链的链尾。
  57. 根据权利要求41所述的装置,其特征在于,该装置还包括:
    心跳维护模块,用于通过所述通道接收到心跳消息后,返回心跳响应;若超过设定时长未通过所述通道收到心跳消息,则触发所述连接处理模块关闭所述通道。
  58. 根据权利要求55所述的装置,其特征在于,若所述连接处理模块在执行所述回调时,出现状态异常,则关闭所述通道。
  59. 根据权利要求41所述的装置,其特征在于,该装置还包括:
    网络监听模块,用于监听网络事件,若网络出现异常,则触发所述连接处理模块关闭所述通道。
  60. 根据权利要求57、58或59所述的装置,其特征在于,所述连接处理模块在关闭所述通道后,触发所述认证码获取模块重新执行所述获取认证码的操作,以重新建立与连接服务器之间的通道。
  61. 一种连接建立装置,设置于管理服务器,其特征在于,该装置包括:
    认证码接收模块,用于接收用户设备发送的包含认证码的数据;
    认证处理模块,用于利用所述包含认证码的数据进行认证;
    参数处理模块,用于在所述认证通过后,向所述用户设备返回用于建立通道的参数信息,以便所述用户设备建立与连接服务器之间的通道。
  62. 根据权利要求61所述的装置,其特征在于,所述包含认证码的数据还包括所述用户设备的唯一标识信息;
    所述认证处理模块,具体用于将所述用户设备的唯一标识信息和所述认证码发送给标识服务器;获取所述标识服务器返回的对所述认证码的认证结果。
  63. 根据权利要求61所述的装置,其特征在于,所述包含认证码的数据还包括所述用户设备的唯一标识信息;
    所述认证处理模块,具体用于将所述用户设备的唯一标识信息发送给标识服务器;获取所述标识服务器返回的所述唯一标识信息对应的认证码;利用从所述标识服务器获取的认证码,对所述用户设备发送的认证码进行认证。
  64. 根据权利要求62或63所述的装置,其特征在于,所述包含认证码的数据还包括应用密钥和签名信息;
    所述认证处理模块在进行认证时,进一步执行:确定本地维护的所述应用密钥对应的应用秘密;利用所述应用秘密、所述用户设备的唯一标识、认证码以及应用密钥对所 述用户设备发送的签名信息进行校验;如果校验失败,则认证失败。
  65. 根据权利要求61所述的装置,其特征在于,所述认证码接收模块接收通过HTTP POST形式发送的包含认证码的数据;
    所述参数处理模块将所述参数信息通过HTTP响应的形式返回给所述用户设备。
  66. 根据权利要求61所述的装置,其特征在于,所述参数信息包括:
    用于对传输数据进行加/解密的种子密钥以及连接参数。
  67. 根据权利要求66所述的装置,其特征在于,所述参数处理模块向所述用户设备返回的消息的消息头中携带利用所述用户设备的唯一标识加密后的种子密钥,所述消息的消息体携带利用所述种子密钥加密后的连接参数。
  68. 根据权利要求66或67所述的装置,其特征在于,所述连接参数包括:
    会话标识、连接服务器的IP地址和端口号。
  69. 一种连接建立装置,设置于连接服务器,其特征在于,该装置包括:
    连接处理模块,用于接收用户设备利用用于建立通道的参数信息发送的连接请求,建立所述连接服务器与用户设备之间的通道;
    其中所述参数信息是管理服务器利用用户设备发送的认证码进行认证通过后返回给所述用户设备的。
  70. 根据权利要求69所述的装置,其特征在于,所述参数信息包括:
    用于对传输数据进行加/解密的种子密钥以及连接参数。
  71. 根据权利要求70所述的装置,其特征在于,所述连接参数包括:
    会话标识、连接服务器的IP地址和端口号。
  72. 根据权利要求70或71所述的装置,其特征在于,所述连接处理模块,具体执行:建立所述连接服务器与所述用户设备之间的TCP长连接,该TCP长连接是所述用户设备利用所述连接参数请求建立的;接收所述用户设备发送的通道连接请求,以及向所述用户设备发送通道连接确认,从而建立与所述用户设备之间的云通道;
    该装置还包括:数据处理模块,用于利用种子密钥对所述云通道上传输的数据进行加/解密。
  73. 根据权利要求71所述的装置,其特征在于,该装置还包括:
    同步模块,用于从所述管理服务器同步会话标识和种子密钥之间的对应关系;
    数据处理模块,用于通过所述通道接收到数据包后,确定在该通道上采用该数据包所携带的会话标识对应的种子密钥。
  74. 根据权利要求69所述的装置,其特征在于,该装置还包括:
    心跳维护模块,用于周期性地通过所述通道发送心跳消息;若超过设定时长未通过所述通道接收到心跳响应,则触发所述连接处理模块关闭所述通道。
  75. 一种连接建立装置,设置于标识服务器,其特征在于,该标识服务器包括:
    分配模块,用于为用户设备分配并发送认证码;
    认证模块,用于接收管理服务器发送的用于认证的信息,并配合所述管理服务器对所述用户设备进行认证;
    其中所述认证的结果用于所述管理服务器依据认证通过的结果向用户设备返回用于建立通道的参数信息。
  76. 根据权利要求75所述的装置,其特征在于,所述分配模块,具体用于接收到所述用户设备发送的唯一标识信息后,向所述用户设备分配并返回认证码。
  77. 根据权利要求75所述的装置,其特征在于,所述认证模块,具体用于接收到管理服务器提供的所述用户设备的认证码后,对接收到的认证码进行认证并向管理服务器返回认证结果。
  78. 根据权利要求77所述的装置,其特征在于,所述认证模块在对接收到的认证码进行认证时,具体执行:
    利用连同所述用户设备的认证码一起接收到的用户设备的唯一标识信息,确定本地维护的与所述用户设备的唯一标识信息对应的认证码;将确定出的认证码与接收到的认证码进行比对,如果一致,则认证通过;否则认证失败。
  79. 根据权利要求75所述的装置,其特征在于,所述认证模块,具体用于接收到管理服务器提供的所述用户设备的唯一标识信息后,向所述管理服务器返回所述唯一标识信息对应的认证码,以便所述管理服务器利用接收到的认证码进行认证。
  80. 根据权利要求78或79所述的装置,其特征在于,所述标识服务器本地维护的与所述用户设备的唯一标识信息对应的认证码具有老化时间。
  81. 一种设备,包括
    一个或者多个处理器;
    存储器;
    一个或者多个程序,所述一个或者多个程序存储在所述存储器中,被所述一个或者多个处理器执行以实现如下操作:
    获取认证码;
    将包含认证码的数据发送给管理服务器;
    接收所述管理服务器利用所述包含认证码的数据进行认证通过后返回的用于建立通道的参数信息;
    利用所述参数信息,建立用户设备与连接服务器之间的通道。
PCT/CN2017/086914 2016-06-14 2017-06-02 一种连接建立方法、装置和设备 WO2017215452A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US16/216,652 US10868801B2 (en) 2016-06-14 2018-12-11 Method and system for establishing connection

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610421385.8 2016-06-14
CN201610421385.8A CN107508847B (zh) 2016-06-14 2016-06-14 一种连接建立方法、装置和设备

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US16/216,652 Continuation-In-Part US10868801B2 (en) 2016-06-14 2018-12-11 Method and system for establishing connection

Publications (1)

Publication Number Publication Date
WO2017215452A1 true WO2017215452A1 (zh) 2017-12-21

Family

ID=60663934

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/086914 WO2017215452A1 (zh) 2016-06-14 2017-06-02 一种连接建立方法、装置和设备

Country Status (4)

Country Link
US (1) US10868801B2 (zh)
CN (1) CN107508847B (zh)
TW (1) TW201811087A (zh)
WO (1) WO2017215452A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111245813A (zh) * 2020-01-07 2020-06-05 北京数字认证股份有限公司 密码资源池系统、加密方法、电子设备及存储介质

Families Citing this family (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11288638B2 (en) * 2018-08-29 2022-03-29 Launch Tech Co., Ltd. Device management method, device management server and computer readable storage medium
CN109167834A (zh) * 2018-09-11 2019-01-08 上海庆科信息技术有限公司 一种智能设备的连云方法及其相关装置
CN110224821B (zh) * 2019-06-06 2021-11-09 安徽问天量子科技股份有限公司 一种无人移动平台的通信加密方法
CN110769402B (zh) * 2019-10-31 2022-05-24 广东美的制冷设备有限公司 运行控制方法、装置、空调器和计算机存储介质
TWI711937B (zh) * 2019-11-29 2020-12-01 中華電信股份有限公司 網路防護系統和網路防護方法
CN111614752B (zh) * 2020-05-19 2022-08-30 北京百度网讯科技有限公司 用于数据传输的方法和装置
CN113839973B (zh) * 2020-06-23 2024-04-12 炬芯科技股份有限公司 通信连接方法、装置、设备及存储介质
CN112818325A (zh) * 2021-01-30 2021-05-18 浪潮云信息技术股份公司 一种基于应用实现api网关独立鉴权的方法
US11729154B2 (en) * 2021-02-25 2023-08-15 Comcast Cable Communications, Llc Systems and methods for network privacy
US11516435B1 (en) * 2021-06-30 2022-11-29 Get Heal, Inc. System and method of contacting devices and creating a communication session
CN114157693A (zh) * 2021-11-30 2022-03-08 四川虹美智能科技有限公司 通信设备的上电认证方法、通信模块和服务器
CN114422570B (zh) * 2021-12-31 2024-05-14 深圳市联软科技股份有限公司 一种跨平台的多模块通讯方法及系统

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090228967A1 (en) * 2008-03-05 2009-09-10 Microsoft Corporation Flexible Scalable Application Authorization For Cloud Computing Environments
CN102098317A (zh) * 2011-03-22 2011-06-15 浙江中控技术股份有限公司 一种应用于云系统的数据传输方法及系统
CN102752269A (zh) * 2011-04-21 2012-10-24 中国移动通信集团广东有限公司 基于云计算的身份认证的方法、系统及云端服务器

Family Cites Families (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7197550B2 (en) * 2001-08-23 2007-03-27 The Directv Group, Inc. Automated configuration of a virtual private network
US8473620B2 (en) 2003-04-14 2013-06-25 Riverbed Technology, Inc. Interception of a cloud-based communication connection
CN1658553B (zh) * 2004-02-20 2011-04-27 中国电子科技集团公司第三十研究所 一种采用公开密钥密码算法加密模式的强鉴别方法
CN101383855B (zh) * 2007-09-04 2013-01-23 沈阳 一种基于ip地址信息获取计算机精确地理位置信息的方法
CN101262485B (zh) * 2008-04-10 2012-12-12 成都市华为赛门铁克科技有限公司 认证方法与系统、服务器及客户端
US8683562B2 (en) * 2011-02-03 2014-03-25 Imprivata, Inc. Secure authentication using one-time passwords
US9413811B2 (en) 2011-02-28 2016-08-09 Red Hat, Inc. Establishing upload channels to a cloud data distribution service
US9100188B2 (en) 2011-04-18 2015-08-04 Bank Of America Corporation Hardware-based root of trust for cloud environments
CN102289773A (zh) * 2011-05-05 2011-12-21 深圳市中冠通科技有限公司 证券信息预警的方法及系统
CN102355480B (zh) * 2011-07-21 2017-03-08 中兴通讯股份有限公司 基于tftp的文件传输方法、系统、客户端和服务器
CN202472744U (zh) * 2012-02-17 2012-10-03 湖南亲安网络科技有限公司 一种认证观看网络广告用户身份的装置
US20150036807A1 (en) * 2013-08-02 2015-02-05 Hope Bay Technology Corporation Methods and Systems for Remotely Recording and Managing Associated Recorded Files & Electronic Devices
CN105187362B (zh) * 2014-06-23 2020-01-10 中兴通讯股份有限公司 一种桌面云客户端和服务端之间连接认证的方法及装置
CN205281583U (zh) * 2015-12-07 2016-06-01 上海斐讯数据通信技术有限公司 一种用于家庭生活交费服务的新型云计算装置
CN105472003A (zh) * 2015-12-11 2016-04-06 珠海金山网络游戏科技有限公司 一种大规模分布式游戏服务器系统及其实现方法

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090228967A1 (en) * 2008-03-05 2009-09-10 Microsoft Corporation Flexible Scalable Application Authorization For Cloud Computing Environments
CN102098317A (zh) * 2011-03-22 2011-06-15 浙江中控技术股份有限公司 一种应用于云系统的数据传输方法及系统
CN102752269A (zh) * 2011-04-21 2012-10-24 中国移动通信集团广东有限公司 基于云计算的身份认证的方法、系统及云端服务器

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111245813A (zh) * 2020-01-07 2020-06-05 北京数字认证股份有限公司 密码资源池系统、加密方法、电子设备及存储介质
CN111245813B (zh) * 2020-01-07 2022-04-29 北京数字认证股份有限公司 密码资源池系统、加密方法、电子设备及存储介质

Also Published As

Publication number Publication date
US10868801B2 (en) 2020-12-15
US20190182223A1 (en) 2019-06-13
CN107508847A (zh) 2017-12-22
CN107508847B (zh) 2021-06-08
TW201811087A (zh) 2018-03-16

Similar Documents

Publication Publication Date Title
WO2017215452A1 (zh) 一种连接建立方法、装置和设备
CN109246053B (zh) 一种数据通信方法、装置、设备和存储介质
US10601594B2 (en) End-to-end service layer authentication
JP6651096B1 (ja) データ処理方法、装置、端末及びアクセスポイントコンピュータ
CN107566314B (zh) 一种数据传输系统、方法和设备
CN111799867B (zh) 一种充电设备与充电管理平台间的互信认证方法及系统
CN107659406B (zh) 一种资源操作方法及装置
EP2421292B1 (en) Method and device for establishing security mechanism of air interface link
EP2590356B1 (en) Method, device and system for authenticating gateway, node and server
WO2017028593A1 (zh) 网络接入设备接入无线网络接入点的方法、网络接入设备、应用程序服务器和非易失性计算机可读存储介质
WO2016127845A1 (zh) 语音认证系统和设备的工作方法
WO2019036019A1 (en) SYSTEMS AND METHODS FOR IMPLEMENTING DATA COMMUNICATIONS USING SECURITY TOKENS
CN109714360B (zh) 一种智能网关及网关通信处理方法
WO2018177385A1 (zh) 一种传输数据的方法、装置和设备
CN103166931A (zh) 一种安全传输数据方法,装置和系统
CN114503507A (zh) 安全的发布-订阅通信方法和设备
US20130227660A1 (en) Registration server, gateway apparatus and method for providing a secret value to devices
US11303453B2 (en) Method for securing communication without management of states
KR102017758B1 (ko) 의료 기기, 게이트웨이 기기 및 이를 이용한 프로토콜 보안 방법
Li et al. A secure sign-on protocol for smart homes over named data networking
CN111541776A (zh) 一种基于物联网设备的安全通信装置及系统
WO2017005163A1 (zh) 基于无线通信的安全认证装置
CN115280725A (zh) 一种数据帧安全传输方法、装置、电子设备及存储介质
CN105407102A (zh) http请求数据可靠性验证方法
CN107135190B (zh) 基于传输层安全连接的数据流量归属识别方法及装置

Legal Events

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

Ref document number: 17812563

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 17812563

Country of ref document: EP

Kind code of ref document: A1