WO2018014723A1 - Key management method, apparatus, device and system - Google Patents
Key management method, apparatus, device and system Download PDFInfo
- Publication number
- WO2018014723A1 WO2018014723A1 PCT/CN2017/091646 CN2017091646W WO2018014723A1 WO 2018014723 A1 WO2018014723 A1 WO 2018014723A1 CN 2017091646 W CN2017091646 W CN 2017091646W WO 2018014723 A1 WO2018014723 A1 WO 2018014723A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- key
- session
- server
- client
- ciphertext
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Ceased
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/08—Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/08—Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
- H04L9/0816—Key establishment, i.e. cryptographic processes or cryptographic protocols whereby a shared secret becomes available to two or more parties, for subsequent use
- H04L9/0819—Key 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)
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/08—Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
- H04L9/0816—Key establishment, i.e. cryptographic processes or cryptographic protocols whereby a shared secret becomes available to two or more parties, for subsequent use
- H04L9/0819—Key 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/0822—Key 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 key encryption key
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/08—Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
- H04L9/0816—Key establishment, i.e. cryptographic processes or cryptographic protocols whereby a shared secret becomes available to two or more parties, for subsequent use
- H04L9/0819—Key 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/0825—Key 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
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/08—Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
- H04L9/0861—Generation of secret information including derivation or calculation of cryptographic keys or passwords
- H04L9/0863—Generation of secret information including derivation or calculation of cryptographic keys or passwords involving passwords or one-time passwords
Definitions
- the embodiments of the present invention relate to the field of information security technologies, and in particular, to a key management method, apparatus, device, and system.
- data encryption methods include Symmetric Cryptography and Asymmetric Cryptography.
- Symmetric encryption is a fast and simple way to encrypt.
- the same key (secret key) is used for encryption and decryption.
- Symmetric encryption usually uses a relatively small key, typically less than 256 bits (bits). Because the larger the key, the stronger the encryption, but the slower the process of encryption and decryption. The size of the key needs to be balanced against security and efficiency.
- AES Advanced Encryption Standard
- Symmetric encryption method uses the same key for encryption and decryption. Therefore, the advantage is that the encryption and decryption speed is fast, but the disadvantage is that the communication parties need to agree on the key in advance. If the key is transmitted through the network, the security cannot be guaranteed. .
- Asymmetric encryption provides a very secure method for encrypting and decrypting data using a pair of keys, a public key and a private key.
- the private key can only be safely kept by one party and cannot be leaked, and the public key can be sent to any demander.
- Asymmetric encryption is usually encrypted using public key and decrypted using a private key. Unlike the symmetric encryption method, security is improved because the private key is not transmitted over the network.
- the commonly used asymmetric encryption algorithm is RSA (Rivest Shamir Adleman, a public key encryption algorithm) algorithm.
- RSA Ramir Adleman
- the advantage of asymmetric encryption is that it is highly secure, but its disadvantage is that encryption and decryption are slow. With a 1024-bit key, the estimated decryption speed is 1000-1400. Times/second, depending on the hardware.
- the data to be transmitted is encrypted and decrypted by symmetric encryption, but the key used in the symmetric encryption mode is transmitted by asymmetric encryption, which ensures that the key used in the symmetric encryption mode is not directly exposed to the network. On top, it ensures the efficiency of encryption and decryption.
- the communication party first generates a random number as a symmetric key, encrypts the symmetric key by using the public key provided by the communication peer, and sends the encrypted symmetric key to the communication peer;
- the communication peer decrypts the encrypted symmetric key by using the private key corresponding to the above public key to obtain a symmetric key.
- the communication party and the communication peer use the symmetric key to encrypt and decrypt the data transmitted between the two.
- the number of clients can reach 10 million or even hundreds of millions of days.
- the number of sessions between the client and the server is quite large. This causes the server to consume a lot of resources to manage symmetric keys.
- the embodiment of the present invention provides a key management method, device, device and system.
- the technical solution is as follows:
- a key management method comprising:
- the authentication response carries a second ciphertext
- the second ciphertext is a ciphertext obtained by encrypting the session key by using the temporary key
- the session The key is used to encrypt data of the session
- a key management method comprising:
- the authentication request carries the first ciphertext
- the first ciphertext is a ciphertext obtained by encrypting the temporary key by using the public key provided by the local end
- a key management apparatus comprising:
- a key generation module configured to generate a temporary key
- a first encryption module configured to encrypt the temporary key by using a public key provided by a server to obtain a first ciphertext
- a request sending module configured to send an authentication request to the server, where the first ciphertext is carried in the authentication request
- the response receiving module is configured to receive an authentication response sent by the server, where the authentication response carries a second ciphertext, and the second ciphertext is a ciphertext obtained by encrypting the session key by using the temporary key.
- the session key is used to encrypt data of the session;
- the first decryption module is configured to decrypt the second ciphertext by using the temporary key to obtain the session key.
- a key management apparatus comprising:
- the request receiving module is configured to receive an authentication request sent by the client, where the authentication request carries a first ciphertext, and the first ciphertext is a ciphertext obtained by encrypting the temporary key by using a public key provided by the local end. ;
- a second decrypting module configured to decrypt the first ciphertext by using a private key corresponding to the public key, to obtain the temporary key
- a second encryption module configured to encrypt the session key by using the temporary key to obtain a second ciphertext; wherein the session key is used to encrypt data of the session;
- the response sending module is configured to send an authentication response to the client, where the second ciphertext is carried in the authentication response.
- a key management system comprising: a client and a server;
- the client includes the key management device as described in the third aspect
- the server includes the key management device as described in the fourth aspect.
- a terminal including a processor and a memory, where the memory stores at least one instruction, at least one program, a code set or a set of instructions, the at least one instruction, the at least one program
- the code set or instruction set is loaded and executed by the processor to implement the key management method as described in the first aspect.
- a server comprising a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or a set of instructions, the at least one instruction, the at least one program
- the code set or instruction set is loaded and executed by the processor to implement the key management method as described in the second aspect.
- a computer readable storage medium stores at least one instruction, at least one program, a code set, or a set of instructions, the at least one instruction, the at least one program, and the code
- the set or set of instructions is loaded and executed by the processor to implement the key management method as described in the first aspect.
- a computer readable storage medium stores at least one instruction, at least one program, a code set or a set of instructions, the at least one instruction, the at least one program
- the code set or instruction set is loaded and executed by a processor to implement the key management method as described in the second aspect.
- a computer program product for performing the key management method of the first aspect described above when the computer program product is executed.
- a computer program product for performing the key management method of the second aspect described above when the computer program product is executed.
- the temporary encryption key is encrypted by the client and then sent to the server.
- the server decrypts the temporary key
- the temporary key is used to encrypt the session key to obtain the second ciphertext
- the second ciphertext is sent to the server.
- the client decrypts the second ciphertext by using the temporary key to obtain the session key, so that the client encrypts and decrypts the session data by using the session key when the client performs a session with the server. Because the number of sessions between the client and the server is quite large, the server needs to spend a lot of resources to manage the problem of the symmetric key; compared with the related technology, the symmetric data generated by the client directly uses the symmetric key generated by the client to encrypt and decrypt the session data.
- the embodiment of the present invention uses the session key provided by the server to encrypt and decrypt the session data, so that the server only needs to manage the session key, and does not need to manage the keys generated by a large number of clients, thereby simplifying the server confidentiality.
- the complexity of the key management and helps save server resources.
- the session key is not directly transmitted in the plaintext on the network, it is encrypted by using a temporary key, so security is also guaranteed.
- the technical solution provided by the embodiment of the invention simplifies the complexity of managing the key by the server on the premise of balancing the security of the key and the efficiency of the encryption and decryption, and saves the processing and storage resources of the server. Therefore, the key management solution provided by the embodiment of the present invention can be well applied to a large number of high-concurrency service scenarios, such as a C/S architecture business scenario, even if the number of daily activities of the client reaches tens of millions or even hundreds of millions of levels. Even if the number of sessions between the client and the server is quite large, the server can easily and efficiently manage the keys needed for encryption and ensure the security of data transmission between the client and the server. Sex and encryption efficiency.
- FIG. 1 is a schematic diagram of an implementation environment provided by an embodiment of the present invention.
- FIG. 2 is a schematic diagram of an implementation environment provided by another embodiment of the present invention.
- FIG. 3 is a flowchart of a key management method according to an embodiment of the present invention.
- FIG. 4 is a flowchart of a key management method according to another embodiment of the present invention.
- FIG. 5 is a flowchart of an authentication phase according to an embodiment of the present invention.
- FIG. 6 is a flow chart of a data communication phase according to an embodiment of the present invention.
- FIG. 7 is a block diagram of a key management apparatus according to an embodiment of the present invention.
- FIG. 8 is a block diagram of a key management apparatus according to another embodiment of the present invention.
- FIG. 9 is a block diagram of a key management system according to an embodiment of the present invention.
- FIG. 10 is a schematic structural diagram of a terminal according to an embodiment of the present invention.
- FIG. 11 is a schematic structural diagram of a server according to an embodiment of the present invention.
- FIG. 1 shows a schematic diagram of an implementation environment provided by an embodiment of the present invention.
- a service scenario of a C/S architecture includes at least one terminal 11 and a server 12.
- a running client can be installed in the terminal 11.
- the type of the client is not limited.
- the client may be an instant messaging client, a social application client, a payment application client, a video playing client, and the like.
- the terminal 11 may be an electronic device such as a mobile phone, a tablet computer, an e-book reader, a multimedia playback device, a laptop portable computer, or a desktop computer.
- a communication connection can be established between the terminal 11 and the server 12 via a wired network or a wireless network.
- the server 12 can be a server or a server cluster composed of multiple servers. Or a cloud computing service center.
- the server 12 is configured to provide a background service for the client to implement various functions of the client.
- the server 12 is a server cluster composed of a plurality of servers. As shown in FIG. 2, the server 12 includes: an access server 121, a service server 122, an authentication center server 123, and a key management server 124. .
- the access server 121 is a medium for data transfer and distribution between the client and the service server 122 and the authentication center server 123.
- the access server 121 establishes a communication connection with the service server 122, the authentication center server 123, and the key management server 124 via the network, respectively.
- the service server 122 is configured to provide business services to clients.
- the types of services provided by the service server 122 are not limited, such as instant messaging services, social services, payment services, video services, and the like.
- the authentication center server 123 is configured to provide an authentication service to the client, and provide the client with a key required for encryption.
- the authentication center server 123 establishes a communication connection with the key management server 124 via the network.
- the key management server 124 is used to manage keys.
- the authentication center server 123 and the key management server 124 may be two mutually independent servers, or the authentication center server 123 and the key management server 124 may be integrated into one server.
- the technical solution provided by the embodiment of the present invention can be applied to any service scenario that needs to encrypt data transmitted between two ends of a communication.
- the service scenario of the C/S architecture is taken as an example for illustration.
- the embodiments of the present invention do not limit the devices at both ends of the communication.
- the devices at both ends of the communication may be a terminal and a server running a client, a terminal and a base station, or a server and a server, and the like.
- FIG. 3 shows a flowchart of a key management method provided by an embodiment of the present invention. This method can be applied to the implementation environment shown in FIG. The method can include the following steps.
- step 301 the client generates a temporary key.
- Step 302 The client encrypts the temporary key by using a public key provided by the server to obtain a first ciphertext.
- Step 303 The client sends an authentication request to the server, where the first ciphertext is carried in the authentication request.
- the server receives an authentication request sent by the client.
- Step 304 The server decrypts the first ciphertext by using a private key corresponding to the public key to obtain a temporary key.
- Step 305 The server encrypts the session key by using a temporary key to obtain a second ciphertext; wherein the session key is used to encrypt data of the session.
- Step 306 The server sends an authentication response to the client, where the authentication response carries the second ciphertext.
- the client receives an authentication response sent by the server.
- the authentication response further carries a key identifier, where the key identifier is used to identify the session key.
- the key identifier carried in the authentication response is not encrypted by using a temporary key; in another possible implementation manner, the key identifier carried in the authentication response also uses a temporary key. encryption. In the case where there are multiple session keys managed in the server, different session keys can be distinguished by using the key identifier.
- Step 307 The client decrypts the second ciphertext by using a temporary key to obtain a session key.
- the client directly reads the key identifier from the authentication response; if the authentication response further carries the encrypted key identifier, the client The encrypted key identifier is decrypted by using a temporary key to obtain a key identifier.
- the method provided in this embodiment encrypts the temporary key by using the asymmetric encryption method and sends the temporary key to the server. After the server decrypts the temporary key, the temporary key is used to encrypt the session key. The second ciphertext is sent to the client, and the client decrypts the second ciphertext by using the temporary key to obtain the session key, so that the client subsequently uses the session key pair when performing a session with the server.
- the data of the session is encrypted and decrypted; the problem that the server needs to consume a large amount of resources to manage the symmetric key due to the relatively large number of sessions between the client and the server in the related art is solved; compared with the related technology, the client directly adopts The generated symmetric key encrypts and decrypts the data of the session.
- the session key provided by the server is used to encrypt and decrypt the session data, so that the server only needs to manage the session key, and does not need to generate a large number of clients. Key management, which simplifies the complexity of server management of keys and helps save service resource of.
- the session key is not directly transmitted in the plaintext on the network, it is encrypted by using a temporary key, so security is also guaranteed.
- the technical solution provided by the embodiment of the invention simplifies the complexity of managing the key by the server on the premise of balancing the security of the key and the efficiency of the encryption and decryption, and saves the processing and storage resources of the server. Therefore, the key management solution provided by the embodiment of the present invention can be well applied to a large number of high-concurrency service scenarios, such as a C/S architecture business scenario, even if the number of daily activities of the client reaches tens of millions or even hundreds of millions of levels. Even if the number of sessions between the client and the server is quite large, the server can easily and efficiently manage the keys needed for encryption and ensure the security and encryption and decryption efficiency of data transmission between the client and the server.
- a session refers to a communication interaction between two devices during a specific operation time that is not interrupted. During a session, all packets transmitted between two devices belong to the session.
- the session may be a “call process” between the client and the server, and a complete request and reply process.
- FIG. 4 is a flowchart of a key management method according to another embodiment of the present invention. This method can be applied to the implementation environment shown in FIG. The method can include the following steps.
- step 401 the client generates a temporary key.
- a temporary key is generated using a random number generator.
- the temporary key is a symmetric key.
- the temporary key is not used to encrypt and decrypt the data of the session, and the temporary key is only used to encrypt and decrypt the session key, and the session key is actually used.
- the key used to encrypt and decrypt the data of the session is not used to encrypt and decrypt the data of the session.
- Step 402 The client encrypts the temporary key by using a public key provided by the server to obtain a first ciphertext.
- the public key is pre-delivered to the client by the server.
- the server writes the public key to a binary file that carries the digital signature of the development company corresponding to the client, and the server sends the binary file with the digital signature to the client to ensure that the file is not It has been tampered with and forged to ensure the safe issuance of public keys.
- the public key may be updated with the update of the binary file, and after the server enables the new public key, the binary file with the new public key may be resent to the client.
- the temporary key is encrypted by using the public key provided by the server according to the asymmetric encryption method to obtain the first ciphertext.
- Step 403 The client sends an authentication request to the server, where the first ciphertext is carried in the authentication request.
- the authentication request is used to request the server to authenticate the client, and allocate the key required for encrypting the session data to the client if the authentication is passed.
- the server receives an authentication request sent by the client.
- the temporary key is encrypted by using the public key provided by the server, even if the authentication request is intercepted by the malicious user, since the private key corresponding to the public key is not available, the first ciphertext cannot be decrypted. A temporary key is issued. Therefore, the security of the temporary key can be guaranteed, so that the security of the session key transmitted later can also be guaranteed.
- Step 404 The server decrypts the first ciphertext by using a private key corresponding to the public key to obtain a temporary key.
- the server After receiving the authentication request, the server adopts the private key corresponding to the public key according to the asymmetric encryption method.
- the key decrypts the first ciphertext to obtain a temporary key.
- step 405 the server acquires a session key and a key identifier.
- the key identifier is used to identify the session key, and the session key is used to encrypt the data of the session.
- the session key is a symmetric key.
- the session key is a contiguous stream of bytes, typically an integer multiple of 128 bits, generated by a random number generator.
- the key identifier is used to uniquely identify the session key. Different sessions can use the same key identifier. Different key identifiers correspond to different session keys.
- the key identifier is a 64-bit integer.
- the server generates a session key using a random number generator and generates a key identification corresponding to the session key.
- the server corresponds to the storage session key and the key identifier.
- the server picks a set of corresponding session keys and key identities from the pre-stored keys.
- the pre-stored key includes at least one set of corresponding session key and key identifier.
- the pre-stored key is pre-generated and stored by the server.
- the pre-stored key can be stored in the server's Cache (cache) or it can be stored in a target file. In one example, the pre-stored key is stored both in the Cache and backed up in the target file to facilitate backup in the event of a Cache failure.
- each session key has a corresponding validity period, and the session key is valid within the validity period, otherwise the session key is invalid.
- the validity period of the session key can be set correspondingly when the session key is generated.
- the duration of the validity period is usually the same, but it may be different. This embodiment does not limit this.
- the validity time of the validity period of the session key is not limited.
- the validity period of the session key may be effective when the session key is generated, or when the server sends the session key to the client. Effective at the beginning, or when the client receives the session key.
- the client encrypts and decrypts the session data using the session key of the valid state (that is, the expiration date is not exceeded). After the session key is invalidated (that is, the validity period is exceeded), the client can request a new valid session key from the server. . Therefore, the execution timing of the above step 403 may be when the existing session key has expired, or when the client needs to initiate a session to the server and the existing session key has expired. If the existing session key has not expired, the client can use the existing session key to encrypt and decrypt the session data without re-requesting the new session key from the server.
- the server selects a corresponding set of session keys and key identifiers from the pre-stored keys, and may include the following sub-steps:
- the server obtains an IP (Internet Protocol) address corresponding to the client;
- the server parses the data packet of the authentication request sent by the client, and parses and obtains the IP address corresponding to the client from the packet header.
- the server determines a key selection range according to the IP address, and the key selection range includes a corresponding session key and a key identifier of the pre-stored key;
- the server may segment the pre-stored key, and the server divides the pre-stored key into multiple segments, each segment including a part of the corresponding session key and key identifier. For example, the server calculates a hash value of the IP address corresponding to the client, and maps the data to a certain pre-stored key according to the hash value, where the pre-stored key is the key selection range. For another example, the server may also randomly select a pre-stored key from the pre-stored key after segmentation, and the selected pre-stored key of the segment is the key selection range.
- the server selects a corresponding set of session keys and key identifiers from the key selection range.
- Step 406 The server encrypts the session key by using a temporary key to obtain a second ciphertext.
- the server encrypts the session key by using a temporary key according to a symmetric encryption method to obtain a second ciphertext.
- the server further encrypts the key identifier by using a temporary key, and obtains the encrypted key identifier.
- Step 407 The server sends an authentication response to the client, where the authentication response carries the second ciphertext and the key identifier.
- the client receives an authentication response sent by the server.
- the key identifier carried in the authentication response may be an unencrypted key identifier or an encrypted key identifier.
- the server may further perform the following steps: the server obtains a GUID (Globally Unique Identifier) corresponding to the device where the client is located, and obtains an authentication request corresponding to the GUID. The number of times; determining whether the number of authentication requests is greater than a preset threshold; if the number of authentication requests is greater than a preset threshold, refusing to respond to the authentication request; if the number of authentication requests is less than a preset threshold, responding to the authentication request, for example, performing The above steps 404 to 407.
- the GUID corresponding to the device where the client is located can be parsed and obtained from the packet header of the data packet of the authentication request. In the above manner, the number of authentication requests of the same GUID is limited, and the server can be effectively prevented when the server is subjected to frequent malicious attacks.
- GUID Globally Unique Identifier
- Step 408 The client decrypts the second ciphertext by using a temporary key to obtain a session key.
- the client After receiving the authentication response, the client decrypts the second ciphertext by using the temporary key according to the symmetric encryption method to obtain the session key. After that, the client uses the session key to symmetrically encrypt the communication content with the server. During the subsequent session between the client and the server, the client encrypts and decrypts the data of the session transmitted between the server by using the session key, and the server uses the session key to add the data of the session transmitted between the client and the client. Decrypt.
- the client directly reads the key identifier from the authentication response; if the authentication response further carries the encrypted key identifier, the client The encrypted key identifier is decrypted by using a temporary key to obtain a key identifier.
- Steps 409 to 411 are uplink transmission procedures
- steps 412 to 414 are downlink transmission procedures.
- Step 409 The client encrypts the uplink data of the session by using the session key, and obtains the encrypted uplink data.
- the uplink data refers to the data transmitted by the client to the server.
- step 410 the client sends an uplink data packet to the server.
- the packet header of the uplink data packet carries the key identifier
- the packet body of the uplink data packet carries the encrypted uplink data.
- the packet identifier of the uplink data packet does not carry the key identifier.
- the server receives the uplink data packet sent by the client.
- step 411 the server decrypts the encrypted uplink data by using the session key corresponding to the key identifier carried in the packet header to obtain uplink data.
- the server After receiving the uplink data packet, the server queries the pre-stored key to obtain the session key corresponding to the key identifier carried in the packet header of the uplink data packet, and then encrypts the session key pair according to the symmetric encryption mode. After the uplink data is decrypted, the uplink data is obtained.
- the server may further verify the validity period of the queried session key before performing the decryption operation, and if the expiration date has expired, the process ends, and if the validity period is not exceeded, the decryption operation is performed.
- Step 412 The server encrypts the downlink data of the session by using the session key, and obtains the encrypted downlink data.
- Downstream data refers to the data that the server transmits to the client.
- step 413 the server sends a downlink data packet to the client.
- the packet header of the downlink data packet carries the key identifier, and the packet body of the downlink data packet carries the encrypted downlink number. according to.
- the key identifier of the downlink data packet does not carry the key identifier.
- the client receives the downlink data packet sent by the server.
- Step 414 The client decrypts the encrypted downlink data by using a session key corresponding to the key identifier carried in the packet header to obtain downlink data.
- the client After receiving the downlink data packet, the client obtains the session key corresponding to the key identifier carried in the packet header of the downlink data packet, and then uses the queried session key pair to encrypt the downlink data according to the symmetric encryption mode. Decrypt, get the downlink data.
- the server can also obtain an initialization vector (Init Vector, IV) corresponding to the session key, and send the initialization vector to the client.
- This initialization vector is used by the client for symmetric encryption and decryption using the session key.
- the client receives an initialization vector sent by the server.
- the authentication response sent by the server to the client also carries an initialization vector.
- the initialization vector may be sent by using a temporary key or may not be encrypted. This embodiment does not limit this.
- the initialization vector can be generated by the server using a random number generator to generate a random number, and combined with the random number and the session key.
- the initialization vector can be dynamically changed according to the relevant algorithm.
- the initialization vector is a 12 byte byte stream. In the above manner, the same session key must be used together with the corresponding initialization vector to complete the decryption, so as to achieve further optimization and reinforcement.
- the method provided in this embodiment encrypts the temporary key by using the asymmetric encryption method and sends the temporary key to the server. After the server decrypts the temporary key, the temporary key is used to encrypt the session key. The second ciphertext is sent to the client, and the client decrypts the second ciphertext by using the temporary key to obtain the session key, so that the client subsequently uses the session key pair when performing a session with the server.
- the data of the session is encrypted and decrypted; the problem that the server needs to consume a large amount of resources to manage the symmetric key due to the relatively large number of sessions between the client and the server in the related art is solved; compared with the related technology, the client directly adopts The generated symmetric key encrypts and decrypts the data of the session.
- the session key provided by the server is used to encrypt and decrypt the session data, so that the server only needs to manage the session key, and does not need to generate a large number of clients. Key management, which simplifies the complexity of server management of keys and helps save service resource of.
- the session key is not directly transmitted in the plaintext on the network, it is encrypted by using a temporary key, so security is also guaranteed.
- the client can use the session key to encrypt and decrypt the session data, A new session key needs to be re-requested from the server to save processing overhead and communication resources of the device and server where the client is located.
- code adjustment is performed on the rsa function api of the OpenSLL library, so as to implement the step of separating the multi-thread unsafe, and placing it in a safe place, and the remaining security steps can be located in the multi-thread environment.
- code adjustment is performed on the rsa function api of the OpenSLL library, so as to implement the step of separating the multi-thread unsafe, and placing it in a safe place, and the remaining security steps can be located in the multi-thread environment.
- the step on the client side can be separately implemented as a key management method on the client side
- the steps on the server side can be separately implemented as a key management method on the server side.
- FIG. 5 shows a flow chart of the authentication phase. As shown in FIG. 5, the authentication phase may include the following steps.
- step 501 the client generates a temporary key.
- Step 502 The client encrypts the temporary key by using the public key provided by the authentication center server to obtain the first key.
- Step 503 The client sends an authentication request to the access server, where the first ciphertext is carried in the authentication request.
- the access server receives an authentication request sent by the client.
- Step 504 The access server forwards the authentication request to the authentication center server.
- the authentication center server receives the authentication request sent by the access server.
- Step 505 The authentication center server decrypts the first ciphertext by using a private key corresponding to the public key to obtain a temporary key.
- Step 506 The authentication center server acquires a session key and a key identifier.
- the key identifier is used to identify the session key, and the session key is used to encrypt the data of the session.
- step 506 includes the following sub-steps:
- Step 506a The authentication center server generates a session key by using a random number generator.
- Step 506b The authentication center server sends a session key to the key management server.
- the key management server receives the session key sent by the authentication center server
- Step 506c The key management server generates a key identifier corresponding to the session key.
- Step 506d the key management server correspondingly stores the key identifier and the session key
- Step 506e The key management server sends a key identifier to the authentication center server.
- the authentication center server receives the key identifier sent by the key management server.
- step 506 includes the following sub-steps:
- step 506f the authentication center server selects a corresponding set of session keys and key identifiers from the pre-stored keys.
- the pre-stored key includes at least one set of corresponding session key and key identifier.
- the pre-stored key can be pre-generated by the key management server and provided to the authentication center server. For example, the key management server writes the pre-stored key into the target file and sends the target file to the authentication center server. After the authentication center server is started, the pre-stored key in the target file is loaded into the memory, and a corresponding set of session key and key identifier are randomly selected from each time.
- step 507 the authentication center server encrypts the session key by using a temporary key to obtain a second ciphertext.
- Step 508 The authentication center server sends an authentication response to the access server, where the authentication response carries the second ciphertext and the key identifier.
- the access server receives the authentication response sent by the authentication center server.
- the key identifier carried in the authentication response may be an unencrypted key identifier or an encrypted key identifier.
- step 509 the access server forwards the authentication response to the client.
- the client receives an authentication response sent by the access server.
- Step 510 The client decrypts the second ciphertext by using a temporary key to obtain a session key.
- Figure 6 shows a flow chart of the data communication phase. As shown in FIG. 6, the data communication phase can include the following steps.
- Step 601 The client encrypts the uplink data of the session by using the session key, and obtains the encrypted uplink data.
- Step 602 The client sends an uplink data packet to the access server.
- the packet header of the uplink data packet carries the key identifier, and the packet body of the uplink data packet carries the encrypted uplink number. according to.
- the access server receives the uplink data packet sent by the client.
- Step 603 The access server queries to obtain a session key corresponding to the key identifier carried in the packet header.
- step 603 includes the following sub-steps:
- Step 603a The access server queries, from the local cache, the session key corresponding to the key identifier carried in the packet header.
- the access server obtains a preset key from the key management server in advance and stores it in the local cache.
- step 603 includes the following sub-steps:
- Step 603b The access server sends a query request to the key management server, where the query request carries the key identifier carried in the packet header.
- the key management server receives the query request sent by the access server
- Step 603c The key management server queries, by using a preset key, a session key corresponding to the key identifier carried in the query request.
- Step 603d The key management server sends a query response to the access server, where the query response carries the session key obtained by the query;
- the access server receives the query response sent by the key management server.
- Step 604 The access server decrypts the encrypted uplink data by using the session key obtained by the query to obtain uplink data.
- Step 605 The access server sends uplink data to the service server.
- the service server receives the uplink data sent by the access server.
- the access server sends the clear text of the uplink data to the service server.
- the access server encrypts the uplink data and sends it to the service server by using an encryption method and a key that are negotiated in advance with the service server.
- the service server After receiving the uplink data, the service server processes the uplink data and feeds back the packet to the client if necessary.
- Step 606 The service server sends downlink data to the access server.
- the access server receives downlink data sent by the service server.
- the service server sends the clear text of the downlink data to the access server.
- the service server adopts an encryption method and a key that are pre-negotiated with the access server, and the number of downlinks is used. After being encrypted, it is sent to the access server.
- Step 607 The access server encrypts the downlink data by using the session key obtained by the query, and obtains the encrypted downlink data.
- Step 608 The access server sends a downlink data packet to the client.
- the packet header of the downlink data packet carries the key identifier, and the packet body of the downlink data packet carries the encrypted downlink data.
- the client receives the downlink data packet sent by the access server.
- Step 609 The client decrypts the encrypted downlink data by using a session key corresponding to the key identifier carried in the packet header to obtain downlink data.
- FIG. 7 shows a block diagram of a key management apparatus according to an embodiment of the present invention.
- the device has a function of implementing the above-mentioned client side key management method, and the function may be implemented by hardware or by executing corresponding software by hardware.
- the apparatus may include a key generation module 710, a first encryption module 720, a request transmission module 730, a response receiving module 740, and a first decryption module 750.
- the key generation module 710 is configured to generate a temporary key.
- the first encryption module 720 is configured to encrypt the temporary key by using a public key provided by the server to obtain a first ciphertext.
- the request sending module 730 is configured to send an authentication request to the server, where the first ciphertext is carried in the authentication request.
- the response receiving module 740 is configured to receive an authentication response sent by the server, where the authentication response carries a second ciphertext, and the second ciphertext is a secret obtained by encrypting the session key by using the temporary key. Text.
- the session key is used to encrypt data of the session.
- the first decryption module 750 is configured to decrypt the second ciphertext by using the temporary key to obtain the session key.
- the device provided in this embodiment encrypts the temporary key by using the asymmetric encryption method and sends the temporary ciphertext to the server, and receives the second ciphertext obtained by encrypting the session key by using the temporary key.
- the temporary cipher is used to decrypt the second ciphertext to obtain the session key, so that the client can encrypt and decrypt the session data by using the session key when the client performs a session with the server.
- the related technology is solved by the client and the client.
- the number of sessions between servers is quite large, causing the server to consume A large amount of resources are used to manage the problem of the symmetric key; the session data is encrypted and decrypted by the symmetric key generated by the client, and the session key provided by the server is used for the session.
- the data is encrypted and decrypted, so that the server only needs to manage the session key, and does not need to manage the keys generated by a large number of clients, thereby simplifying the complexity of managing the keys by the server and saving the resources of the server.
- the session key is not directly transmitted in the plaintext on the network, it is encrypted by using a temporary key, so security is also guaranteed.
- FIG. 8 is a block diagram of a key management apparatus according to another embodiment of the present invention.
- the device has a function of implementing the above-mentioned server-side key management method, and the function may be implemented by hardware or by executing corresponding software by hardware.
- the apparatus may include a request receiving module 810, a second decryption module 820, a second encryption module 840, and a response sending module 850.
- the request receiving module 810 is configured to receive an authentication request sent by the client, where the authentication request carries the first ciphertext, and the first ciphertext is a secret obtained by encrypting the temporary key by using the public key provided by the local end. Text.
- the second decryption module 820 is configured to decrypt the first ciphertext by using a private key corresponding to the public key to obtain the temporary key.
- the second encryption module 840 is configured to encrypt the session key by using the temporary key to obtain a second ciphertext; wherein the session key is used to encrypt data of the session.
- the response sending module 850 is configured to send an authentication response to the client, where the second ciphertext is carried in the authentication response.
- the device provided in this embodiment encrypts the temporary key by using the asymmetric encryption method and sends the temporary key to the server. After the server decrypts the temporary key, the temporary key is used to encrypt the session key. Two ciphertexts, and the second ciphertext is sent to the client, so that the client subsequently encrypts and decrypts the session data by using the session key when the client performs a session with the server; the related technology is solved by the client and the server.
- the number of sessions is quite large, which causes the server to use a large amount of resources to manage the problem of the symmetric key.
- the data of the session is encrypted and decrypted by using the symmetric key generated by the client.
- the session key provided by the server encrypts and decrypts the data of the session, so that the server only needs to manage the session key, and does not need to manage the keys generated by a large number of clients, thereby simplifying the complexity of managing the keys by the server. And help save server resources. Moreover, since the session key is not directly transmitted in the plaintext on the network, it is encrypted by using a temporary key, so security is also guaranteed.
- FIG. 9 shows a block diagram of a key management system provided by an embodiment of the present invention.
- the system includes a client 700 and a server 800.
- Client 700 can include a key management device.
- the device has a function of implementing the above-mentioned client side key management method, and the function may be implemented by hardware or by executing corresponding software by hardware.
- the apparatus may include a key generation module 710, a first encryption module 720, a request transmission module 730, a response receiving module 740, and a first decryption module 750.
- the key generation module 710 is configured to generate a temporary key.
- the first encryption module 720 is configured to encrypt the temporary key by using a public key provided by the server 800 to obtain a first ciphertext.
- the request sending module 730 is configured to send an authentication request to the server 800, where the first ciphertext is carried in the authentication request.
- the response receiving module 740 is configured to receive an authentication response sent by the server 800, where the authentication response carries a second ciphertext, where the second ciphertext is encrypted by using the temporary key to encrypt the session key. Cipher text.
- the session key is used to encrypt data of the session.
- the first decryption module 750 is configured to decrypt the second ciphertext by using the temporary key to obtain the session key.
- the authentication response further carries a key identifier, where the key identifier is used to identify the session key.
- the device further includes: an uplink data encryption module 762 and an uplink data sending module 764.
- the uplink data encryption module 762 is configured to encrypt the uplink data of the session by using the session key to obtain encrypted uplink data.
- the uplink data sending module 764 is configured to send an uplink data packet to the server 800, where a packet header of the uplink data packet carries the key identifier, and a packet of the uplink data packet carries the encrypted uplink data.
- the device further includes: a downlink data receiving module 766 and a downlink data decrypting module 768.
- the downlink data receiving module 766 is configured to receive the downlink data packet sent by the server 800, where the packet header of the downlink data packet carries the key identifier, and the packet body of the downlink data packet carries the encrypted downlink data.
- the downlink data decryption module 768 is configured to decrypt the encrypted downlink data by using a session key corresponding to the key identifier carried in the packet header to obtain downlink data.
- the key generation module 710 is configured to generate the temporary key by using a random number generator.
- the device further includes: a vector receiving module 770.
- the vector receiving module 770 is configured to receive an initialization vector that is sent by the server 800 and that is corresponding to the session key, where the initialization vector is used when the local end uses the session key for symmetric encryption and decryption.
- Server 800 can include a key management device.
- the device has a function of implementing the above-mentioned server-side key management method, and the function may be implemented by hardware or by executing corresponding software by hardware.
- the apparatus may include a request receiving module 810, a second decryption module 820, a second encryption module 840, and a response sending module 850.
- the request receiving module 810 is configured to receive an authentication request sent by the client 700, where the authentication request carries the first ciphertext, and the first ciphertext is obtained by encrypting the temporary key by using the public key provided by the local end. Cipher text.
- the second decryption module 820 is configured to decrypt the first ciphertext by using a private key corresponding to the public key to obtain the temporary key.
- the second encryption module 840 is configured to encrypt the session key by using the temporary key to obtain a second ciphertext; wherein the session key is used to encrypt data of the session.
- the response sending module 850 is configured to send an authentication response to the client 700, where the second ciphertext is carried in the authentication response.
- the authentication response further carries a key identifier, where the key identifier is used to identify the session key.
- the device further includes: a key acquisition module 830.
- the key obtaining module 830 is configured to acquire a session key and a key identifier.
- the key obtaining module 830 is configured to generate the session key by using a random number generator to generate a key identifier corresponding to the session key.
- the key obtaining module 830 is configured to select a corresponding set of session keys and key identifiers from the pre-stored keys.
- the pre-stored key includes at least one set of corresponding session key and key identifier.
- the key obtaining module 830 includes: an address obtaining unit, a range determining unit, and Key selection unit.
- An address obtaining unit is configured to obtain an IP address corresponding to the client 700.
- a range determining unit configured to determine a key selection range according to the IP address, where the key selection range includes a part of the session key and a key identifier corresponding to the pre-stored key.
- the key selection unit is configured to select a corresponding set of session keys and key identifiers from the key selection range.
- the device further includes: an uplink data receiving module 862 and an uplink data decrypting module 864.
- the uplink data receiving module 862 is configured to receive the uplink data packet sent by the client 700, where the packet header of the uplink data packet carries the key identifier, and the packet of the uplink data packet carries the encrypted uplink data.
- the uplink data decryption module 864 is configured to decrypt the encrypted uplink data by using a session key corresponding to the key identifier carried in the packet header to obtain uplink data.
- the device further includes: a downlink data encryption module 866 and a downlink data sending module 868.
- the downlink data encryption module 866 is configured to encrypt the downlink data of the session by using the session key to obtain encrypted downlink data.
- the downlink data sending module 868 is configured to send a downlink data packet to the client 700, where a packet header of the downlink data packet carries the key identifier, and a packet of the downlink data packet carries the encrypted downlink data.
- the device further includes: an identifier obtaining module 812 and a number obtaining module 814.
- the identifier obtaining module 812 is configured to obtain a GUID corresponding to the device where the client 700 is located.
- the number obtaining module 814 is configured to acquire the number of authentication requests corresponding to the GUID.
- the second decryption module 820 is further configured to: when the number of the authentication requests is less than a preset threshold, decrypt the first ciphertext by using a private key corresponding to the public key to obtain the temporary key.
- the device further includes: a vector obtaining module 870 and a vector sending module 880.
- the vector acquisition module 870 is configured to acquire an initialization vector corresponding to the session key.
- the vector sending module 880 is configured to send the initialization vector to the client 700, where the initialization vector is used when the client 700 performs symmetric encryption and decryption using the session key.
- the system provided in this embodiment encrypts the temporary key by using the asymmetric encryption method and sends the temporary key to the server. After the server decrypts the temporary key, the temporary key pair is used.
- the session key is encrypted to obtain the second ciphertext, and the second ciphertext is sent to the client, and the client decrypts the second ciphertext by using the temporary key to obtain the session key, so that the client subsequently performs a session with the server.
- the session key is used to encrypt and decrypt the session data; the related art has a problem that the server needs to spend a large amount of resources to manage the symmetric key due to the relatively large number of sessions between the client and the server;
- the technology directly encrypts and decrypts the data of the session by using the symmetric key generated by the client.
- the session key provided by the server is used to encrypt and decrypt the session data, so that the server only needs to manage the session key. There is no need to manage a large number of client-generated keys, which simplifies the complexity of managing keys by the server and helps save server resources.
- the session key is not directly transmitted in the plaintext on the network, it is encrypted by using a temporary key, so security is also guaranteed.
- FIG. 10 is a schematic structural diagram of a terminal according to an embodiment of the present invention.
- the terminal is used to implement the client side key management method provided in the foregoing embodiment. Specifically:
- the terminal 1000 may include an RF (Radio Frequency) circuit 1010, a memory 1020 including one or more computer readable storage media, an input unit 1030, a display unit 1040, a sensor 1050, an audio circuit 1060, and a WiFi (wireless fidelity, wireless).
- the fidelity module 1070 includes a processor 1080 having one or more processing cores, and a power supply 1090 and the like. It will be understood by those skilled in the art that the terminal structure shown in FIG. 10 does not constitute a limitation to the terminal, and may include more or less components than those illustrated, or combine some components, or different component arrangements. among them:
- the RF circuit 1010 can be used for receiving and transmitting signals during and after receiving or transmitting information, in particular, receiving downlink information of the base station and then processing it by one or more processors 1080; in addition, transmitting data related to the uplink to the base station .
- the RF circuit 1010 includes, but is not limited to, an antenna, at least one amplifier, a tuner, one or more oscillators, a Subscriber Identity Module (SIM) card, a transceiver, a coupler, an LNA (Low Noise Amplifier). , duplexer, etc.
- SIM Subscriber Identity Module
- the RF circuit 1010 can also communicate with the network and other devices via wireless communication.
- the wireless communication may use any communication standard or protocol, including but not limited to GSM (Global System of Mobile communication), GPRS (General Packet Radio Service), CDMA (Code Division Multiple Access). , Code Division Multiple Access), WCDMA (Wideband Code Division Multiple Access), LTE (Long Term Evolution), e-mail, SMS (Short Messaging Service), and the like.
- GSM Global System of Mobile communication
- GPRS General Packet Radio Service
- CDMA Code Division Multiple Access
- WCDMA Wideband Code Division Multiple Access
- LTE Long Term Evolution
- e-mail Short Messaging Service
- the memory 1020 can be used to store software programs and modules, and the processor 1080 executes various functional applications and data processing by running software programs and modules stored in the memory 1020.
- the memory 1020 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application required for at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may be stored according to The data created by the use of the terminal 1000 (such as audio data, phone book, etc.) and the like.
- memory 1020 can include high speed random access memory, and can also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device. Accordingly, memory 1020 can also include a memory controller to provide access to memory 1020 by processor 1080 and input unit 1030.
- Input unit 1030 can be used to receive input numeric or character information, as well as to generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function controls.
- the input unit 1030 may include an image input device 1031 and other input devices 1032.
- the image input device 1031 may be a camera or an optical scanning device.
- the input unit 1030 may also include other input devices 1032.
- other input devices 1032 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control buttons, switch buttons, etc.), trackballs, mice, joysticks, and the like.
- Display unit 1040 can be used to display information entered by the user or information provided to the user and various graphical user interfaces of terminal 1000, which can be constructed from graphics, text, icons, video, and any combination thereof.
- the display unit 1040 may include a display panel 1041.
- the display panel 1041 may be configured in the form of an LCD (Liquid Crystal Display), an OLED (Organic Light-Emitting Diode), or the like.
- Terminal 1000 can also include at least one type of sensor 1050, such as a light sensor, motion sensor, and other sensors.
- the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor can adjust the brightness of the display panel 1041 according to the brightness of the ambient light, and the proximity sensor
- the display panel 1041 and/or the backlight can be turned off when the terminal 1000 is moved to the ear.
- the gravity acceleration sensor can detect the magnitude of acceleration in all directions (usually three axes). When it is stationary, it can detect the magnitude and direction of gravity.
- the terminal 1000 can also be configured with gyroscopes, barometers, hygrometers, thermometers, infrared sensors and other sensors, not here Let me repeat.
- Audio circuit 1060, speaker 1061, and microphone 1062 can provide an audio interface between the user and terminal 1000.
- the audio circuit 1060 can transmit the converted electrical data of the received audio data to the speaker 1061, and convert it into a sound signal output by the speaker 1061; on the other hand, the microphone 1062 converts the collected sound signal into an electrical signal, by the audio circuit 1060. After receiving, it is converted into audio data, and then processed by the audio data output processor 1080, transmitted to the terminal, for example, via the RF circuit 1010, or outputted to the memory 1020 for further processing.
- the audio circuit 1060 may also include an earbud jack to provide communication of the peripheral earphones with the terminal 1000.
- WiFi is a short-range wireless transmission technology
- the terminal 1000 can help users to send and receive emails, browse web pages, and access streaming media through the WiFi module 1070, which provides wireless broadband Internet access for users.
- FIG. 10 shows the WiFi module 1070, it can be understood that it does not belong to the essential configuration of the terminal 1000, and may be omitted as needed within the scope of not changing the essence of the invention.
- the processor 1080 is the control center of the terminal 1000, connecting various portions of the entire handset with various interfaces and lines, by running or executing software programs and/or modules stored in the memory 1020, and recalling data stored in the memory 1020, The various functions and processing data of the terminal 1000 are performed to perform overall monitoring of the mobile phone.
- the processor 1080 may include one or more processing cores; preferably, the processor 1080 may integrate an application processor and a modem processor, where the application processor mainly processes an operating system, a user interface, an application, and the like.
- the modem processor primarily handles wireless communications. It will be appreciated that the above described modem processor may also not be integrated into the processor 1080.
- the terminal 1000 also includes a power source 1090 (such as a battery) for powering various components.
- the power source can be logically coupled to the processor 1080 through a power management system to manage functions such as charging, discharging, and power management through the power management system.
- the power supply 1090 may also include any one or more of a DC or AC power source, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and the like.
- the terminal 1000 may further include a Bluetooth module or the like, and details are not described herein again.
- the terminal 1000 further includes a memory. Storing at least one instruction, at least one program, code set or instruction set in the memory, the at least one instruction, the at least one program, the code set or the instruction set being loaded and executed by the processor to implement the above Client-side key management method.
- FIG. 11 is a schematic structural diagram of a server according to an embodiment of the present invention.
- This server is used to implement the server-side key management method provided in the above embodiment. Specifically:
- the server 1100 includes a central processing unit (CPU) 1101, a system memory 1104 including a random access memory (RAM) 1102 and a read only memory (ROM) 1103, and a system bus 1105 that connects the system memory 1104 and the central processing unit 1101.
- the server 1100 also includes a basic input/output system (I/O system) 1106 that facilitates transfer of information between various devices within the computer, and mass storage for storing the operating system 1113, applications 1114, and other program modules 1115.
- I/O system basic input/output system
- the basic input/output system 1106 includes a display 1108 for displaying information and an input device 1109 such as a mouse or keyboard for user input of information.
- the display 1108 and the input device 1109 are both connected to the central processing unit 1101 via an input-output controller 1110 connected to the system bus 1105.
- the basic input/output system 1106 can also include an input output controller 1110 for receiving and processing input from a plurality of other devices, such as a keyboard, mouse, or electronic stylus.
- the input and output controller 1110 also provides output to a display screen, printer, or other type of output device.
- the mass storage device 1107 is connected to the central processing unit 1101 by a mass storage controller (not shown) connected to the system bus 1105.
- the mass storage device 1107 and its associated computer readable medium provide non-volatile storage for the server 1100. That is, the mass storage device 1107 can include a computer readable medium (not shown) such as a hard disk or a CD-ROM drive.
- the computer readable medium can include computer storage media and communication media.
- Computer storage media includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data.
- Computer storage media include RAM, ROM, EPROM, EEPROM, flash memory or other solid state storage technologies, CD-ROM, DVD or other optical storage, tape cartridges, magnetic tape, magnetic disk storage or other magnetic storage devices.
- RAM random access memory
- ROM read only memory
- EPROM Erasable programmable read-only memory
- EEPROM electrically erasable programmable read-only memory
- the server 1100 may also be operated by a remote computer connected to the network through a network such as the Internet. That is, the server 1100 can be connected to the network 1112 through the network interface unit 1111 connected to the system bus 1105, or can also be connected to other types of networks or remote computer systems (not shown) using the network interface unit 1111. .
- a computer readable storage medium having stored therein at least one instruction, at least one program, a code set or a set of instructions, the at least one instruction, the at least one program
- the code set or instruction set is loaded and executed by the processor of the terminal to implement the steps of the terminal side in the above method embodiment.
- a computer readable storage medium having stored therein at least one instruction, at least one program, a code set or a set of instructions, the at least one instruction, the at least one program
- the code set or instruction set is loaded and executed by a processor of the server to implement the various steps of the server side in the above method embodiment.
- the computer readable storage medium described above may be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device.
- a computer program product for performing the functions of the various steps of the terminal side in the above method embodiments when the computer program product is executed.
- a computer program product for performing the functions of the various steps on the server side of the above method embodiments when the computer program product is executed.
- a plurality as referred to herein means two or more.
- "and/or” describing the association relationship of the associated objects, indicating that there may be three relationships, for example, A and/or B, which may indicate that there are three cases where A exists separately, A and B exist at the same time, and B exists separately.
- the character "/" generally indicates that the contextual object is an "or" relationship.
Landscapes
- Engineering & Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer And Data Communications (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
Description
本申请要求于2016年07月20日提交中国专利局、申请号为201610579122.X、发明名称为“密钥管理方法、装置及系统”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。The present application claims priority to Chinese Patent Application No. 201610579122.X, entitled "Key Management Method, Apparatus and System", filed on July 20, 2016, the entire contents of which are incorporated by reference. In this application.
本发明实施例涉及信息安全技术领域,特别涉及一种密钥管理方法、装置、设备及系统。The embodiments of the present invention relate to the field of information security technologies, and in particular, to a key management method, apparatus, device, and system.
目前,数据的加密方式包括对称加密(Symmetric Cryptography)和非对称加密(Asymmetric Cryptography)两类。Currently, data encryption methods include Symmetric Cryptography and Asymmetric Cryptography.
对称加密方式是一种快速、简单的加密方式,加密(encryption)与解密(decryption)用的是同样的密钥(secret key)。对称加密方式通常使用相对较小的密钥,一般小于256bit(比特)。因为密钥越大,加密越强,但加密与解密的过程越慢。密钥的大小需要权衡安全性和效率。典型地,AES(Advanced Encryption Standard,高级加密标准)采用的是对称加密方式,在密码学中又称Rijndael加密法。以256Byte(字节)明文来说,估计速度在90万次/秒。对称加密方式由于加密与解密使用的是同样的密钥,因此其优势是加解密的速度快,但其劣势是通讯双方需要提前约定密钥,如果密钥通过网络来传输,则安全性不能保证。Symmetric encryption is a fast and simple way to encrypt. The same key (secret key) is used for encryption and decryption. Symmetric encryption usually uses a relatively small key, typically less than 256 bits (bits). Because the larger the key, the stronger the encryption, but the slower the process of encryption and decryption. The size of the key needs to be balanced against security and efficiency. Typically, AES (Advanced Encryption Standard) uses symmetric encryption, also known as Rijndael encryption in cryptography. In 256 Bytes (bytes), the estimated speed is 900,000 times/second. Symmetric encryption method uses the same key for encryption and decryption. Therefore, the advantage is that the encryption and decryption speed is fast, but the disadvantage is that the communication parties need to agree on the key in advance. If the key is transmitted through the network, the security cannot be guaranteed. .
非对称加密方式为数据的加密与解密提供了一种非常安全的方法,其使用一对密钥,公钥(public key)和私钥(private key)。私钥只能由一方安全保管,不能外泄,而公钥则可以发给任何需求方。非对称加密方式通常使用公钥加密,而使用私钥解密。与对称加密方式所不同的是,由于私钥不用在网络上传输,因此安全性得到提高。目前,常用的非对称加密算法是RSA(Rivest Shamir Adleman,一种公钥加密算法)算法。非对称加密方式的优势是安全性高,但其劣势是加解密的速度慢。以1024bit的密钥来说,估计解密速度在1000-1400 次/秒,根据硬件略有不同。Asymmetric encryption provides a very secure method for encrypting and decrypting data using a pair of keys, a public key and a private key. The private key can only be safely kept by one party and cannot be leaked, and the public key can be sent to any demander. Asymmetric encryption is usually encrypted using public key and decrypted using a private key. Unlike the symmetric encryption method, security is improved because the private key is not transmitted over the network. Currently, the commonly used asymmetric encryption algorithm is RSA (Rivest Shamir Adleman, a public key encryption algorithm) algorithm. The advantage of asymmetric encryption is that it is highly secure, but its disadvantage is that encryption and decryption are slow. With a 1024-bit key, the estimated decryption speed is 1000-1400. Times/second, depending on the hardware.
基于此,采用对称加密方式对需要传输的数据进行加密和解密,但对称加密方式所使用的密钥通过非对称加密方式传输,这样既保证了对称加密方式所使用的密钥不直接暴露在网络上,又保证了加解密的高效性。具体来讲,在相关技术中,通讯一方首先生成一个随机数作为对称密钥,采用通讯对端提供的公钥对该对称密钥加密,并将加密后的对称密钥发送给通讯对端;通讯对端采用与上述公钥对应的私钥对加密后的对称密钥解密,得到对称密钥。之后,通讯一方与通讯对端之间采用该对称密钥对两者之间传输的数据进行加解密。Based on this, the data to be transmitted is encrypted and decrypted by symmetric encryption, but the key used in the symmetric encryption mode is transmitted by asymmetric encryption, which ensures that the key used in the symmetric encryption mode is not directly exposed to the network. On top, it ensures the efficiency of encryption and decryption. Specifically, in the related art, the communication party first generates a random number as a symmetric key, encrypts the symmetric key by using the public key provided by the communication peer, and sends the encrypted symmetric key to the communication peer; The communication peer decrypts the encrypted symmetric key by using the private key corresponding to the above public key to obtain a symmetric key. Then, the communication party and the communication peer use the symmetric key to encrypt and decrypt the data transmitted between the two.
考虑到目前一些采用C/S(Client/Server,客户端/服务器)架构的业务场景,客户端的日活数量可达到千万量级甚至上亿量级,客户端与服务器之间的会话数量相当庞大,这就导致服务器需要耗费大量的资源来管理对称密钥。Considering the current business scenarios using the C/S (Client/Server, Client/Server) architecture, the number of clients can reach 10 million or even hundreds of millions of days. The number of sessions between the client and the server is quite large. This causes the server to consume a lot of resources to manage symmetric keys.
发明内容Summary of the invention
为了解决相关技术中服务器需要耗费大量的资源来管理对称密钥的问题,本发明实施例提供了一种密钥管理方法、装置、设备及系统。所述技术方案如下:In order to solve the problem that the server in the related art requires a large amount of resources to manage the symmetric key, the embodiment of the present invention provides a key management method, device, device and system. The technical solution is as follows:
第一方面,提供了一种密钥管理方法,所述方法包括:In a first aspect, a key management method is provided, the method comprising:
生成临时密钥;Generate a temporary key;
采用服务器提供的公钥对所述临时密钥加密,得到第一密文;Encrypting the temporary key by using a public key provided by the server to obtain a first ciphertext;
向所述服务器发送鉴权请求,所述鉴权请求中携带所述第一密文;Sending an authentication request to the server, where the authentication request carries the first ciphertext;
接收所述服务器发送的鉴权响应,所述鉴权响应中携带第二密文,所述第二密文是采用所述临时密钥对会话密钥加密得到的密文;其中,所述会话密钥用于对所述会话的数据加密;Receiving an authentication response sent by the server, where the authentication response carries a second ciphertext, where the second ciphertext is a ciphertext obtained by encrypting the session key by using the temporary key; wherein the session The key is used to encrypt data of the session;
采用所述临时密钥对所述第二密文解密,得到所述会话密钥。Decrypting the second ciphertext by using the temporary key to obtain the session key.
第二方面,提供了一种密钥管理方法,所述方法包括:In a second aspect, a key management method is provided, the method comprising:
接收客户端发送的鉴权请求,所述鉴权请求中携带第一密文,所述第一密文是采用本端提供的公钥对临时密钥加密得到的密文;Receiving an authentication request sent by the client, where the authentication request carries the first ciphertext, and the first ciphertext is a ciphertext obtained by encrypting the temporary key by using the public key provided by the local end;
采用与所述公钥对应的私钥对所述第一密文解密,得到所述临时密钥;Decrypting the first ciphertext by using a private key corresponding to the public key to obtain the temporary key;
采用所述临时密钥对会话密钥加密,得到第二密文;其中,所述会话密钥用于对会话的数据加密;Encrypting the session key by using the temporary key to obtain a second ciphertext; wherein the session key is used to encrypt data of the session;
向所述客户端发送鉴权响应,所述鉴权响应中携带所述第二密文。 Sending an authentication response to the client, where the second ciphertext is carried in the authentication response.
第三方面,提供了一种密钥管理装置,所述装置包括:In a third aspect, a key management apparatus is provided, the apparatus comprising:
密钥生成模块,用于生成临时密钥;a key generation module, configured to generate a temporary key;
第一加密模块,用于采用服务器提供的公钥对所述临时密钥加密,得到第一密文;a first encryption module, configured to encrypt the temporary key by using a public key provided by a server to obtain a first ciphertext;
请求发送模块,用于向所述服务器发送鉴权请求,所述鉴权请求中携带所述第一密文;a request sending module, configured to send an authentication request to the server, where the first ciphertext is carried in the authentication request;
响应接收模块,用于接收所述服务器发送的鉴权响应,所述鉴权响应中携带第二密文,所述第二密文是采用所述临时密钥对会话密钥加密得到的密文;其中,所述会话密钥用于对所述会话的数据加密;The response receiving module is configured to receive an authentication response sent by the server, where the authentication response carries a second ciphertext, and the second ciphertext is a ciphertext obtained by encrypting the session key by using the temporary key. Wherein the session key is used to encrypt data of the session;
第一解密模块,用于采用所述临时密钥对所述第二密文解密,得到所述会话密钥。The first decryption module is configured to decrypt the second ciphertext by using the temporary key to obtain the session key.
第四方面,提供了一种密钥管理装置,所述装置包括:In a fourth aspect, a key management apparatus is provided, the apparatus comprising:
请求接收模块,用于接收客户端发送的鉴权请求,所述鉴权请求中携带第一密文,所述第一密文是采用本端提供的公钥对临时密钥加密得到的密文;The request receiving module is configured to receive an authentication request sent by the client, where the authentication request carries a first ciphertext, and the first ciphertext is a ciphertext obtained by encrypting the temporary key by using a public key provided by the local end. ;
第二解密模块,用于采用与所述公钥对应的私钥对所述第一密文解密,得到所述临时密钥;a second decrypting module, configured to decrypt the first ciphertext by using a private key corresponding to the public key, to obtain the temporary key;
第二加密模块,用于采用所述临时密钥对会话密钥加密,得到第二密文;其中,所述会话密钥用于对会话的数据加密;a second encryption module, configured to encrypt the session key by using the temporary key to obtain a second ciphertext; wherein the session key is used to encrypt data of the session;
响应发送模块,用于向所述客户端发送鉴权响应,所述鉴权响应中携带所述第二密文。The response sending module is configured to send an authentication response to the client, where the second ciphertext is carried in the authentication response.
第五方面,提供了一种密钥管理系统,所述系统包括:客户端和服务器;In a fifth aspect, a key management system is provided, the system comprising: a client and a server;
所述客户端包括如第三方面所述的密钥管理装置;The client includes the key management device as described in the third aspect;
所述服务器包括如第四方面所述的密钥管理装置。The server includes the key management device as described in the fourth aspect.
第六方面,提供了一种终端,所述终端包括处理器和存储器,所述存储器中存储有至少一条指令、至少一段程序、代码集或指令集,所述至少一条指令、所述至少一段程序、所述代码集或指令集由所述处理器加载并执行以实现如第一方面所述的密钥管理方法。According to a sixth aspect, a terminal is provided, where the terminal includes a processor and a memory, where the memory stores at least one instruction, at least one program, a code set or a set of instructions, the at least one instruction, the at least one program The code set or instruction set is loaded and executed by the processor to implement the key management method as described in the first aspect.
第七方面,提供了一种服务器,所述服务器包括处理器和存储器,所述存储器中存储有至少一条指令、至少一段程序、代码集或指令集,所述至少一条指令、所述至少一段程序、所述代码集或指令集由所述处理器加载并执行以实现如第二方面所述的密钥管理方法。 In a seventh aspect, a server is provided, the server comprising a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or a set of instructions, the at least one instruction, the at least one program The code set or instruction set is loaded and executed by the processor to implement the key management method as described in the second aspect.
第八方面,提供了一种计算机可读存储介质,所述存储介质中存储有至少一条指令、至少一段程序、代码集或指令集,所述至少一条指令、所述至少一段程序、所述代码集或指令集由处理器加载并执行以实现如第一方面所述的密钥管理方法。According to an eighth aspect, a computer readable storage medium is provided, where the storage medium stores at least one instruction, at least one program, a code set, or a set of instructions, the at least one instruction, the at least one program, and the code The set or set of instructions is loaded and executed by the processor to implement the key management method as described in the first aspect.
第九方面,提供了一种计算机可读存储介质,其特征在于,所述存储介质中存储有至少一条指令、至少一段程序、代码集或指令集,所述至少一条指令、所述至少一段程序、所述代码集或指令集由处理器加载并执行以实现如第二方面所述的密钥管理方法。According to a ninth aspect, a computer readable storage medium is provided, wherein the storage medium stores at least one instruction, at least one program, a code set or a set of instructions, the at least one instruction, the at least one program The code set or instruction set is loaded and executed by a processor to implement the key management method as described in the second aspect.
第十方面,提供了一种计算机程序产品,当该计算机程序产品被执行时,其用于执行上述第一方面所述的密钥管理方法。According to a tenth aspect, there is provided a computer program product for performing the key management method of the first aspect described above when the computer program product is executed.
第十一方面,提供了一种计算机程序产品,当该计算机程序产品被执行时,其用于执行上述第二方面所述的密钥管理方法。In an eleventh aspect, there is provided a computer program product for performing the key management method of the second aspect described above when the computer program product is executed.
本发明实施例提供的技术方案带来的有益效果包括:The beneficial effects brought by the technical solutions provided by the embodiments of the present invention include:
通过客户端采用非对称加密方式对临时密钥加密后发送给服务器,服务器解密得到临时密钥后,采用该临时密钥对会话密钥加密得到第二密文,并将第二密文发送给客户端,客户端采用临时密钥对第二密文解密,得到会话密钥,以便于客户端后续在与服务器进行会话时,采用会话密钥对会话的数据进行加解密;解决了相关技术中由于客户端与服务器之间的会话数量相当庞大,导致服务器需要耗费大量的资源来管理对称密钥的问题;相较于相关技术直接采用由客户端生成的对称密钥对会话的数据进行加解密,本发明实施例采用由服务器提供的会话密钥对会话的数据进行加解密,使得服务器仅需管理会话密钥即可,无需对大量客户端生成的密钥进行管理,从而简化了服务器对密钥进行管理的复杂度,且有助于节省服务器的资源。并且,由于会话密钥并不直接在网络上明文传输,其采用临时密钥加密后传输,因此安全性也得到保证。The temporary encryption key is encrypted by the client and then sent to the server. After the server decrypts the temporary key, the temporary key is used to encrypt the session key to obtain the second ciphertext, and the second ciphertext is sent to the server. The client decrypts the second ciphertext by using the temporary key to obtain the session key, so that the client encrypts and decrypts the session data by using the session key when the client performs a session with the server. Because the number of sessions between the client and the server is quite large, the server needs to spend a lot of resources to manage the problem of the symmetric key; compared with the related technology, the symmetric data generated by the client directly uses the symmetric key generated by the client to encrypt and decrypt the session data. The embodiment of the present invention uses the session key provided by the server to encrypt and decrypt the session data, so that the server only needs to manage the session key, and does not need to manage the keys generated by a large number of clients, thereby simplifying the server confidentiality. The complexity of the key management and helps save server resources. Moreover, since the session key is not directly transmitted in the plaintext on the network, it is encrypted by using a temporary key, so security is also guaranteed.
本发明实施例提供的技术方案,在兼顾密钥的安全性和加解密的高效性的前提下,还简化了服务器对密钥进行管理的复杂度,节省了服务器的处理和存储资源。因此,本发明实施例提供的密钥管理方案,可以很好地适用于大量高并发业务场景,如C/S架构的业务场景,即便客户端的日活数量达到千万量级甚至上亿量级,即便客户端与服务器之间的会话数量相当庞大,服务器也能够简单有效地管理加密所需的密钥,并确保客户端与服务器之间数据传输的安全 性和加解密效率。The technical solution provided by the embodiment of the invention simplifies the complexity of managing the key by the server on the premise of balancing the security of the key and the efficiency of the encryption and decryption, and saves the processing and storage resources of the server. Therefore, the key management solution provided by the embodiment of the present invention can be well applied to a large number of high-concurrency service scenarios, such as a C/S architecture business scenario, even if the number of daily activities of the client reaches tens of millions or even hundreds of millions of levels. Even if the number of sessions between the client and the server is quite large, the server can easily and efficiently manage the keys needed for encryption and ensure the security of data transmission between the client and the server. Sex and encryption efficiency.
为了更清楚地说明本发明实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments will be briefly described below. It is obvious that the drawings in the following description are only some embodiments of the present invention. Other drawings may also be obtained from those of ordinary skill in the art in light of the inventive work.
图1是本发明一个实施例提供的实施环境的示意图;1 is a schematic diagram of an implementation environment provided by an embodiment of the present invention;
图2是本发明另一实施例提供的实施环境的示意图;2 is a schematic diagram of an implementation environment provided by another embodiment of the present invention;
图3是本发明一个实施例提供的密钥管理方法的流程图;3 is a flowchart of a key management method according to an embodiment of the present invention;
图4是本发明另一实施例提供的密钥管理方法的流程图;4 is a flowchart of a key management method according to another embodiment of the present invention;
图5是本发明一个实施例涉及的鉴权阶段的流程图;FIG. 5 is a flowchart of an authentication phase according to an embodiment of the present invention; FIG.
图6是本发明一个实施例涉及的数据通信阶段的流程图;6 is a flow chart of a data communication phase according to an embodiment of the present invention;
图7是本发明一个实施例提供的密钥管理装置的框图;FIG. 7 is a block diagram of a key management apparatus according to an embodiment of the present invention; FIG.
图8是本发明另一实施例提供的密钥管理装置的框图;FIG. 8 is a block diagram of a key management apparatus according to another embodiment of the present invention; FIG.
图9是本发明一个实施例提供的密钥管理系统的框图;9 is a block diagram of a key management system according to an embodiment of the present invention;
图10是本发明一个实施例提供的终端的结构示意图;FIG. 10 is a schematic structural diagram of a terminal according to an embodiment of the present invention;
图11是本发明一个实施例提供的服务器的结构示意图。FIG. 11 is a schematic structural diagram of a server according to an embodiment of the present invention.
为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合附图对本发明实施方式作进一步地详细描述。The embodiments of the present invention will be further described in detail below with reference to the accompanying drawings.
请参考图1,其示出了本发明一个实施例提供的实施环境的示意图。以C/S架构的业务场景为例,该实施环境包括:至少一个终端11和服务器12。Please refer to FIG. 1, which shows a schematic diagram of an implementation environment provided by an embodiment of the present invention. For example, a service scenario of a C/S architecture includes at least one
终端11中可安装运行客户端。在本发明实施例中,对客户端的类型不作限定,例如客户端可以是即时通信客户端、社交应用客户端、支付应用客户端、视频播放客户端,等等。终端11可以是手机、平板电脑、电子书阅读器、多媒体播放设备、膝上型便携式计算机或者台式计算机等电子设备。A running client can be installed in the terminal 11. In the embodiment of the present invention, the type of the client is not limited. For example, the client may be an instant messaging client, a social application client, a payment application client, a video playing client, and the like. The terminal 11 may be an electronic device such as a mobile phone, a tablet computer, an e-book reader, a multimedia playback device, a laptop portable computer, or a desktop computer.
终端11与服务器12之间可通过有线网络或者无线网络建立通信连接。A communication connection can be established between the terminal 11 and the
服务器12可以是一台服务器,也可以是由多台服务器组成的服务器集群,
或者是一个云计算服务中心。服务器12用于为客户端提供后台服务,以实现客户端的各项功能。The
在一个示例中,以服务器12是由多台服务器组成的服务器集群为例,如图2所示,服务器12包括:接入服务器121、业务服务器122、鉴权中心服务器123和密钥管理服务器124。In one example, the
接入服务器121是客户端与业务服务器122和鉴权中心服务器123之间数据传递和分发的媒介。接入服务器121通过网络分别与业务服务器122、鉴权中心服务器123和密钥管理服务器124建立通信连接。The
业务服务器122用于向客户端提供业务服务。在本发明实施例中,对业务服务器122所提供的业务类型不作限定,如即时通信业务、社交业务、支付业务、视频业务,等等。The
鉴权中心服务器123用于向客户端提供鉴权服务,为客户端提供加密所需的密钥。鉴权中心服务器123通过网络与密钥管理服务器124建立通信连接。The
密钥管理服务器124用于管理密钥。可选地,鉴权中心服务器123和密钥管理服务器124可以是两台相互独立的服务器,或者鉴权中心服务器123和密钥管理服务器124也可以集成为一台服务器。The
本发明实施例提供的技术方案,可应用于任何需要对通信两端之间传输的数据进行加密的业务场景。在本发明实施例中,仅以C/S架构的业务场景为例进行举例说明。但是,本发明实施例并不对通信两端的设备进行限定。例如,通信两端的设备可以是运行有客户端的终端和服务器,也可以是终端和基站,或者是服务器和服务器,等等。The technical solution provided by the embodiment of the present invention can be applied to any service scenario that needs to encrypt data transmitted between two ends of a communication. In the embodiment of the present invention, the service scenario of the C/S architecture is taken as an example for illustration. However, the embodiments of the present invention do not limit the devices at both ends of the communication. For example, the devices at both ends of the communication may be a terminal and a server running a client, a terminal and a base station, or a server and a server, and the like.
请参考图3,其示出了本发明一个实施例提供的密钥管理方法的流程图。该方法可应用于图1所示实施环境中。该方法可以包括如下几个步骤。Please refer to FIG. 3, which shows a flowchart of a key management method provided by an embodiment of the present invention. This method can be applied to the implementation environment shown in FIG. The method can include the following steps.
步骤301,客户端生成临时密钥。In step 301, the client generates a temporary key.
步骤302,客户端采用服务器提供的公钥对临时密钥加密,得到第一密文。Step 302: The client encrypts the temporary key by using a public key provided by the server to obtain a first ciphertext.
步骤303,客户端向服务器发送鉴权请求,鉴权请求中携带第一密文。Step 303: The client sends an authentication request to the server, where the first ciphertext is carried in the authentication request.
相应地,服务器接收客户端发送的鉴权请求。Accordingly, the server receives an authentication request sent by the client.
步骤304,服务器采用与公钥对应的私钥对第一密文解密,得到临时密钥。Step 304: The server decrypts the first ciphertext by using a private key corresponding to the public key to obtain a temporary key.
步骤305,服务器采用临时密钥对会话密钥加密,得到第二密文;其中,会话密钥用于对会话的数据加密。 Step 305: The server encrypts the session key by using a temporary key to obtain a second ciphertext; wherein the session key is used to encrypt data of the session.
步骤306,服务器向客户端发送鉴权响应,鉴权响应中携带第二密文。Step 306: The server sends an authentication response to the client, where the authentication response carries the second ciphertext.
相应地,客户端接收服务器发送的鉴权响应。Accordingly, the client receives an authentication response sent by the server.
可选地,鉴权响应中还携带密钥标识,该密钥标识用于标识上述会话密钥。在一种可能的实施方式中,鉴权响应中携带的密钥标识并未采用临时密钥加密;在另一种可能的实施方式中,鉴权响应中携带的密钥标识也采用临时密钥加密。在服务器中管理有多个会话密钥的情况下,可以采用密钥标识对不同的会话密钥进行区分。Optionally, the authentication response further carries a key identifier, where the key identifier is used to identify the session key. In a possible implementation manner, the key identifier carried in the authentication response is not encrypted by using a temporary key; in another possible implementation manner, the key identifier carried in the authentication response also uses a temporary key. encryption. In the case where there are multiple session keys managed in the server, different session keys can be distinguished by using the key identifier.
步骤307,客户端采用临时密钥对第二密文解密,得到会话密钥。Step 307: The client decrypts the second ciphertext by using a temporary key to obtain a session key.
可选地,如果鉴权响应中还携带未加密的密钥标识,则客户端直接从鉴权响应中读取密钥标识;如果鉴权响应中还携带加密后的密钥标识,则客户端采用临时密钥对加密后的密钥标识解密,得到密钥标识。Optionally, if the authentication response further carries an unencrypted key identifier, the client directly reads the key identifier from the authentication response; if the authentication response further carries the encrypted key identifier, the client The encrypted key identifier is decrypted by using a temporary key to obtain a key identifier.
综上所述,本实施例提供的方法,通过客户端采用非对称加密方式对临时密钥加密后发送给服务器,服务器解密得到临时密钥后,采用该临时密钥对会话密钥加密得到第二密文,并将第二密文发送给客户端,客户端采用临时密钥对第二密文解密,得到会话密钥,以便于客户端后续在与服务器进行会话时,采用会话密钥对会话的数据进行加解密;解决了相关技术中由于客户端与服务器之间的会话数量相当庞大,导致服务器需要耗费大量的资源来管理对称密钥的问题;相较于相关技术直接采用由客户端生成的对称密钥对会话的数据进行加解密,本发明实施例采用由服务器提供的会话密钥对会话的数据进行加解密,使得服务器仅需管理会话密钥即可,无需对大量客户端生成的密钥进行管理,从而简化了服务器对密钥进行管理的复杂度,且有助于节省服务器的资源。并且,由于会话密钥并不直接在网络上明文传输,其采用临时密钥加密后传输,因此安全性也得到保证。In summary, the method provided in this embodiment encrypts the temporary key by using the asymmetric encryption method and sends the temporary key to the server. After the server decrypts the temporary key, the temporary key is used to encrypt the session key. The second ciphertext is sent to the client, and the client decrypts the second ciphertext by using the temporary key to obtain the session key, so that the client subsequently uses the session key pair when performing a session with the server. The data of the session is encrypted and decrypted; the problem that the server needs to consume a large amount of resources to manage the symmetric key due to the relatively large number of sessions between the client and the server in the related art is solved; compared with the related technology, the client directly adopts The generated symmetric key encrypts and decrypts the data of the session. In the embodiment of the present invention, the session key provided by the server is used to encrypt and decrypt the session data, so that the server only needs to manage the session key, and does not need to generate a large number of clients. Key management, which simplifies the complexity of server management of keys and helps save service resource of. Moreover, since the session key is not directly transmitted in the plaintext on the network, it is encrypted by using a temporary key, so security is also guaranteed.
本发明实施例提供的技术方案,在兼顾密钥的安全性和加解密的高效性的前提下,还简化了服务器对密钥进行管理的复杂度,节省了服务器的处理和存储资源。因此,本发明实施例提供的密钥管理方案,可以很好地适用于大量高并发业务场景,如C/S架构的业务场景,即便客户端的日活数量达到千万量级甚至上亿量级,即便客户端与服务器之间的会话数量相当庞大,服务器也能够简单有效地管理加密所需的密钥,并确保客户端与服务器之间数据传输的安全性和加解密效率。 The technical solution provided by the embodiment of the invention simplifies the complexity of managing the key by the server on the premise of balancing the security of the key and the efficiency of the encryption and decryption, and saves the processing and storage resources of the server. Therefore, the key management solution provided by the embodiment of the present invention can be well applied to a large number of high-concurrency service scenarios, such as a C/S architecture business scenario, even if the number of daily activities of the client reaches tens of millions or even hundreds of millions of levels. Even if the number of sessions between the client and the server is quite large, the server can easily and efficiently manage the keys needed for encryption and ensure the security and encryption and decryption efficiency of data transmission between the client and the server.
在本发明实施例中,会话(session)指的是在一个不中断的特定操作时间内,两个设备之间的通信交互。在一个会话期间,两个设备之间相互传输的所有数据包都属于该会话。在一个示例中,以C/S架构的业务场景为例,会话可以是客户端与服务器的某一次“通话过程”,一次完整的请求与回复过程。In the embodiment of the present invention, a session refers to a communication interaction between two devices during a specific operation time that is not interrupted. During a session, all packets transmitted between two devices belong to the session. In an example, taking the business scenario of the C/S architecture as an example, the session may be a “call process” between the client and the server, and a complete request and reply process.
请参考图4,其示出了本发明另一实施例提供的密钥管理方法的流程图。该方法可应用于图1所示实施环境中。该方法可以包括如下几个步骤。Please refer to FIG. 4, which is a flowchart of a key management method according to another embodiment of the present invention. This method can be applied to the implementation environment shown in FIG. The method can include the following steps.
步骤401,客户端生成临时密钥。In step 401, the client generates a temporary key.
在一个示例中,采用随机数生成器生成临时密钥。临时密钥为对称密钥。In one example, a temporary key is generated using a random number generator. The temporary key is a symmetric key.
需要说明的是,在本发明实施例中,临时密钥并非用于对会话的数据进行加解密的密钥,临时密钥仅用于对会话密钥进行加解密,会话密钥才是真正用于对会话的数据进行加解密的密钥。It should be noted that, in the embodiment of the present invention, the temporary key is not used to encrypt and decrypt the data of the session, and the temporary key is only used to encrypt and decrypt the session key, and the session key is actually used. The key used to encrypt and decrypt the data of the session.
步骤402,客户端采用服务器提供的公钥对临时密钥加密,得到第一密文。Step 402: The client encrypts the temporary key by using a public key provided by the server to obtain a first ciphertext.
公钥是由服务器预先派发给客户端的。在一个示例中,服务器将公钥写入二进制文件,该二进制文件携带有客户端所对应的开发公司的数字签名,服务器将带有数字签名的二进制文件发送给客户端,以此来保证文件不被篡改和伪造,从而确保公钥的安全下发。可选地,公钥可以随该二进制文件的更新而更新,当服务器启用新的公钥之后,可以重新向客户端发送写有该新的公钥的二进制文件。The public key is pre-delivered to the client by the server. In one example, the server writes the public key to a binary file that carries the digital signature of the development company corresponding to the client, and the server sends the binary file with the digital signature to the client to ensure that the file is not It has been tampered with and forged to ensure the safe issuance of public keys. Alternatively, the public key may be updated with the update of the binary file, and after the server enables the new public key, the binary file with the new public key may be resent to the client.
客户端生成临时密钥之后,依据非对称加密方式,采用服务器提供的公钥对临时密钥加密,得到第一密文。After the client generates the temporary key, the temporary key is encrypted by using the public key provided by the server according to the asymmetric encryption method to obtain the first ciphertext.
步骤403,客户端向服务器发送鉴权请求,鉴权请求中携带第一密文。Step 403: The client sends an authentication request to the server, where the first ciphertext is carried in the authentication request.
鉴权请求用于请求服务器对客户端进行鉴权,并在鉴权通过的情况下为客户端分配加密会话数据所需的密钥。The authentication request is used to request the server to authenticate the client, and allocate the key required for encrypting the session data to the client if the authentication is passed.
相应地,服务器接收客户端发送的鉴权请求。Accordingly, the server receives an authentication request sent by the client.
此外,由于临时密钥是采用服务器提供的公钥进行加密的,即便鉴权请求被恶意用户监听获取,由于其并没有与该公钥对应的私钥,因此也无法对第一密文进行解密出临时密钥。因此,临时密钥的安全性可以得到保证,进而使得后续传输的会话密钥的安全性也可得到保证。In addition, since the temporary key is encrypted by using the public key provided by the server, even if the authentication request is intercepted by the malicious user, since the private key corresponding to the public key is not available, the first ciphertext cannot be decrypted. A temporary key is issued. Therefore, the security of the temporary key can be guaranteed, so that the security of the session key transmitted later can also be guaranteed.
步骤404,服务器采用与公钥对应的私钥对第一密文解密,得到临时密钥。Step 404: The server decrypts the first ciphertext by using a private key corresponding to the public key to obtain a temporary key.
服务器接收到鉴权请求之后,依据非对称加密方式,采用与公钥对应的私 钥对第一密文解密,得到临时密钥。After receiving the authentication request, the server adopts the private key corresponding to the public key according to the asymmetric encryption method. The key decrypts the first ciphertext to obtain a temporary key.
步骤405,服务器获取会话密钥和密钥标识。In step 405, the server acquires a session key and a key identifier.
其中,密钥标识用于标识会话密钥,会话密钥用于对会话的数据加密。会话密钥为对称密钥。可选地,会话密钥是一个连续的字节流,一般为128bit的整数倍,为随机数生成器所产生。密钥标识用于唯一标识会话密钥,不同的会话可以使用同一个密钥标识,不同的密钥标识对应于不同的会话密钥。可选地,密钥标识为64位整数。The key identifier is used to identify the session key, and the session key is used to encrypt the data of the session. The session key is a symmetric key. Optionally, the session key is a contiguous stream of bytes, typically an integer multiple of 128 bits, generated by a random number generator. The key identifier is used to uniquely identify the session key. Different sessions can use the same key identifier. Different key identifiers correspond to different session keys. Optionally, the key identifier is a 64-bit integer.
在一个示例中,服务器采用随机数生成器生成会话密钥,并生成对应于会话密钥的密钥标识。另外,服务器对应存储会话密钥和密钥标识。In one example, the server generates a session key using a random number generator and generates a key identification corresponding to the session key. In addition, the server corresponds to the storage session key and the key identifier.
在另一示例中,服务器从预存密钥中选取一组对应的会话密钥和密钥标识。其中,预存密钥中包括至少一组对应的会话密钥和密钥标识。预存密钥是由服务器预先生成并存储的。预存密钥可以存储在服务器的Cache(高速缓冲存储器)中,或者也可以存储在一个目标文件中。在一个示例中,预存密钥既存储在Cache中,又备份存储在目标文件中,以便于在Cache出现故障时后备之用。In another example, the server picks a set of corresponding session keys and key identities from the pre-stored keys. The pre-stored key includes at least one set of corresponding session key and key identifier. The pre-stored key is pre-generated and stored by the server. The pre-stored key can be stored in the server's Cache (cache) or it can be stored in a target file. In one example, the pre-stored key is stored both in the Cache and backed up in the target file to facilitate backup in the event of a Cache failure.
密钥标识和会话密钥之间存在一一对应关系。可选地,每一个会话密钥具有相应的有效期,在有效期之内会话密钥有效,否则会话密钥失效。会话密钥的有效期可以在会话密钥生成时对应设定。对于不同的会话密钥,其有效期的时长通常相同,但也可不同,本实施例对此不作限定。此外,在本实施例中,对会话密钥的有效期的生效时间也不作限定,例如会话密钥的有效期可以在会话密钥生成时开始生效,也可在服务器向客户端发送该会话密钥时开始生效,或者在客户端接收到该会话密钥时开始生效。There is a one-to-one correspondence between the key identifier and the session key. Optionally, each session key has a corresponding validity period, and the session key is valid within the validity period, otherwise the session key is invalid. The validity period of the session key can be set correspondingly when the session key is generated. For different session keys, the duration of the validity period is usually the same, but it may be different. This embodiment does not limit this. In addition, in this embodiment, the validity time of the validity period of the session key is not limited. For example, the validity period of the session key may be effective when the session key is generated, or when the server sends the session key to the client. Effective at the beginning, or when the client receives the session key.
客户端使用有效状态(也即未超出有效期)的会话密钥对会话数据进行加解密,在会话密钥失效(也即超出有效期)之后,客户端可从服务器请求获取新的有效的会话密钥。因此,上述步骤403的执行时机可以是当已有的会话密钥已经失效时,或者也可以是当客户端需要向服务器发起会话且已有的会话密钥已经失效时。如果已有的会话密钥还未失效,客户端可使用已有的会话密钥对会话数据进行加解密,无需重新从服务器请求获取新的会话密钥。The client encrypts and decrypts the session data using the session key of the valid state (that is, the expiration date is not exceeded). After the session key is invalidated (that is, the validity period is exceeded), the client can request a new valid session key from the server. . Therefore, the execution timing of the above step 403 may be when the existing session key has expired, or when the client needs to initiate a session to the server and the existing session key has expired. If the existing session key has not expired, the client can use the existing session key to encrypt and decrypt the session data without re-requesting the new session key from the server.
可选地,服务器从预存密钥中选取一组对应的会话密钥和密钥标识,可包括如下几个子步骤:Optionally, the server selects a corresponding set of session keys and key identifiers from the pre-stored keys, and may include the following sub-steps:
1、服务器获取客户端对应的IP(Internet Protocol,互联网协议)地址; 1. The server obtains an IP (Internet Protocol) address corresponding to the client;
例如,服务器对客户端发送的鉴权请求的数据包进行解析,从包头中解析获取客户端对应的IP地址。For example, the server parses the data packet of the authentication request sent by the client, and parses and obtains the IP address corresponding to the client from the packet header.
2、服务器根据IP地址确定密钥选取范围,密钥选取范围包括预存密钥中的部分相对应的会话密钥和密钥标识;2. The server determines a key selection range according to the IP address, and the key selection range includes a corresponding session key and a key identifier of the pre-stored key;
服务器可以对预存密钥进行分段,服务器将预存密钥分为多段,每一段包括一部分相对应的会话密钥和密钥标识。例如,服务器计算客户端对应的IP地址的Hash(哈希)值,根据该Hash值映射到某一段预存密钥,该段预存密钥即为上述密钥选取范围。又例如,服务器还可以从分段后的预存密钥中,随机选择一段预存密钥,该段被选择的预存密钥即为上述密钥选取范围。The server may segment the pre-stored key, and the server divides the pre-stored key into multiple segments, each segment including a part of the corresponding session key and key identifier. For example, the server calculates a hash value of the IP address corresponding to the client, and maps the data to a certain pre-stored key according to the hash value, where the pre-stored key is the key selection range. For another example, the server may also randomly select a pre-stored key from the pre-stored key after segmentation, and the selected pre-stored key of the segment is the key selection range.
3、服务器从密钥选取范围中选取一组对应的会话密钥和密钥标识。3. The server selects a corresponding set of session keys and key identifiers from the key selection range.
通过上述方式,可以防止服务器被拖库,因为同一个IP地址所能拿到的会话密钥为某段固定范围,而不是所有预存密钥。In this way, it is possible to prevent the server from being dragged, because the session key that can be obtained by the same IP address is a fixed range, not all pre-stored keys.
需要说明的是,在本实施例中,仅以服务器中管理多个会话密钥进行介绍说明,因此服务器还需生成对应于会话密钥的密钥标识,以便于对不同的会话密钥进行区分。如果服务器中仅管理一个会话密钥,则无需生成密钥标识。另外,相较于仅管理一个会话密钥,管理多个会话密钥相对来说安全性更高。It should be noted that, in this embodiment, only a plurality of session keys are managed in the server for description, so the server also needs to generate a key identifier corresponding to the session key, so as to distinguish different session keys. . If only one session key is managed in the server, there is no need to generate a key identifier. In addition, managing multiple session keys is relatively more secure than managing only one session key.
步骤406,服务器采用临时密钥对会话密钥加密,得到第二密文。Step 406: The server encrypts the session key by using a temporary key to obtain a second ciphertext.
服务器依据对称加密方式,采用临时密钥对会话密钥加密,得到第二密文。The server encrypts the session key by using a temporary key according to a symmetric encryption method to obtain a second ciphertext.
可选地,服务器还采用临时密钥对密钥标识加密,得到加密后的密钥标识。Optionally, the server further encrypts the key identifier by using a temporary key, and obtains the encrypted key identifier.
步骤407,服务器向客户端发送鉴权响应,鉴权响应中携带第二密文和密钥标识。Step 407: The server sends an authentication response to the client, where the authentication response carries the second ciphertext and the key identifier.
相应地,客户端接收服务器发送的鉴权响应。其中,鉴权响应中携带的密钥标识可以是未加密的密钥标识,也可以是加密后的密钥标识。Accordingly, the client receives an authentication response sent by the server. The key identifier carried in the authentication response may be an unencrypted key identifier or an encrypted key identifier.
可选地,服务器在接收到客户端发送的鉴权请求之后,还可以执行如下步骤:服务器获取客户端所在设备对应的GUID(Globally Unique Identifier,全局唯一标识符);获取GUID对应的鉴权请求次数;判断鉴权请求次数是否大于预设阈值;若鉴权请求次数大于预设阈值,则拒绝响应该鉴权请求;若鉴权请求次数小于预设阈值,则响应该鉴权请求,例如执行上述步骤404至407。其中,客户端所在设备对应的GUID可从鉴权请求的数据包的包头中解析获取。通过上述方式,对同一GUID的鉴权请求次数进行限制,可以在服务器受到频繁的恶意攻击时,有效防止服务器瘫痪。 Optionally, after receiving the authentication request sent by the client, the server may further perform the following steps: the server obtains a GUID (Globally Unique Identifier) corresponding to the device where the client is located, and obtains an authentication request corresponding to the GUID. The number of times; determining whether the number of authentication requests is greater than a preset threshold; if the number of authentication requests is greater than a preset threshold, refusing to respond to the authentication request; if the number of authentication requests is less than a preset threshold, responding to the authentication request, for example, performing The above steps 404 to 407. The GUID corresponding to the device where the client is located can be parsed and obtained from the packet header of the data packet of the authentication request. In the above manner, the number of authentication requests of the same GUID is limited, and the server can be effectively prevented when the server is subjected to frequent malicious attacks.
步骤408,客户端采用临时密钥对第二密文解密,得到会话密钥。Step 408: The client decrypts the second ciphertext by using a temporary key to obtain a session key.
客户端接收到鉴权响应之后,依据对称加密方式,采用临时密钥对第二密文解密,得到会话密钥。之后,客户端就用该会话密钥来对称加密与服务器之间的通信内容即可。在后续的客户端与服务器的会话过程中,客户端采用会话密钥对与服务器之间传输的会话的数据进行加解密,服务器采用会话密钥对与客户端之间传输的会话的数据进行加解密。After receiving the authentication response, the client decrypts the second ciphertext by using the temporary key according to the symmetric encryption method to obtain the session key. After that, the client uses the session key to symmetrically encrypt the communication content with the server. During the subsequent session between the client and the server, the client encrypts and decrypts the data of the session transmitted between the server by using the session key, and the server uses the session key to add the data of the session transmitted between the client and the client. Decrypt.
可选地,如果鉴权响应中还携带未加密的密钥标识,则客户端直接从鉴权响应中读取密钥标识;如果鉴权响应中还携带加密后的密钥标识,则客户端采用临时密钥对加密后的密钥标识解密,得到密钥标识。Optionally, if the authentication response further carries an unencrypted key identifier, the client directly reads the key identifier from the authentication response; if the authentication response further carries the encrypted key identifier, the client The encrypted key identifier is decrypted by using a temporary key to obtain a key identifier.
下面,对客户端与服务器之间的数据通信阶段的流程进行介绍和说明。步骤409至411为上行传输过程,步骤412至414为下行传输过程。The following describes and describes the flow of the data communication phase between the client and the server. Steps 409 to 411 are uplink transmission procedures, and steps 412 to 414 are downlink transmission procedures.
步骤409,客户端采用会话密钥对会话的上行数据加密,得到加密后的上行数据。Step 409: The client encrypts the uplink data of the session by using the session key, and obtains the encrypted uplink data.
上行数据是指客户端向服务器传输的数据。The uplink data refers to the data transmitted by the client to the server.
步骤410,客户端向服务器发送上行数据包。In step 410, the client sends an uplink data packet to the server.
上行数据包的包头携带密钥标识,上行数据包的包体携带加密后的上行数据。可选地,若客户端未接收到密钥标识,则上行数据包的包头中也就不携带密钥标识。The packet header of the uplink data packet carries the key identifier, and the packet body of the uplink data packet carries the encrypted uplink data. Optionally, if the client does not receive the key identifier, the packet identifier of the uplink data packet does not carry the key identifier.
相应地,服务器接收客户端发送的上行数据包。Correspondingly, the server receives the uplink data packet sent by the client.
步骤411,服务器采用与包头中携带的密钥标识相对应的会话密钥对加密后的上行数据解密,得到上行数据。In step 411, the server decrypts the encrypted uplink data by using the session key corresponding to the key identifier carried in the packet header to obtain uplink data.
服务器接收到上行数据包之后,从预存密钥中查询获取与上行数据包的包头中携带的密钥标识相对应的会话密钥,而后依据对称加密方式,采用该查询到的会话密钥对加密后的上行数据解密,得到上行数据。After receiving the uplink data packet, the server queries the pre-stored key to obtain the session key corresponding to the key identifier carried in the packet header of the uplink data packet, and then encrypts the session key pair according to the symmetric encryption mode. After the uplink data is decrypted, the uplink data is obtained.
可选地,服务器在执行解密操作之前,还可对查询到的会话密钥的有效期进行验证,若已超出有效期则结束流程,若未超出有效期则执行解密操作。Optionally, the server may further verify the validity period of the queried session key before performing the decryption operation, and if the expiration date has expired, the process ends, and if the validity period is not exceeded, the decryption operation is performed.
步骤412,服务器采用会话密钥对会话的下行数据加密,得到加密后的下行数据。Step 412: The server encrypts the downlink data of the session by using the session key, and obtains the encrypted downlink data.
下行数据是指服务器向客户端传输的数据。Downstream data refers to the data that the server transmits to the client.
步骤413,服务器向客户端发送下行数据包。In step 413, the server sends a downlink data packet to the client.
下行数据包的包头携带密钥标识,下行数据包的包体携带加密后的下行数 据。可选地,如果服务器中仅管理一个会话密钥,则不必要生成密钥标识,下行数据包的包头中也就不携带密钥标识。The packet header of the downlink data packet carries the key identifier, and the packet body of the downlink data packet carries the encrypted downlink number. according to. Optionally, if only one session key is managed in the server, it is not necessary to generate a key identifier, and the key identifier of the downlink data packet does not carry the key identifier.
相应地,客户端接收服务器发送的下行数据包。Correspondingly, the client receives the downlink data packet sent by the server.
步骤414,客户端采用与包头中携带的密钥标识相对应的会话密钥对加密后的下行数据解密,得到下行数据。Step 414: The client decrypts the encrypted downlink data by using a session key corresponding to the key identifier carried in the packet header to obtain downlink data.
客户端接收到下行数据包之后,查询获取与下行数据包的包头中携带的密钥标识相对应的会话密钥,而后依据对称加密方式,采用该查询到的会话密钥对加密后的下行数据解密,得到下行数据。After receiving the downlink data packet, the client obtains the session key corresponding to the key identifier carried in the packet header of the downlink data packet, and then uses the queried session key pair to encrypt the downlink data according to the symmetric encryption mode. Decrypt, get the downlink data.
需要补充说明的一点是,服务器还可获取对应于会话密钥的初始化向量(Init Vector,IV),向客户端发送该初始化向量。该初始化向量供客户端采用会话密钥进行对称加密和解密时使用。相应地,客户端接收服务器发送的初始化向量。例如,服务器向客户端发送的鉴权响应中,还携带初始化向量。初始化向量可以采用临时密钥加密后发送,也可不加密,本实施例对此不作限定。初始化向量可以由服务器采用随机数生成器生成随机数,并结合该随机数和会话密钥一同生成。在使用过程中,初始化向量可根据相关算法动态改变。可选地,初始化向量为12字节的字节流。通过上述方式,使得同一个会话密钥,还必须配合使用对应的初始化向量才能完成解密,以实现进一步的优化加固。It should be added that the server can also obtain an initialization vector (Init Vector, IV) corresponding to the session key, and send the initialization vector to the client. This initialization vector is used by the client for symmetric encryption and decryption using the session key. Accordingly, the client receives an initialization vector sent by the server. For example, the authentication response sent by the server to the client also carries an initialization vector. The initialization vector may be sent by using a temporary key or may not be encrypted. This embodiment does not limit this. The initialization vector can be generated by the server using a random number generator to generate a random number, and combined with the random number and the session key. During use, the initialization vector can be dynamically changed according to the relevant algorithm. Optionally, the initialization vector is a 12 byte byte stream. In the above manner, the same session key must be used together with the corresponding initialization vector to complete the decryption, so as to achieve further optimization and reinforcement.
综上所述,本实施例提供的方法,通过客户端采用非对称加密方式对临时密钥加密后发送给服务器,服务器解密得到临时密钥后,采用该临时密钥对会话密钥加密得到第二密文,并将第二密文发送给客户端,客户端采用临时密钥对第二密文解密,得到会话密钥,以便于客户端后续在与服务器进行会话时,采用会话密钥对会话的数据进行加解密;解决了相关技术中由于客户端与服务器之间的会话数量相当庞大,导致服务器需要耗费大量的资源来管理对称密钥的问题;相较于相关技术直接采用由客户端生成的对称密钥对会话的数据进行加解密,本发明实施例采用由服务器提供的会话密钥对会话的数据进行加解密,使得服务器仅需管理会话密钥即可,无需对大量客户端生成的密钥进行管理,从而简化了服务器对密钥进行管理的复杂度,且有助于节省服务器的资源。并且,由于会话密钥并不直接在网络上明文传输,其采用临时密钥加密后传输,因此安全性也得到保证。In summary, the method provided in this embodiment encrypts the temporary key by using the asymmetric encryption method and sends the temporary key to the server. After the server decrypts the temporary key, the temporary key is used to encrypt the session key. The second ciphertext is sent to the client, and the client decrypts the second ciphertext by using the temporary key to obtain the session key, so that the client subsequently uses the session key pair when performing a session with the server. The data of the session is encrypted and decrypted; the problem that the server needs to consume a large amount of resources to manage the symmetric key due to the relatively large number of sessions between the client and the server in the related art is solved; compared with the related technology, the client directly adopts The generated symmetric key encrypts and decrypts the data of the session. In the embodiment of the present invention, the session key provided by the server is used to encrypt and decrypt the session data, so that the server only needs to manage the session key, and does not need to generate a large number of clients. Key management, which simplifies the complexity of server management of keys and helps save service resource of. Moreover, since the session key is not directly transmitted in the plaintext on the network, it is encrypted by using a temporary key, so security is also guaranteed.
另外,还通过为会话密钥设置相应的有效期,在会话密钥未超期的情况下,即便是不同的会话,客户端均可采用该会话密钥对会话的数据进行加解密,无 需从服务器重新请求获取新的会话密钥,节省客户端所在设备和服务器的处理开销和通信资源。In addition, by setting the corresponding validity period for the session key, even if the session key is not expired, the client can use the session key to encrypt and decrypt the session data, A new session key needs to be re-requested from the server to save processing overhead and communication resources of the device and server where the client is located.
还需要补充说明的一点是,考虑到采用非对称加密算法解密的速度是较慢的,其解密速度通常在单线程2200次/秒左右,因此可采用多线程并行解密的方式,使得服务器在不投入很多机器的情况下,不成为系统瓶颈。另外,如果采用OpenSLL(Open Secure Sockets Layer,开放式安全套接层协议)库,由于OpenSLL库非多线程安全,因此一个服务进程只能有一个线程完成解密工作,要多线程并行,就需要运行多个进程,这样对开发和发布都影响较大,不方便维护。在本发明实施例中,针对OpenSLL库的rsa函数api进行代码调整,以实现分离多线程不安全的步骤,将其放到安全的地方调用,其余安全的步骤,即可位于多线程环境调用,从而达到多线程并行解密的要求。It is also necessary to add that the speed of decryption using the asymmetric encryption algorithm is slower, and the decryption speed is usually about 2200 times/second in a single thread. Therefore, multi-thread parallel decryption can be used to make the server not When a lot of machines are put into use, it does not become a system bottleneck. In addition, if OpenSLL (Open Secure Sockets Layer) library is used, since the OpenSLL library is not multi-thread safe, only one thread can complete the decryption work in a service process. To multi-thread parallel, it needs to run more. Processes, which have a large impact on development and release, are not convenient to maintain. In the embodiment of the present invention, code adjustment is performed on the rsa function api of the OpenSLL library, so as to implement the step of separating the multi-thread unsafe, and placing it in a safe place, and the remaining security steps can be located in the multi-thread environment. Thereby achieving the requirement of multi-threaded parallel decryption.
在上述方法实施例中,有关客户端侧的步骤可以单独实现成为客户端侧的密钥管理方法,有关服务器侧的步骤可以单独实现成为服务器侧的密钥管理方法。In the foregoing method embodiment, the step on the client side can be separately implemented as a key management method on the client side, and the steps on the server side can be separately implemented as a key management method on the server side.
下面,结合图2所示的应用场景,对本发明实施例提供的技术方案进行介绍和说明。The technical solutions provided by the embodiments of the present invention are described and illustrated in the following with reference to the application scenarios shown in FIG.
图5示出了鉴权阶段的流程图。如图5所示,鉴权阶段可包括如下几个步骤。Figure 5 shows a flow chart of the authentication phase. As shown in FIG. 5, the authentication phase may include the following steps.
步骤501,客户端生成临时密钥。In step 501, the client generates a temporary key.
步骤502,客户端采用鉴权中心服务器提供的公钥对临时密钥加密,得到第一密钥。Step 502: The client encrypts the temporary key by using the public key provided by the authentication center server to obtain the first key.
步骤503,客户端向接入服务器发送鉴权请求,鉴权请求中携带第一密文。Step 503: The client sends an authentication request to the access server, where the first ciphertext is carried in the authentication request.
相应地,接入服务器接收客户端发送的鉴权请求。Correspondingly, the access server receives an authentication request sent by the client.
步骤504,接入服务器向鉴权中心服务器转发鉴权请求。Step 504: The access server forwards the authentication request to the authentication center server.
相应地,鉴权中心服务器接收接入服务器发送的鉴权请求。Correspondingly, the authentication center server receives the authentication request sent by the access server.
步骤505,鉴权中心服务器采用与公钥对应的私钥对第一密文解密,得到临时密钥。Step 505: The authentication center server decrypts the first ciphertext by using a private key corresponding to the public key to obtain a temporary key.
步骤506,鉴权中心服务器获取会话密钥和密钥标识。Step 506: The authentication center server acquires a session key and a key identifier.
其中,密钥标识用于标识会话密钥,会话密钥用于对会话的数据加密。The key identifier is used to identify the session key, and the session key is used to encrypt the data of the session.
在一个示例中,步骤506包括如下子步骤: In one example, step 506 includes the following sub-steps:
步骤506a,鉴权中心服务器采用随机数生成器生成会话密钥;Step 506a: The authentication center server generates a session key by using a random number generator.
步骤506b,鉴权中心服务器向密钥管理服务器发送会话密钥;Step 506b: The authentication center server sends a session key to the key management server.
相应地,密钥管理服务器接收鉴权中心服务器发送的会话密钥;Correspondingly, the key management server receives the session key sent by the authentication center server;
步骤506c,密钥管理服务器生成对应于会话密钥的密钥标识;Step 506c: The key management server generates a key identifier corresponding to the session key.
步骤506d,密钥管理服务器对应存储密钥标识和会话密钥;Step 506d, the key management server correspondingly stores the key identifier and the session key;
步骤506e,密钥管理服务器向鉴权中心服务器发送密钥标识;Step 506e: The key management server sends a key identifier to the authentication center server.
相应地,鉴权中心服务器接收密钥管理服务器发送的密钥标识。Correspondingly, the authentication center server receives the key identifier sent by the key management server.
在另一示例中,步骤506包括如下子步骤:In another example, step 506 includes the following sub-steps:
步骤506f,鉴权中心服务器从预存密钥中选取一组对应的会话密钥和密钥标识。In step 506f, the authentication center server selects a corresponding set of session keys and key identifiers from the pre-stored keys.
其中,预存密钥中包括至少一组对应的会话密钥和密钥标识。预存密钥可以由密钥管理服务器预先生成,并提供给鉴权中心服务器。例如,密钥管理服务器将预存密钥写入目标文件中,并将目标文件发送给鉴权中心服务器。鉴权中心服务器启动后,将目标文件中的预存密钥加载至内存中,每次随机从中选取一组对应的会话密钥和密钥标识。The pre-stored key includes at least one set of corresponding session key and key identifier. The pre-stored key can be pre-generated by the key management server and provided to the authentication center server. For example, the key management server writes the pre-stored key into the target file and sends the target file to the authentication center server. After the authentication center server is started, the pre-stored key in the target file is loaded into the memory, and a corresponding set of session key and key identifier are randomly selected from each time.
步骤507,鉴权中心服务器采用临时密钥对会话密钥加密,得到第二密文。In step 507, the authentication center server encrypts the session key by using a temporary key to obtain a second ciphertext.
步骤508,鉴权中心服务器向接入服务器发送鉴权响应,鉴权响应中携带第二密文和密钥标识。Step 508: The authentication center server sends an authentication response to the access server, where the authentication response carries the second ciphertext and the key identifier.
相应地,接入服务器接收鉴权中心服务器发送的鉴权响应。Correspondingly, the access server receives the authentication response sent by the authentication center server.
其中,鉴权响应中携带的密钥标识可以是未加密的密钥标识,也可以是加密后的密钥标识。The key identifier carried in the authentication response may be an unencrypted key identifier or an encrypted key identifier.
步骤509,接入服务器向客户端转发鉴权响应。In step 509, the access server forwards the authentication response to the client.
相应地,客户端接收接入服务器发送的鉴权响应。Correspondingly, the client receives an authentication response sent by the access server.
步骤510,客户端采用临时密钥对第二密文解密,得到会话密钥。Step 510: The client decrypts the second ciphertext by using a temporary key to obtain a session key.
图6示出了数据通信阶段的流程图。如图6所示,数据通信阶段可包括如下几个步骤。Figure 6 shows a flow chart of the data communication phase. As shown in FIG. 6, the data communication phase can include the following steps.
步骤601,客户端采用会话密钥对会话的上行数据加密,得到加密后的上行数据。Step 601: The client encrypts the uplink data of the session by using the session key, and obtains the encrypted uplink data.
步骤602,客户端向接入服务器发送上行数据包。Step 602: The client sends an uplink data packet to the access server.
上行数据包的包头携带密钥标识,上行数据包的包体携带加密后的上行数 据。The packet header of the uplink data packet carries the key identifier, and the packet body of the uplink data packet carries the encrypted uplink number. according to.
相应地,接入服务器接收客户端发送的上行数据包。Correspondingly, the access server receives the uplink data packet sent by the client.
步骤603,接入服务器查询获取与包头中携带的密钥标识相对应的会话密钥。Step 603: The access server queries to obtain a session key corresponding to the key identifier carried in the packet header.
在一个示例中,步骤603包括如下子步骤:In one example, step 603 includes the following sub-steps:
步骤603a,接入服务器从本地缓存中查询获取与包头中携带的密钥标识相对应的会话密钥。Step 603a: The access server queries, from the local cache, the session key corresponding to the key identifier carried in the packet header.
例如,接入服务器预先从密钥管理服务器获取预设密钥,并存储至本地缓存中。For example, the access server obtains a preset key from the key management server in advance and stores it in the local cache.
在另一示例中,步骤603包括如下子步骤:In another example, step 603 includes the following sub-steps:
步骤603b,接入服务器向密钥管理服务器发送查询请求,查询请求中携带所述包头中携带的密钥标识;Step 603b: The access server sends a query request to the key management server, where the query request carries the key identifier carried in the packet header.
相应地,密钥管理服务器接收接入服务器发送的查询请求;Correspondingly, the key management server receives the query request sent by the access server;
步骤603c,密钥管理服务器从预设密钥中查询获取与查询请求中携带的密钥标识相对应的会话密钥;Step 603c: The key management server queries, by using a preset key, a session key corresponding to the key identifier carried in the query request.
步骤603d,密钥管理服务器向接入服务器发送查询响应,查询响应中携带其查询得到的会话密钥;Step 603d: The key management server sends a query response to the access server, where the query response carries the session key obtained by the query;
相应地,接入服务器接收密钥管理服务器发送的查询响应。Accordingly, the access server receives the query response sent by the key management server.
步骤604,接入服务器采用查询获取的会话密钥对加密后的上行数据解密,得到上行数据。Step 604: The access server decrypts the encrypted uplink data by using the session key obtained by the query to obtain uplink data.
步骤605,接入服务器向业务服务器发送上行数据。Step 605: The access server sends uplink data to the service server.
相应地,业务服务器接收接入服务器发送的上行数据。Correspondingly, the service server receives the uplink data sent by the access server.
在一个示例中,接入服务器将上行数据明文发送给业务服务器。在另一示例中,接入服务器采用与业务服务器预先协商好的加密方式和密钥,将上行数据加密后发送给业务服务器。In one example, the access server sends the clear text of the uplink data to the service server. In another example, the access server encrypts the uplink data and sends it to the service server by using an encryption method and a key that are negotiated in advance with the service server.
业务服务器接收到上行数据之后,对该上行数据进行处理,必要时向客户端反馈回包。After receiving the uplink data, the service server processes the uplink data and feeds back the packet to the client if necessary.
步骤606,业务服务器向接入服务器发送下行数据。Step 606: The service server sends downlink data to the access server.
相应地,接入服务器接收业务服务器发送的下行数据。Correspondingly, the access server receives downlink data sent by the service server.
在一个示例中,业务服务器将下行数据明文发送给接入服务器。在另一示例中,业务服务器采用与接入服务器预先协商好的加密方式和密钥,将下行数 据加密后发送给接入服务器。In one example, the service server sends the clear text of the downlink data to the access server. In another example, the service server adopts an encryption method and a key that are pre-negotiated with the access server, and the number of downlinks is used. After being encrypted, it is sent to the access server.
步骤607,接入服务器采用查询获取的会话密钥对下行数据加密,得到加密后的下行数据。Step 607: The access server encrypts the downlink data by using the session key obtained by the query, and obtains the encrypted downlink data.
步骤608,接入服务器向客户端发送下行数据包。Step 608: The access server sends a downlink data packet to the client.
下行数据包的包头携带密钥标识,下行数据包的包体携带加密后的下行数据。The packet header of the downlink data packet carries the key identifier, and the packet body of the downlink data packet carries the encrypted downlink data.
相应地,客户端接收接入服务器发送的下行数据包。Correspondingly, the client receives the downlink data packet sent by the access server.
步骤609,客户端采用与包头中携带的密钥标识相对应的会话密钥对加密后的下行数据解密,得到下行数据。Step 609: The client decrypts the encrypted downlink data by using a session key corresponding to the key identifier carried in the packet header to obtain downlink data.
下述为本发明装置实施例,可以用于执行本发明方法实施例。对于本发明装置实施例中未披露的细节,请参照本发明方法实施例。The following is an embodiment of the apparatus of the present invention, which can be used to carry out the method embodiments of the present invention. For details not disclosed in the embodiment of the device of the present invention, please refer to the method embodiment of the present invention.
请参考图7,其示出了本发明一个实施例提供的密钥管理装置的框图。该装置具有实现上述客户端侧的密钥管理方法的功能,所述功能可以通过硬件实现,也可以通过硬件执行相应的软件实现。该装置可以包括:密钥生成模块710、第一加密模块720、请求发送模块730、响应接收模块740和第一解密模块750。Please refer to FIG. 7, which shows a block diagram of a key management apparatus according to an embodiment of the present invention. The device has a function of implementing the above-mentioned client side key management method, and the function may be implemented by hardware or by executing corresponding software by hardware. The apparatus may include a
密钥生成模块710,用于生成临时密钥。The
第一加密模块720,用于采用服务器提供的公钥对所述临时密钥加密,得到第一密文。The
请求发送模块730,用于向所述服务器发送鉴权请求,所述鉴权请求中携带所述第一密文。The
响应接收模块740,用于接收所述服务器发送的鉴权响应,所述鉴权响应中携带第二密文,所述第二密文是采用所述临时密钥对会话密钥加密得到的密文。其中,所述会话密钥用于对会话的数据加密。The
第一解密模块750,用于采用所述临时密钥对所述第二密文解密,得到所述会话密钥。The
综上所述,本实施例提供的装置,通过客户端采用非对称加密方式对临时密钥加密后发送给服务器,从服务器接收其采用临时密钥对会话密钥加密得到的第二密文,并采用临时密钥对第二密文解密,得到会话密钥,以便于客户端后续在与服务器进行会话时,采用会话密钥对会话的数据进行加解密;解决了相关技术中由于客户端与服务器之间的会话数量相当庞大,导致服务器需要耗 费大量的资源来管理对称密钥的问题;相较于相关技术直接采用由客户端生成的对称密钥对会话的数据进行加解密,本发明实施例采用由服务器提供的会话密钥对会话的数据进行加解密,使得服务器仅需管理会话密钥即可,无需对大量客户端生成的密钥进行管理,从而简化了服务器对密钥进行管理的复杂度,且有助于节省服务器的资源。并且,由于会话密钥并不直接在网络上明文传输,其采用临时密钥加密后传输,因此安全性也得到保证。In summary, the device provided in this embodiment encrypts the temporary key by using the asymmetric encryption method and sends the temporary ciphertext to the server, and receives the second ciphertext obtained by encrypting the session key by using the temporary key. The temporary cipher is used to decrypt the second ciphertext to obtain the session key, so that the client can encrypt and decrypt the session data by using the session key when the client performs a session with the server. The related technology is solved by the client and the client. The number of sessions between servers is quite large, causing the server to consume A large amount of resources are used to manage the problem of the symmetric key; the session data is encrypted and decrypted by the symmetric key generated by the client, and the session key provided by the server is used for the session. The data is encrypted and decrypted, so that the server only needs to manage the session key, and does not need to manage the keys generated by a large number of clients, thereby simplifying the complexity of managing the keys by the server and saving the resources of the server. Moreover, since the session key is not directly transmitted in the plaintext on the network, it is encrypted by using a temporary key, so security is also guaranteed.
请参考图8,其示出了本发明另一实施例提供的密钥管理装置的框图。该装置具有实现上述服务器侧的密钥管理方法的功能,所述功能可以通过硬件实现,也可以通过硬件执行相应的软件实现。该装置可以包括:请求接收模块810、第二解密模块820、第二加密模块840和响应发送模块850。Please refer to FIG. 8, which is a block diagram of a key management apparatus according to another embodiment of the present invention. The device has a function of implementing the above-mentioned server-side key management method, and the function may be implemented by hardware or by executing corresponding software by hardware. The apparatus may include a
请求接收模块810,用于接收客户端发送的鉴权请求,所述鉴权请求中携带第一密文,所述第一密文是采用本端提供的公钥对临时密钥加密得到的密文。The
第二解密模块820,用于采用与所述公钥对应的私钥对所述第一密文解密,得到所述临时密钥。The
第二加密模块840,用于采用所述临时密钥对会话密钥加密,得到第二密文;其中,所述会话密钥用于对会话的数据加密。The
响应发送模块850,用于向所述客户端发送鉴权响应,所述鉴权响应中携带所述第二密文。The
综上所述,本实施例提供的装置,通过客户端采用非对称加密方式对临时密钥加密后发送给服务器,服务器解密得到临时密钥后,采用该临时密钥对会话密钥加密得到第二密文,并将第二密文发送给客户端,以便于客户端后续在与服务器进行会话时,采用会话密钥对会话的数据进行加解密;解决了相关技术中由于客户端与服务器之间的会话数量相当庞大,导致服务器需要耗费大量的资源来管理对称密钥的问题;相较于相关技术直接采用由客户端生成的对称密钥对会话的数据进行加解密,本发明实施例采用由服务器提供的会话密钥对会话的数据进行加解密,使得服务器仅需管理会话密钥即可,无需对大量客户端生成的密钥进行管理,从而简化了服务器对密钥进行管理的复杂度,且有助于节省服务器的资源。并且,由于会话密钥并不直接在网络上明文传输,其采用临时密钥加密后传输,因此安全性也得到保证。 In summary, the device provided in this embodiment encrypts the temporary key by using the asymmetric encryption method and sends the temporary key to the server. After the server decrypts the temporary key, the temporary key is used to encrypt the session key. Two ciphertexts, and the second ciphertext is sent to the client, so that the client subsequently encrypts and decrypts the session data by using the session key when the client performs a session with the server; the related technology is solved by the client and the server. The number of sessions is quite large, which causes the server to use a large amount of resources to manage the problem of the symmetric key. The data of the session is encrypted and decrypted by using the symmetric key generated by the client. The session key provided by the server encrypts and decrypts the data of the session, so that the server only needs to manage the session key, and does not need to manage the keys generated by a large number of clients, thereby simplifying the complexity of managing the keys by the server. And help save server resources. Moreover, since the session key is not directly transmitted in the plaintext on the network, it is encrypted by using a temporary key, so security is also guaranteed.
请参考图9,其示出了本发明一个实施例提供的密钥管理系统的框图。该系统包括:客户端700和服务器800。Please refer to FIG. 9, which shows a block diagram of a key management system provided by an embodiment of the present invention. The system includes a client 700 and a server 800.
客户端700可以包括密钥管理装置。该装置具有实现上述客户端侧的密钥管理方法的功能,所述功能可以通过硬件实现,也可以通过硬件执行相应的软件实现。该装置可以包括:密钥生成模块710、第一加密模块720、请求发送模块730、响应接收模块740和第一解密模块750。Client 700 can include a key management device. The device has a function of implementing the above-mentioned client side key management method, and the function may be implemented by hardware or by executing corresponding software by hardware. The apparatus may include a
密钥生成模块710,用于生成临时密钥。The
第一加密模块720,用于采用服务器800提供的公钥对所述临时密钥加密,得到第一密文。The
请求发送模块730,用于向所述服务器800发送鉴权请求,所述鉴权请求中携带所述第一密文。The
响应接收模块740,用于接收所述服务器800发送的鉴权响应,所述鉴权响应中携带第二密文,所述第二密文是采用所述临时密钥对会话密钥加密得到的密文。其中,所述会话密钥用于对会话的数据加密。The
第一解密模块750,用于采用所述临时密钥对所述第二密文解密,得到所述会话密钥。The
可选地,所述鉴权响应中还携带密钥标识,所述密钥标识用于标识所述会话密钥。Optionally, the authentication response further carries a key identifier, where the key identifier is used to identify the session key.
可选地,所述装置还包括:上行数据加密模块762和上行数据发送模块764。Optionally, the device further includes: an uplink
上行数据加密模块762,用于采用所述会话密钥对所述会话的上行数据加密,得到加密后的上行数据。The uplink
上行数据发送模块764,用于向所述服务器800发送上行数据包,所述上行数据包的包头携带所述密钥标识,所述上行数据包的包体携带所述加密后的上行数据。The uplink
可选地,所述装置还包括:下行数据接收模块766和下行数据解密模块768。Optionally, the device further includes: a downlink
下行数据接收模块766,用于接收所述服务器800发送的下行数据包,所述下行数据包的包头携带所述密钥标识,所述下行数据包的包体携带加密后的下行数据。
The downlink
下行数据解密模块768,用于采用与所述包头中携带的所述密钥标识相对应的会话密钥对所述加密后的下行数据解密,得到下行数据。The downlink
在一个示例中,所述密钥生成模块710,用于采用随机数生成器生成所述临时密钥。In one example, the
可选地,所述装置还包括:向量接收模块770。Optionally, the device further includes: a
向量接收模块770,用于接收所述服务器800发送的对应于所述会话密钥的初始化向量,所述初始化向量供本端采用所述会话密钥进行对称加密和解密时使用。The
服务器800可以包括密钥管理装置。该装置具有实现上述服务器侧的密钥管理方法的功能,所述功能可以通过硬件实现,也可以通过硬件执行相应的软件实现。该装置可以包括:请求接收模块810、第二解密模块820、第二加密模块840和响应发送模块850。Server 800 can include a key management device. The device has a function of implementing the above-mentioned server-side key management method, and the function may be implemented by hardware or by executing corresponding software by hardware. The apparatus may include a
请求接收模块810,用于接收客户端700发送的鉴权请求,所述鉴权请求中携带第一密文,所述第一密文是采用本端提供的公钥对临时密钥加密得到的密文。The
第二解密模块820,用于采用与所述公钥对应的私钥对所述第一密文解密,得到所述临时密钥。The
第二加密模块840,用于采用所述临时密钥对会话密钥加密,得到第二密文;其中,所述会话密钥用于对会话的数据加密。The
响应发送模块850,用于向所述客户端700发送鉴权响应,所述鉴权响应中携带所述第二密文。The
可选地,所述鉴权响应中还携带密钥标识,所述密钥标识用于标识所述会话密钥。Optionally, the authentication response further carries a key identifier, where the key identifier is used to identify the session key.
可选地,所述装置还包括:密钥获取模块830。Optionally, the device further includes: a
所述密钥获取模块830,用于获取会话密钥和密钥标识。The key obtaining
在一个示例中,所述密钥获取模块830,用于采用随机数生成器生成所述会话密钥,生成对应于所述会话密钥的密钥标识。In an example, the key obtaining
在另一示例中,所述密钥获取模块830,用于从预存密钥中选取一组对应的会话密钥和密钥标识。其中,所述预存密钥中包括至少一组对应的会话密钥和密钥标识。In another example, the key obtaining
可选地,所述密钥获取模块830,包括:地址获取单元、范围确定单元和
密钥选取单元。Optionally, the key obtaining
地址获取单元,用于获取所述客户端700对应的IP地址。An address obtaining unit is configured to obtain an IP address corresponding to the client 700.
范围确定单元,用于根据所述IP地址确定密钥选取范围,所述密钥选取范围包括所述预存密钥中的部分相对应的会话密钥和密钥标识。a range determining unit, configured to determine a key selection range according to the IP address, where the key selection range includes a part of the session key and a key identifier corresponding to the pre-stored key.
密钥选取单元,用于从所述密钥选取范围中选取一组对应的会话密钥和密钥标识。The key selection unit is configured to select a corresponding set of session keys and key identifiers from the key selection range.
可选地,所述装置还包括:上行数据接收模块862和上行数据解密模块864。Optionally, the device further includes: an uplink
上行数据接收模块862,用于接收所述客户端700发送的上行数据包,所述上行数据包的包头携带所述密钥标识,所述上行数据包的包体携带加密后的上行数据。The uplink
上行数据解密模块864,用于采用与所述包头中携带的所述密钥标识相对应的会话密钥对所述加密后的上行数据解密,得到上行数据。The uplink
可选地,所述装置还包括:下行数据加密模块866和下行数据发送模块868。Optionally, the device further includes: a downlink
下行数据加密模块866,用于采用所述会话密钥对所述会话的下行数据加密,得到加密后的下行数据。The downlink
下行数据发送模块868,用于向所述客户端700发送下行数据包,所述下行数据包的包头携带所述密钥标识,所述下行数据包的包体携带所述加密后的下行数据。The downlink
可选地,所述装置还包括:标识获取模块812和次数获取模块814。Optionally, the device further includes: an
标识获取模块812,用于获取所述客户端700所在设备对应的GUID。The
次数获取模块814,用于获取所述GUID对应的鉴权请求次数。The
所述第二解密模块820,还用于当所述鉴权请求次数小于预设阈值时,采用与所述公钥对应的私钥对所述第一密文解密,得到所述临时密钥。The
可选地,所述装置还包括:向量获取模块870和向量发送模块880。Optionally, the device further includes: a
向量获取模块870,用于获取对应于所述会话密钥的初始化向量。The
向量发送模块880,用于向所述客户端700发送所述初始化向量,所述初始化向量供所述客户端700采用所述会话密钥进行对称加密和解密时使用。The
综上所述,本实施例提供的系统,通过客户端采用非对称加密方式对临时密钥加密后发送给服务器,服务器解密得到临时密钥后,采用该临时密钥对会 话密钥加密得到第二密文,并将第二密文发送给客户端,客户端采用临时密钥对第二密文解密,得到会话密钥,以便于客户端后续在与服务器进行会话时,采用会话密钥对会话的数据进行加解密;解决了相关技术中由于客户端与服务器之间的会话数量相当庞大,导致服务器需要耗费大量的资源来管理对称密钥的问题;相较于相关技术直接采用由客户端生成的对称密钥对会话的数据进行加解密,本发明实施例采用由服务器提供的会话密钥对会话的数据进行加解密,使得服务器仅需管理会话密钥即可,无需对大量客户端生成的密钥进行管理,从而简化了服务器对密钥进行管理的复杂度,且有助于节省服务器的资源。并且,由于会话密钥并不直接在网络上明文传输,其采用临时密钥加密后传输,因此安全性也得到保证。In summary, the system provided in this embodiment encrypts the temporary key by using the asymmetric encryption method and sends the temporary key to the server. After the server decrypts the temporary key, the temporary key pair is used. The session key is encrypted to obtain the second ciphertext, and the second ciphertext is sent to the client, and the client decrypts the second ciphertext by using the temporary key to obtain the session key, so that the client subsequently performs a session with the server. The session key is used to encrypt and decrypt the session data; the related art has a problem that the server needs to spend a large amount of resources to manage the symmetric key due to the relatively large number of sessions between the client and the server; The technology directly encrypts and decrypts the data of the session by using the symmetric key generated by the client. In the embodiment of the present invention, the session key provided by the server is used to encrypt and decrypt the session data, so that the server only needs to manage the session key. There is no need to manage a large number of client-generated keys, which simplifies the complexity of managing keys by the server and helps save server resources. Moreover, since the session key is not directly transmitted in the plaintext on the network, it is encrypted by using a temporary key, so security is also guaranteed.
需要说明的是:上述实施例提供的装置在实现其功能时,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将设备的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。另外,上述实施例提供的装置与方法实施例属于同一构思,其具体实现过程详见方法实施例,这里不再赘述。It should be noted that, when the device provided by the foregoing embodiment implements its function, only the division of each functional module described above is illustrated. In an actual application, the function distribution may be completed by different functional modules according to requirements, that is, the device is required. The internal structure is divided into different functional modules to perform all or part of the functions described above. In addition, the apparatus and method embodiments provided in the foregoing embodiments are in the same concept, and the specific implementation process is described in detail in the method embodiment, and details are not described herein again.
请参考图10,其示出了本发明一个实施例提供的终端的结构示意图。该终端用于实施上述实施例中提供的客户端侧的密钥管理方法。具体来讲:Please refer to FIG. 10, which is a schematic structural diagram of a terminal according to an embodiment of the present invention. The terminal is used to implement the client side key management method provided in the foregoing embodiment. Specifically:
终端1000可以包括RF(Radio Frequency,射频)电路1010、包括有一个或一个以上计算机可读存储介质的存储器1020、输入单元1030、显示单元1040、传感器1050、音频电路1060、WiFi(wireless fidelity,无线保真)模块1070、包括有一个或者一个以上处理核心的处理器1080、以及电源1090等部件。本领域技术人员可以理解,图10中示出的终端结构并不构成对终端的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。其中:The terminal 1000 may include an RF (Radio Frequency)
RF电路1010可用于收发信息或通话过程中,信号的接收和发送,特别地,将基站的下行信息接收后,交由一个或者一个以上处理器1080处理;另外,将涉及上行的数据发送给基站。通常,RF电路1010包括但不限于天线、至少一个放大器、调谐器、一个或多个振荡器、用户身份模块(SIM)卡、收发信机、耦合器、LNA(Low Noise Amplifier,低噪声放大器)、双工器等。此外,
RF电路1010还可以通过无线通信与网络和其他设备通信。所述无线通信可以使用任一通信标准或协议,包括但不限于GSM(Global System of Mobile communication,全球移动通讯系统)、GPRS(General Packet Radio Service,通用分组无线服务)、CDMA(Code Division Multiple Access,码分多址)、WCDMA(Wideband Code Division Multiple Access,宽带码分多址)、LTE(Long Term Evolution,长期演进)、电子邮件、SMS(Short Messaging Service,短消息服务)等。The
存储器1020可用于存储软件程序以及模块,处理器1080通过运行存储在存储器1020的软件程序以及模块,从而执行各种功能应用以及数据处理。存储器1020可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序(比如声音播放功能、图像播放功能等)等;存储数据区可存储根据终端1000的使用所创建的数据(比如音频数据、电话本等)等。此外,存储器1020可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。相应地,存储器1020还可以包括存储器控制器,以提供处理器1080和输入单元1030对存储器1020的访问。The
输入单元1030可用于接收输入的数字或字符信息,以及产生与用户设置以及功能控制有关的键盘、鼠标、操作杆、光学或者轨迹球信号输入。具体地,输入单元1030可包括图像输入设备1031以及其他输入设备1032。图像输入设备1031可以是摄像头,也可以是光电扫描设备。除了图像输入设备1031,输入单元1030还可以包括其他输入设备1032。具体地,其他输入设备1032可以包括但不限于物理键盘、功能键(比如音量控制按键、开关按键等)、轨迹球、鼠标、操作杆等中的一种或多种。
显示单元1040可用于显示由用户输入的信息或提供给用户的信息以及终端1000的各种图形用户接口,这些图形用户接口可以由图形、文本、图标、视频和其任意组合来构成。显示单元1040可包括显示面板1041,可选的,可以采用LCD(Liquid Crystal Display,液晶显示器)、OLED(Organic Light-Emitting Diode,有机发光二极管)等形式来配置显示面板1041。
终端1000还可包括至少一种传感器1050,比如光传感器、运动传感器以及其他传感器。具体地,光传感器可包括环境光传感器及接近传感器,其中,环境光传感器可根据环境光线的明暗来调节显示面板1041的亮度,接近传感
器可在终端1000移动到耳边时,关闭显示面板1041和/或背光。作为运动传感器的一种,重力加速度传感器可检测各个方向上(一般为三轴)加速度的大小,静止时可检测出重力的大小及方向,可用于识别手机姿态的应用(比如横竖屏切换、相关游戏、磁力计姿态校准)、振动识别相关功能(比如计步器、敲击)等;至于终端1000还可配置的陀螺仪、气压计、湿度计、温度计、红外线传感器等其他传感器,在此不再赘述。Terminal 1000 can also include at least one type of
音频电路1060、扬声器1061,传声器1062可提供用户与终端1000之间的音频接口。音频电路1060可将接收到的音频数据转换后的电信号,传输到扬声器1061,由扬声器1061转换为声音信号输出;另一方面,传声器1062将收集的声音信号转换为电信号,由音频电路1060接收后转换为音频数据,再将音频数据输出处理器1080处理后,经RF电路1010以发送给比如另一终端,或者将音频数据输出至存储器1020以便进一步处理。音频电路1060还可能包括耳塞插孔,以提供外设耳机与终端1000的通信。
WiFi属于短距离无线传输技术,终端1000通过WiFi模块1070可以帮助用户收发电子邮件、浏览网页和访问流式媒体等,它为用户提供了无线的宽带互联网访问。虽然图10示出了WiFi模块1070,但是可以理解的是,其并不属于终端1000的必须构成,完全可以根据需要在不改变发明的本质的范围内而省略。WiFi is a short-range wireless transmission technology, and the terminal 1000 can help users to send and receive emails, browse web pages, and access streaming media through the
处理器1080是终端1000的控制中心,利用各种接口和线路连接整个手机的各个部分,通过运行或执行存储在存储器1020内的软件程序和/或模块,以及调用存储在存储器1020内的数据,执行终端1000的各种功能和处理数据,从而对手机进行整体监控。可选的,处理器1080可包括一个或多个处理核心;优选的,处理器1080可集成应用处理器和调制解调处理器,其中,应用处理器主要处理操作系统、用户界面和应用程序等,调制解调处理器主要处理无线通信。可以理解的是,上述调制解调处理器也可以不集成到处理器1080中。The
终端1000还包括给各个部件供电的电源1090(比如电池),优选的,电源可以通过电源管理系统与处理器1080逻辑相连,从而通过电源管理系统实现管理充电、放电、以及功耗管理等功能。电源1090还可以包括一个或一个以上的直流或交流电源、再充电系统、电源故障检测电路、电源转换器或者逆变器、电源状态指示器等任意组件。The terminal 1000 also includes a power source 1090 (such as a battery) for powering various components. Preferably, the power source can be logically coupled to the
尽管未示出,终端1000还可以包括蓝牙模块等,在此不再赘述。 Although not shown, the terminal 1000 may further include a Bluetooth module or the like, and details are not described herein again.
具体在本实施例中,终端1000还包括有存储器。所述存储器中存储有至少一条指令、至少一段程序、代码集或指令集,所述至少一条指令、所述至少一段程序、所述代码集或指令集由所述处理器加载并执行以实现上述客户端侧的密钥管理方法。Specifically, in this embodiment, the terminal 1000 further includes a memory. Storing at least one instruction, at least one program, code set or instruction set in the memory, the at least one instruction, the at least one program, the code set or the instruction set being loaded and executed by the processor to implement the above Client-side key management method.
请参考图11,其示出了本发明一个实施例提供的服务器的结构示意图。该服务器用于实施上述实施例中提供的服务器侧的密钥管理方法。具体来讲:Please refer to FIG. 11 , which is a schematic structural diagram of a server according to an embodiment of the present invention. This server is used to implement the server-side key management method provided in the above embodiment. Specifically:
所述服务器1100包括中央处理单元(CPU)1101、包括随机存取存储器(RAM)1102和只读存储器(ROM)1103的系统存储器1104,以及连接系统存储器1104和中央处理单元1101的系统总线1105。所述服务器1100还包括帮助计算机内的各个器件之间传输信息的基本输入/输出系统(I/O系统)1106,和用于存储操作系统1113、应用程序1114和其他程序模块1115的大容量存储设备1107。The
所述基本输入/输出系统1106包括有用于显示信息的显示器1108和用于用户输入信息的诸如鼠标、键盘之类的输入设备1109。其中所述显示器1108和输入设备1109都通过连接到系统总线1105的输入输出控制器1110连接到中央处理单元1101。所述基本输入/输出系统1106还可以包括输入输出控制器1110以用于接收和处理来自键盘、鼠标、或电子触控笔等多个其他设备的输入。类似地,输入输出控制器1110还提供输出到显示屏、打印机或其他类型的输出设备。The basic input/
所述大容量存储设备1107通过连接到系统总线1105的大容量存储控制器(未示出)连接到中央处理单元1101。所述大容量存储设备1107及其相关联的计算机可读介质为服务器1100提供非易失性存储。也就是说,所述大容量存储设备1107可以包括诸如硬盘或者CD-ROM驱动器之类的计算机可读介质(未示出)。The
不失一般性,所述计算机可读介质可以包括计算机存储介质和通信介质。计算机存储介质包括以用于存储诸如计算机可读指令、数据结构、程序模块或其他数据等信息的任何方法或技术实现的易失性和非易失性、可移动和不可移动介质。计算机存储介质包括RAM、ROM、EPROM、EEPROM、闪存或其他固态存储其技术,CD-ROM、DVD或其他光学存储、磁带盒、磁带、磁盘存储或其他磁性存储设备。当然,本领域技术人员可知所述计算机存储介质不局
限于上述几种。上述的系统存储器1104和大容量存储设备1107可以统称为存储器。Without loss of generality, the computer readable medium can include computer storage media and communication media. Computer storage media includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Computer storage media include RAM, ROM, EPROM, EEPROM, flash memory or other solid state storage technologies, CD-ROM, DVD or other optical storage, tape cartridges, magnetic tape, magnetic disk storage or other magnetic storage devices. Of course, those skilled in the art may know that the computer storage medium is not in use.
Limited to the above several. The
根据本发明的各种实施例,所述服务器1100还可以通过诸如因特网等网络连接到网络上的远程计算机运行。也即服务器1100可以通过连接在所述系统总线1105上的网络接口单元1111连接到网络1112,或者说,也可以使用网络接口单元1111来连接到其他类型的网络或远程计算机系统(未示出)。According to various embodiments of the present invention, the
所述存储器中存储有至少一条指令、至少一段程序、代码集或指令集,所述至少一条指令、所述至少一段程序、所述代码集或指令集由所述处理器加载并执行以实现上述服务器侧的密钥管理方法。Storing at least one instruction, at least one program, code set or instruction set in the memory, the at least one instruction, the at least one program, the code set or the instruction set being loaded and executed by the processor to implement the above Key management method on the server side.
在示例性实施例中,还提供了一种计算机可读存储介质,所述存储介质中存储有至少一条指令、至少一段程序、代码集或指令集,所述至少一条指令、所述至少一段程序、所述代码集或指令集由终端的处理器加载并执行以实现上述方法实施例中终端侧的各个步骤。In an exemplary embodiment, there is also provided a computer readable storage medium having stored therein at least one instruction, at least one program, a code set or a set of instructions, the at least one instruction, the at least one program The code set or instruction set is loaded and executed by the processor of the terminal to implement the steps of the terminal side in the above method embodiment.
在示例性实施例中,还提供了一种计算机可读存储介质,所述存储介质中存储有至少一条指令、至少一段程序、代码集或指令集,所述至少一条指令、所述至少一段程序、所述代码集或指令集由服务器的处理器加载并执行以实现上述方法实施例中服务器侧的各个步骤。In an exemplary embodiment, there is also provided a computer readable storage medium having stored therein at least one instruction, at least one program, a code set or a set of instructions, the at least one instruction, the at least one program The code set or instruction set is loaded and executed by a processor of the server to implement the various steps of the server side in the above method embodiment.
可选地,上述计算机可读存储介质可以是ROM、随机存取存储器(RAM)、CD-ROM、磁带、软盘和光数据存储设备等。Alternatively, the computer readable storage medium described above may be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device.
在示例性实施例中,还提供了一种计算机程序产品,当该计算机程序产品被执行时,其用于实现上述方法实施例中终端侧的各个步骤的功能。In an exemplary embodiment, there is also provided a computer program product for performing the functions of the various steps of the terminal side in the above method embodiments when the computer program product is executed.
在示例性实施例中,还提供了一种计算机程序产品,当该计算机程序产品被执行时,其用于实现上述方法实施例中服务器侧的各个步骤的功能。In an exemplary embodiment, there is also provided a computer program product for performing the functions of the various steps on the server side of the above method embodiments when the computer program product is executed.
应当理解的是,在本文中提及的“多个”是指两个或两个以上。“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。字符“/”一般表示前后关联对象是一种“或”的关系。It should be understood that "a plurality" as referred to herein means two or more. "and/or", describing the association relationship of the associated objects, indicating that there may be three relationships, for example, A and/or B, which may indicate that there are three cases where A exists separately, A and B exist at the same time, and B exists separately. The character "/" generally indicates that the contextual object is an "or" relationship.
上述本发明实施例序号仅仅为了描述,不代表实施例的优劣。 The serial numbers of the embodiments of the present invention are merely for the description, and do not represent the advantages and disadvantages of the embodiments.
以上所述仅为本发明的示例性实施例,并不用以限制本发明,凡在本发明的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。 The above description is only exemplary embodiments of the present invention, and is not intended to limit the present invention. Any modifications, equivalents, improvements, etc., which are within the spirit and scope of the present invention, should be included in the protection of the present invention. Within the scope.
Claims (35)
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201610579122.XA CN106712932B (en) | 2016-07-20 | 2016-07-20 | Key management method, apparatus and system |
| CN201610579122.X | 2016-07-20 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2018014723A1 true WO2018014723A1 (en) | 2018-01-25 |
Family
ID=58939709
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2017/091646 Ceased WO2018014723A1 (en) | 2016-07-20 | 2017-07-04 | Key management method, apparatus, device and system |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN106712932B (en) |
| WO (1) | WO2018014723A1 (en) |
Cited By (18)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN110890968A (en) * | 2019-10-24 | 2020-03-17 | 成都卫士通信息产业股份有限公司 | Instant messaging method, device, equipment and computer readable storage medium |
| CN111368322A (en) * | 2020-03-11 | 2020-07-03 | 中电科(天津)网络信息安全有限公司 | File decryption method and device, electronic equipment and storage medium |
| CN111432373A (en) * | 2020-02-24 | 2020-07-17 | 吉利汽车研究院(宁波)有限公司 | Security authentication method and device and electronic equipment |
| CN111611577A (en) * | 2020-05-22 | 2020-09-01 | 北京金山云网络技术有限公司 | Authentication method, device, system, electronic equipment and computer readable storage medium |
| CN111683099A (en) * | 2020-06-11 | 2020-09-18 | 杭州海兴电力科技股份有限公司 | Data communication method, device and equipment |
| CN112073192A (en) * | 2020-09-07 | 2020-12-11 | 北京天融信网络安全技术有限公司 | Data processing method and device and cipher machine |
| CN112398832A (en) * | 2020-11-04 | 2021-02-23 | 四川长虹电器股份有限公司 | Service end user data encryption method and decryption method |
| CN112564901A (en) * | 2020-12-08 | 2021-03-26 | 浙江三维万易联科技有限公司 | Key generation method and system, storage medium and electronic device |
| CN112769560A (en) * | 2020-12-31 | 2021-05-07 | 中国农业银行股份有限公司 | Key management method and related device |
| CN114095152A (en) * | 2020-08-03 | 2022-02-25 | 天翼电子商务有限公司 | Method, system, medium and apparatus for updating key and encrypting and decrypting data |
| CN114374512A (en) * | 2022-01-10 | 2022-04-19 | 梵迩佳智能电气有限公司 | Unmanned aerial vehicle communication method based on quantum strategy |
| CN115348011A (en) * | 2022-07-21 | 2022-11-15 | 中国电信股份有限公司 | Key processing method and device, electronic equipment and readable storage medium |
| CN115633348A (en) * | 2022-10-24 | 2023-01-20 | 成都卫士通信息产业股份有限公司 | A data transmission method, device, equipment and storage medium |
| CN115766002A (en) * | 2022-11-15 | 2023-03-07 | 中电信量子科技有限公司 | A Method for Encrypting and Decrypting Ethernet Data Using Quantum Key Distribution and Software Definition |
| CN115801308A (en) * | 2022-09-16 | 2023-03-14 | 北京瑞莱智慧科技有限公司 | Data processing method, related device and storage medium |
| CN116032556A (en) * | 2022-12-13 | 2023-04-28 | 支付宝(杭州)信息技术有限公司 | Key negotiation method and device for applet application |
| CN117034309A (en) * | 2023-07-20 | 2023-11-10 | 北京理房通支付科技有限公司 | User password management method, computer device and storage medium |
| CN118233097A (en) * | 2024-05-22 | 2024-06-21 | 中国电信股份有限公司 | Key negotiation method, device, related equipment and computer program product |
Families Citing this family (31)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN106712932B (en) * | 2016-07-20 | 2019-03-19 | 腾讯科技(深圳)有限公司 | Key management method, apparatus and system |
| CN107493281A (en) * | 2017-08-16 | 2017-12-19 | 海信集团有限公司 | encryption communication method and device |
| CN109698935A (en) * | 2017-10-24 | 2019-04-30 | 中国移动通信有限公司研究院 | Monitor video encrypting and decrypting method and device, equipment, storage medium, system |
| CN107896147B (en) * | 2017-12-07 | 2020-07-28 | 福建联迪商用设备有限公司 | Method and system for negotiating temporary session key based on national cryptographic algorithm |
| CN109962767A (en) * | 2017-12-25 | 2019-07-02 | 航天信息股份有限公司 | A kind of safety communicating method |
| CN108566365B (en) * | 2018-01-22 | 2020-09-22 | 成都清轻信息技术有限公司 | Intelligent door lock opening method based on sound wave technology |
| CN109150865A (en) * | 2018-08-07 | 2019-01-04 | 厦门市美亚柏科信息股份有限公司 | A kind of protection, device and the storage medium of mobile terminal APP communications protocol |
| CN109067814B (en) * | 2018-10-31 | 2021-04-20 | 苏州科达科技股份有限公司 | Media data encryption method, system, device and storage medium |
| CN109547471B (en) * | 2018-12-24 | 2021-10-26 | 武汉船舶通信研究所(中国船舶重工集团公司第七二二研究所) | Network communication method and device |
| CN109831432B (en) * | 2019-01-30 | 2021-06-01 | 重庆农村商业银行股份有限公司 | Third-party secure access method in application form of service provider H5 |
| CN110601825B (en) * | 2019-08-29 | 2022-09-30 | 北京思源理想控股集团有限公司 | Ciphertext processing method and device, storage medium and electronic device |
| CN110688646B (en) * | 2019-10-14 | 2021-12-03 | 广州麦仑信息科技有限公司 | Multi-server cluster security authentication method applied to palm vein recognition |
| CN110995685B (en) * | 2019-11-26 | 2022-07-19 | 中国银联股份有限公司 | Data encryption and decryption method, device, system and storage medium |
| CN111080299B (en) * | 2019-12-27 | 2020-12-15 | 广州骏伯网络科技有限公司 | Anti-repudiation method for transaction information, client and server |
| JP7451738B2 (en) | 2020-02-29 | 2024-03-18 | ホアウェイ・テクノロジーズ・カンパニー・リミテッド | Key update method and related devices |
| CN111431890B (en) * | 2020-03-20 | 2021-12-03 | 苏州瑞立思科技有限公司 | Low-overhead intermediate server proxy transmission authentication method and device |
| CN111951463B (en) * | 2020-06-05 | 2022-08-19 | 陶源 | Vending machine activation system and vending machine offline vending method |
| CN111865956A (en) * | 2020-07-13 | 2020-10-30 | 杭州萤石软件有限公司 | System, method, device and storage medium for preventing service hijacking |
| CN111988299A (en) * | 2020-08-14 | 2020-11-24 | 杭州视洞科技有限公司 | Method for establishing trusted link between client and server |
| CN114697008B (en) * | 2020-12-30 | 2024-03-12 | 科大国盾量子技术股份有限公司 | Communication system and method based on quantum security SIM card, quantum security SIM card and key service platform |
| CN114915964B (en) * | 2021-01-29 | 2025-09-16 | 华为技术有限公司 | Key negotiation method and electronic equipment |
| CN113489706B (en) * | 2021-06-30 | 2023-10-10 | 北京达佳互联信息技术有限公司 | Data processing method, device, system, equipment and storage medium |
| CN113691502B (en) * | 2021-08-02 | 2023-06-30 | 上海浦东发展银行股份有限公司 | Communication method, device, gateway server, client and storage medium |
| CN115706929A (en) * | 2021-08-05 | 2023-02-17 | 中移(上海)信息通信科技有限公司 | Vehicle road information interaction method, system and related equipment |
| CN114401102A (en) * | 2021-11-29 | 2022-04-26 | 南威软件股份有限公司 | HTTP request parameter encryption scheme based on cryptographic algorithm |
| CN114499836B (en) * | 2021-12-29 | 2024-07-16 | 北京像素软件科技股份有限公司 | Key management method, device, computer equipment and readable storage medium |
| CN116094763A (en) * | 2022-12-07 | 2023-05-09 | 天翼云科技有限公司 | Internet surfing behavior management and control method and system based on cloud mobile phone |
| US20240303638A1 (en) * | 2023-03-08 | 2024-09-12 | Capital One Services, Llc | Systems and methods for secure authentication of contactless card |
| CN116112152B (en) * | 2023-04-11 | 2023-06-02 | 广东徐工汉云工业互联网有限公司 | Data sharing security encryption method and device across enterprise network |
| CN118449965A (en) * | 2023-05-18 | 2024-08-06 | 洪碧群 | Method for uploading massive data to big data blockchain cloud platform |
| CN116436710B (en) * | 2023-06-15 | 2023-08-29 | 烟台岸基网络科技有限公司 | Port Bridge Handling Equipment Operation Remote Operating System |
Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN103532714A (en) * | 2012-07-06 | 2014-01-22 | 中国银联股份有限公司 | Method and system for transmitting data from data provider to intelligent card |
| CN103595718A (en) * | 2013-11-15 | 2014-02-19 | 拉卡拉支付有限公司 | POS terminal and method, system and service platform for activating same |
| CN104519013A (en) * | 2013-09-27 | 2015-04-15 | 华为技术有限公司 | Method and system for ensuring security of media stream, and device |
| CN105307160A (en) * | 2015-09-29 | 2016-02-03 | 北京元心科技有限公司 | Data transmission method and device by use of Wi-Fi network |
| CN106712932A (en) * | 2016-07-20 | 2017-05-24 | 腾讯科技(深圳)有限公司 | Secret key management method, device and system |
-
2016
- 2016-07-20 CN CN201610579122.XA patent/CN106712932B/en active Active
-
2017
- 2017-07-04 WO PCT/CN2017/091646 patent/WO2018014723A1/en not_active Ceased
Patent Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN103532714A (en) * | 2012-07-06 | 2014-01-22 | 中国银联股份有限公司 | Method and system for transmitting data from data provider to intelligent card |
| CN104519013A (en) * | 2013-09-27 | 2015-04-15 | 华为技术有限公司 | Method and system for ensuring security of media stream, and device |
| CN103595718A (en) * | 2013-11-15 | 2014-02-19 | 拉卡拉支付有限公司 | POS terminal and method, system and service platform for activating same |
| CN105307160A (en) * | 2015-09-29 | 2016-02-03 | 北京元心科技有限公司 | Data transmission method and device by use of Wi-Fi network |
| CN106712932A (en) * | 2016-07-20 | 2017-05-24 | 腾讯科技(深圳)有限公司 | Secret key management method, device and system |
Cited By (30)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN110890968B (en) * | 2019-10-24 | 2022-08-23 | 成都卫士通信息产业股份有限公司 | Instant messaging method, device, equipment and computer readable storage medium |
| CN110890968A (en) * | 2019-10-24 | 2020-03-17 | 成都卫士通信息产业股份有限公司 | Instant messaging method, device, equipment and computer readable storage medium |
| US20230123241A1 (en) | 2020-02-24 | 2023-04-20 | Zhejiang Geely Holding Group Co., Ltd | Security authentication method and apparatus thereof, and electronic device |
| US11924635B2 (en) | 2020-02-24 | 2024-03-05 | Zhejiang Geely Holding Group Co., Ltd | Security authentication method and apparatus thereof, and electronic device |
| CN111432373B (en) * | 2020-02-24 | 2022-08-30 | 吉利汽车研究院(宁波)有限公司 | Security authentication method and device and electronic equipment |
| CN111432373A (en) * | 2020-02-24 | 2020-07-17 | 吉利汽车研究院(宁波)有限公司 | Security authentication method and device and electronic equipment |
| CN111368322B (en) * | 2020-03-11 | 2022-04-12 | 中电科(天津)网络信息安全有限公司 | File decryption method and device, electronic equipment and storage medium |
| CN111368322A (en) * | 2020-03-11 | 2020-07-03 | 中电科(天津)网络信息安全有限公司 | File decryption method and device, electronic equipment and storage medium |
| CN111611577B (en) * | 2020-05-22 | 2023-10-03 | 北京金山云网络技术有限公司 | Authentication method, authentication device, authentication system, electronic equipment and computer readable storage medium |
| CN111611577A (en) * | 2020-05-22 | 2020-09-01 | 北京金山云网络技术有限公司 | Authentication method, device, system, electronic equipment and computer readable storage medium |
| CN111683099A (en) * | 2020-06-11 | 2020-09-18 | 杭州海兴电力科技股份有限公司 | Data communication method, device and equipment |
| CN114095152A (en) * | 2020-08-03 | 2022-02-25 | 天翼电子商务有限公司 | Method, system, medium and apparatus for updating key and encrypting and decrypting data |
| CN112073192B (en) * | 2020-09-07 | 2023-01-10 | 北京天融信网络安全技术有限公司 | Data processing method and device and cipher machine |
| CN112073192A (en) * | 2020-09-07 | 2020-12-11 | 北京天融信网络安全技术有限公司 | Data processing method and device and cipher machine |
| CN112398832A (en) * | 2020-11-04 | 2021-02-23 | 四川长虹电器股份有限公司 | Service end user data encryption method and decryption method |
| CN112398832B (en) * | 2020-11-04 | 2022-02-01 | 四川长虹电器股份有限公司 | Service end user data encryption method and decryption method |
| CN112564901A (en) * | 2020-12-08 | 2021-03-26 | 浙江三维万易联科技有限公司 | Key generation method and system, storage medium and electronic device |
| CN112564901B (en) * | 2020-12-08 | 2023-08-25 | 三维通信股份有限公司 | Method and system for generating secret key, storage medium and electronic device |
| CN112769560A (en) * | 2020-12-31 | 2021-05-07 | 中国农业银行股份有限公司 | Key management method and related device |
| CN112769560B (en) * | 2020-12-31 | 2023-03-24 | 中国农业银行股份有限公司 | Key management method and related device |
| CN114374512A (en) * | 2022-01-10 | 2022-04-19 | 梵迩佳智能电气有限公司 | Unmanned aerial vehicle communication method based on quantum strategy |
| CN115348011B (en) * | 2022-07-21 | 2024-04-30 | 中国电信股份有限公司 | Key processing method and device, electronic equipment and readable storage medium |
| CN115348011A (en) * | 2022-07-21 | 2022-11-15 | 中国电信股份有限公司 | Key processing method and device, electronic equipment and readable storage medium |
| CN115801308A (en) * | 2022-09-16 | 2023-03-14 | 北京瑞莱智慧科技有限公司 | Data processing method, related device and storage medium |
| CN115801308B (en) * | 2022-09-16 | 2023-08-29 | 北京瑞莱智慧科技有限公司 | Data processing method, related device and storage medium |
| CN115633348A (en) * | 2022-10-24 | 2023-01-20 | 成都卫士通信息产业股份有限公司 | A data transmission method, device, equipment and storage medium |
| CN115766002A (en) * | 2022-11-15 | 2023-03-07 | 中电信量子科技有限公司 | A Method for Encrypting and Decrypting Ethernet Data Using Quantum Key Distribution and Software Definition |
| CN116032556A (en) * | 2022-12-13 | 2023-04-28 | 支付宝(杭州)信息技术有限公司 | Key negotiation method and device for applet application |
| CN117034309A (en) * | 2023-07-20 | 2023-11-10 | 北京理房通支付科技有限公司 | User password management method, computer device and storage medium |
| CN118233097A (en) * | 2024-05-22 | 2024-06-21 | 中国电信股份有限公司 | Key negotiation method, device, related equipment and computer program product |
Also Published As
| Publication number | Publication date |
|---|---|
| CN106712932A (en) | 2017-05-24 |
| CN106712932B (en) | 2019-03-19 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| WO2018014723A1 (en) | Key management method, apparatus, device and system | |
| CN111193695B (en) | Encryption method and device for third party account login and storage medium | |
| US11582579B2 (en) | Secure streaming of real-time location data between electronic devices | |
| US11177955B2 (en) | Device-to-device messaging protocol | |
| CN106686008B (en) | Information storage means and device | |
| US10491399B2 (en) | Cryptographic method for secure communications | |
| US20230421394A1 (en) | Secure authentication of remote equipment | |
| US10601590B1 (en) | Secure secrets in hardware security module for use by protected function in trusted execution environment | |
| EP3605989A1 (en) | Information sending method, information receiving method, apparatus, and system | |
| CN108989848A (en) | A kind of acquisition methods and management system of video resource file | |
| CN111835774B (en) | Data processing method, apparatus, equipment and storage medium | |
| WO2017041599A1 (en) | Service processing method and electronic device | |
| US10454905B2 (en) | Method and apparatus for encrypting and decrypting picture, and device | |
| CN112866981B (en) | Method and device for managing subscription data | |
| WO2018201991A1 (en) | Data processing method, system, apparatus, storage medium, and device | |
| EP4336393A1 (en) | Security authentication method, readable medium, and electronic device | |
| CN113434905B (en) | Data transmission method and device, computer equipment and storage medium | |
| CN112533202A (en) | Identity authentication method and device | |
| CN105515757B (en) | Security information exchange device based on credible performing environment | |
| CN114553612B (en) | Data encryption and decryption method and device, storage medium and electronic equipment | |
| CN111193704B (en) | HTTP communication method, device and readable storage medium | |
| JP7366115B2 (en) | Delivering notifications to mobile devices | |
| CN113905258B (en) | Video playback method, network equipment and storage medium | |
| CN112995322B (en) | Method, device, storage medium and terminal for establishing information transmission channel | |
| WO2025139068A1 (en) | Ranging positioning method, positioning system, chip and storage medium |
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: 17830357 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: 17830357 Country of ref document: EP Kind code of ref document: A1 |