Communication mode switching method, apparatus and electronic device

CN117527337BActive Publication Date: 2026-10-27BEIJING SMARTCHIP MICROELECTRONICS TECHNOLOGY CO LTD +2
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311457130.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-11-03
Publication Date
2026-10-27
Estimated Expiration
2043-11-03

AI Technical Summary

Technical Problem

[0004]本发明实施例的目的是提供一种通信方式切换方法、一种通信方式切换装置和一种电子设备,用以解决当密码服务出现异常情况时,主站侧一般都是将通信方式切换指令通过明文的方式下发给终端,终端收到通信方式切换指令直接切换通信方式,这样就会导致主站与终端之间通信方式切换不安全,非法的主站或者终端可以入侵到系统中完成数据的窃取的缺陷

Benefits of technology

[0053]通过上述技术方案,本发明的终端在服务器的密码服务异常的情况下,接收所述服务器发送的明文通信控制码;通过所述安全芯片对所述明文通信控制码进行解密,对比解密得到的第一随机数和所述安全芯片发送的随机数;在对比结果为相同的情况下,基于所述明文通信指令与所述服务器进行明文通信。相比服务器侧一般都是将通信方式切换指令通过明文的方式下发给终端,终端收到通信方式切换指令直接切换通信方式,本发明实施例的终端通过对比从明文通信控制码解密得到的第一随机数和所述安全芯片发送的随机数,实现对发送明文通信指令的服务器进行安全性验证,在验证通过的情况下才将通信方式切换为明文通信,完成通信方式的安全切换,从而避免非法的服务器或者终端可以入侵到系统中完成数据的窃取。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117527337B_ABST
    Figure CN117527337B_ABST
Patent Text Reader

Abstract

The application provides a communication mode switching method, device and electronic equipment, and belongs to the technical field of communication. The method comprises the following steps: in the case that the password service of a server is abnormal, receiving a plaintext communication control code sent by the server; decrypting the plaintext communication control code through a security chip to obtain a plaintext communication instruction and a first random number; comparing the first random number with a random number sent by the security chip; and in the case that the comparison result is the same, performing plaintext communication with the server based on the plaintext communication instruction. The terminal of the application compares the first random number obtained by decrypting the plaintext communication control code with the random number sent by the security chip, performs security verification on the server sending the plaintext communication instruction, and switches the communication mode to plaintext communication only in the case that the verification is passed, so that the security switching of the communication mode is completed, and thus the illegal server or terminal can be prevented from invading the system to steal data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of communication technology, and more specifically to a communication mode switching method, a communication mode switching device, and an electronic device. Background Technology

[0002] With the rapid development of communication technology, maintaining the security of data transmission between the master station (server) and the terminal, and preventing data from being illegally intercepted and forged during transmission, has become a key concern. Currently, the main approach is for the master station to invoke a cryptographic service, while the terminal embeds a security chip. The cryptographic service and the security chip use a built-in or negotiated key, employing a specific encryption algorithm to encrypt and protect the transmitted data, thereby ensuring secure data transmission between the master station and the terminal.

[0003] The existing implementation involves the master station invoking a cryptographic service to communicate with the terminal via encrypted messages. When the cryptographic service malfunctions, encrypted communication between the master station and the terminal ceases. To avoid disrupting existing business operations, the master station needs to instruct the terminal to switch to plaintext communication. The master station typically sends the communication mode switching command to the terminal in plaintext. Upon receiving the command, the terminal directly switches its communication mode. This insecure communication mode switching between the master station and the terminal allows unauthorized access by the master station or terminal to steal data. Summary of the Invention

[0004] The purpose of this invention is to provide a communication mode switching method, a communication mode switching device, and an electronic device to address the problem that when an abnormal situation occurs in the cryptographic service, the master station usually sends the communication mode switching instruction to the terminal in plaintext. Upon receiving the instruction, the terminal directly switches the communication mode, which leads to insecure communication mode switching between the master station and the terminal. This allows unauthorized master stations or terminals to intrude into the system and steal data.

[0005] To achieve the above objectives, embodiments of the present invention provide a communication mode switching method applied to a terminal, the terminal including a security chip for data decryption and data encryption, the method comprising:

[0006] In the event of an abnormal password service on the server, the server receives a plaintext communication control code sent by the server. The plaintext communication control code is generated by the server based on a random number ciphertext sent by the terminal when the password service is normal. The random number ciphertext is generated by the terminal based on a random number sent by the security chip.

[0007] The plaintext communication control code is decrypted using the security chip to obtain the plaintext communication instruction and the first random number;

[0008] Compare the first random number with the random number sent by the security chip;

[0009] If the comparison results are the same, plaintext communication is performed with the server based on the plaintext communication instructions.

[0010] Optionally, after the step of communicating with the server in plaintext based on the plaintext communication command, the method further includes:

[0011] Once the server's password service is restored to normal, the server receives a ciphertext communication control code sent by the server; the ciphertext communication control code is generated by the server based on the random number ciphertext.

[0012] The encrypted communication control code is decrypted using the security chip to obtain the encrypted communication command and a second random number.

[0013] Compare the second random number with the random number sent by the security chip;

[0014] If the comparison results are the same, encrypted communication is performed with the server based on the encrypted communication instructions.

[0015] Optionally, the random number ciphertext is generated based on the following steps:

[0016] Obtain the random number sent by the security chip;

[0017] The random number is encrypted using the encryption key of the security chip to obtain the ciphertext of the random number.

[0018] On the other hand, embodiments of the present invention also provide a communication mode switching method applied to a server, the method comprising:

[0019] When the server's password service is functioning normally, the receiving terminal sends a random number ciphertext; the random number ciphertext is generated by the terminal based on a random number sent by the security chip;

[0020] The first random number is obtained by decrypting the ciphertext of the random number using a cryptographic service.

[0021] The first random number and the plaintext communication command are encrypted using cryptographic services to obtain the plaintext communication control code;

[0022] Store the ciphertext of the random number and the plaintext communication control code;

[0023] In the event of a malfunction in the server's password service, the plaintext communication control code is sent to the terminal so that the terminal switches the communication mode to plaintext communication based on the plaintext communication control code.

[0024] Optionally, after the step of sending the plaintext communication control code to the terminal in the event of a malfunction in the server's password service, the method further includes:

[0025] Once the server's password service is restored to normal, the ciphertext of the random number is decrypted through the password service to obtain the second random number;

[0026] The second random number and the ciphertext communication command are encrypted using a cryptographic service to obtain the ciphertext communication control code;

[0027] The encrypted communication control code is sent to the terminal so that the terminal switches the communication mode to encrypted communication based on the encrypted communication control code.

[0028] On the other hand, embodiments of the present invention also provide a communication mode switching device applied to a terminal, the terminal including a security chip for data decryption and data encryption, the device including:

[0029] The first data receiving module is used to receive a plaintext communication control code sent by the server when the server's password service is abnormal; the plaintext communication control code is generated by the server based on a random number ciphertext sent by the terminal when the password service is normal; the random number ciphertext is generated by the terminal based on a random number sent by the security chip.

[0030] The first decryption module is used to decrypt the plaintext communication control code through the security chip to obtain the plaintext communication instruction and the first random number;

[0031] The first comparison module is used to compare the first random number with the random number sent by the security chip;

[0032] The first switching module is used to communicate with the server in plaintext based on the plaintext communication command when the comparison results are the same.

[0033] Optionally, the device further includes:

[0034] The second data receiving module is used to receive the encrypted communication control code sent by the server when the server's password service is restored to normal; the encrypted communication control code is generated by the server based on the random number ciphertext.

[0035] The second decryption module is used to decrypt the encrypted communication control code through the security chip to obtain the encrypted communication instruction and the second random number.

[0036] The second comparison module is used to compare the second random number with the random number sent by the security chip;

[0037] The second switching module is used to perform encrypted communication with the server based on the encrypted communication command when the comparison results are the same.

[0038] Optionally, the random number ciphertext is generated based on the following module:

[0039] The data module is used to acquire random numbers sent by the security chip;

[0040] An encryption module is used to encrypt the random number using the encryption key of the security chip to obtain the ciphertext of the random number.

[0041] On the other hand, embodiments of the present invention also provide a communication mode switching device, applied to a server, the device comprising:

[0042] The third data receiving module is used to receive random number ciphertext sent by the terminal when the server's password service is normal; the random number ciphertext is generated by the terminal based on the random number sent by the security chip.

[0043] The third decryption module is used to decrypt the random number ciphertext through a cryptographic service to obtain the first random number;

[0044] The first encryption module is used to encrypt the first random number and the plaintext communication instruction through a cryptographic service to obtain the plaintext communication control code;

[0045] A storage module is used to store the ciphertext of the random number and the plaintext communication control code;

[0046] The third switching module is used to send the plaintext communication control code to the terminal in the event of an abnormality in the server's password service, so that the terminal can switch the communication mode to plaintext communication based on the plaintext communication control code.

[0047] Optionally, the device further includes:

[0048] The fourth decryption module is used to decrypt the ciphertext of the random number through the password service to obtain the second random number when the server's password service is restored to normal.

[0049] The second encryption module is used to encrypt the second random number and the ciphertext communication instruction through a cryptographic service to obtain the ciphertext communication control code;

[0050] The data transmission module is used to send the encrypted communication control code to the terminal, so that the terminal switches the communication mode to encrypted communication based on the encrypted communication control code.

[0051] On the other hand, the present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the above-mentioned communication mode switching method.

[0052] On the other hand, the present invention also provides a machine-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the above-described communication mode switching method.

[0053] Through the above technical solution, the terminal of this invention receives a plaintext communication control code sent by the server when the server's password service is abnormal; the security chip decrypts the plaintext communication control code, and compares the first random number obtained from the decryption with the random number sent by the security chip; if the comparison result is the same, plaintext communication is performed with the server based on the plaintext communication instruction. Compared to the server side typically sending communication mode switching instructions to the terminal in plaintext, and the terminal directly switching the communication mode upon receiving the instruction, the terminal in this embodiment of the invention performs security verification on the server sending the plaintext communication instruction by comparing the first random number obtained from the decryption of the plaintext communication control code with the random number sent by the security chip. Only when the verification is successful does the communication mode switch to plaintext communication, completing a secure switching of the communication mode, thereby preventing unauthorized servers or terminals from intruding into the system and stealing data.

[0054] Other features and advantages of the embodiments of the present invention will be described in detail in the following detailed description section. Attached Figure Description

[0055] The accompanying drawings are provided to further illustrate embodiments of the present invention and form part of the specification. They are used together with the following detailed description to explain the embodiments of the present invention, but do not constitute a limitation thereof. In the drawings:

[0056] Figure 1 This is one of the flowcharts illustrating the communication mode switching method provided by the present invention;

[0057] Figure 2 This is a schematic diagram of server and terminal communication provided by the present invention;

[0058] Figure 3 This is the second flowchart illustrating the communication mode switching method provided by the present invention;

[0059] Figure 4 This is the third flowchart of the communication mode switching method provided by the present invention;

[0060] Figure 5 This is the fourth flowchart of the communication mode switching method provided by the present invention;

[0061] Figure 6 This is the fifth flowchart illustrating the communication mode switching method provided by the present invention;

[0062] Figure 7 This is one of the structural schematic diagrams of the communication mode switching device provided by the present invention;

[0063] Figure 8 This is the second schematic diagram of the communication mode switching device provided by the present invention;

[0064] Figure 9 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation

[0065] The specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are for illustration and explanation only and are not intended to limit the scope of the present invention.

[0066] Method Implementation Examples

[0067] Please refer to Figure 1 This invention provides a communication mode switching method applied to a terminal, the terminal including a security chip for data decryption and data encryption. Referring to Table 1, the security chip has a security chip key. The security chip key includes an encryption key and a decryption key. The encryption key has a corresponding key ID (e.g., 01), and the dispersion factor of the encryption key is the chip serial number of the security chip. The encryption key is used for encryption when the terminal uploads data to a server. The decryption key also has a corresponding key ID (e.g., 02), and the dispersion factor of the decryption key is the chip serial number of the security chip. The decryption key is used for decryption when the terminal receives data from the server.

[0068] Table 1

[0069]

[0070] The communication mode switching method of this invention includes:

[0071] Step 101: In the event of an abnormal password service on the server, receive the plaintext communication control code sent by the server.

[0072] In this embodiment of the invention, when the server's password service malfunctions, the terminal receives a plaintext communication control code sent by the server. This plaintext communication control code is generated by the server based on a random number ciphertext sent by the terminal when the password service is functioning normally. For example, the plaintext communication control code is generated by the server by invoking the password service based on the random number ciphertext when the password service is functioning normally. The random number ciphertext is generated by the terminal based on a random number sent by the security chip during the registration phase. The random number can be any natural number.

[0073] In one embodiment, please refer to Figure 2 and Figure 3 The random number ciphertext is generated based on the following steps:

[0074] Step 1: Obtain the random number sent by the security chip;

[0075] Step 2: Encrypt the random number using the encryption key of the security chip to obtain the ciphertext of the random number.

[0076] That is, the terminal obtains the random number sent by the security chip; and encrypts the random number using the encryption key 01 of the security chip to obtain the ciphertext of the random number.

[0077] Step 102: Decrypt the plaintext communication control code using the security chip to obtain the plaintext communication instruction and the first random number.

[0078] The terminal decrypts the plaintext communication control code using the security chip's decryption key 02 to obtain the plaintext communication instruction and the first random number.

[0079] Step 103: Compare the first random number with the random number sent by the security chip.

[0080] When the server's password service is functioning correctly, the terminal sends a ciphertext of a random number generated from a random number sent by the security chip to the server. The server then generates a plaintext communication control code based on this ciphertext. Therefore, by comparing the first random number used to decrypt the plaintext communication control code with the random number sent by the security chip, it can be determined whether the plaintext communication control code was sent by the server that communicated with the terminal during registration. This allows for security verification of the server sending the plaintext communication control code; in other words, it enables security verification of the plaintext communication control code itself.

[0081] Step 104: If the comparison results are the same, perform plaintext communication with the server based on the plaintext communication command.

[0082] If the comparison results are the same, it indicates that the plaintext communication control code was issued by the server that communicated with the terminal during terminal registration. In this case, the plaintext communication control code verification is successful, and plaintext communication is executed with the server based on the plaintext communication command. Otherwise, no processing is performed. Thus, this embodiment of the invention achieves secure switching of communication methods.

[0083] In addition, the embodiments of the present invention use a security chip to perform encryption, decryption and random number comparison functions. This method ensures that the security chip's key and random number are stored inside the security chip and do not leave the chip. External devices can only use the key and compare random numbers through the instructions specified by the chip, but cannot obtain the data. This maximizes the prevention of leakage of the security chip's key and random number, and ensures the security of communication data.

[0084] In the event of an anomaly in the server's password service, the terminal of this invention receives a plaintext communication control code sent by the server; decrypts the plaintext communication control code using the security chip, and compares the first random number obtained from the decryption with the random number sent by the security chip; if the comparison result is the same, it performs plaintext communication with the server based on the plaintext communication instruction. Compared to the server typically sending communication mode switching instructions to the terminal in plaintext, and the terminal directly switching the communication mode upon receiving the instruction, the terminal in this embodiment of the invention performs security verification on the server sending the plaintext communication instruction by comparing the first random number obtained from the decryption of the plaintext communication control code with the random number sent by the security chip. Only if the verification is successful does it switch the communication mode to plaintext communication, completing a secure switching of the communication mode, thereby preventing unauthorized servers or terminals from intruding into the system and stealing data.

[0085] For other aspects of the embodiments of the present invention, please refer to Figure 3 and Figure 4 After step 104, which involves communicating with the server in plaintext based on the plaintext communication command, the method further includes:

[0086] Step 105: After the server's password service is restored to normal, receive the encrypted communication control code sent by the server.

[0087] Once the server's password service is restored, the terminal receives a encrypted communication control code sent by the server. This encrypted communication control code is generated by the server based on the random number ciphertext. For example, the encrypted communication control code is generated by the server using the password service when the password service is functioning correctly, based on the random number ciphertext.

[0088] It should be noted that during terminal registration, the server receives and stores the random number ciphertext so that a ciphertext communication control code can be generated based on the random number ciphertext later.

[0089] Step 106: Decrypt the encrypted communication control code using the security chip to obtain the encrypted communication command and the second random number.

[0090] The terminal decrypts the encrypted communication control code through the security chip. For example, the terminal decrypts the encrypted communication control code using the security chip's decryption key 02 to obtain the encrypted communication instruction and the second random number.

[0091] Step 107: Compare the second random number with the random number sent by the security chip.

[0092] Step 108: If the comparison results are the same, perform encrypted communication with the server based on the encrypted communication command.

[0093] The terminal compares the second random number with the random number sent by the security chip. If the comparison result is the same, it indicates that the encrypted communication control code was sent by the server that communicated with the terminal during terminal registration. In this case, the encrypted communication control code verification is successful, and encrypted communication is executed with the server based on the encrypted communication command. The new plaintext communication control code and the encrypted random number are calculated and saved according to the process during terminal registration. Otherwise, no processing is performed. This achieves secure switching of the communication mode in this embodiment of the invention.

[0094] Therefore, in this embodiment of the invention, when the cryptographic service is abnormal, the terminal can receive the plaintext communication control code sent by the server, and after the terminal decrypts and verifies it, it sets the plaintext communication mode; when the cryptographic service returns to normal, the terminal receives the ciphertext communication control code sent by the server, and after the terminal decrypts and verifies it, it sets the ciphertext communication mode. This ensures the security and reliability of the communication mode switching.

[0095] Please refer to Figure 5 On the other hand, this embodiment of the invention also provides a communication mode switching method applied to a server. In this embodiment, the server can encrypt and decrypt data sent by the terminal through a cryptographic service. The cryptographic service has a cryptographic service key. Referring to Table 2, the cryptographic service key includes a decryption key and an encryption key. The decryption key has a decryption ID (e.g., 03), which is used by the server to decrypt data uploaded by the terminal. The encryption key has an encryption ID (e.g., 04), which is used by the server to encrypt data when sending it.

[0096] Table 2

[0097] 03 Decryption key none The server receives and decrypts data uploaded by the terminal. 04 Encryption Key none Encryption is used when the server sends data.

[0098] The communication mode switching method of this invention includes:

[0099] Step 201: If the server's password service is working properly, receive the random number ciphertext sent by the receiving terminal.

[0100] When the server's password service is functioning normally, the server receives ciphertext of a random number sent by the terminal. This ciphertext is generated by the terminal based on a random number sent by the security chip. In one embodiment, the terminal obtains the random number sent by the security chip and encrypts it using the security chip's encryption key 01 to obtain the ciphertext.

[0101] Step 202: Decrypt the ciphertext of the random number using the cryptographic service to obtain the first random number.

[0102] The server decrypts the ciphertext of the random number using a cryptographic service to obtain the first random number, which is the plaintext random number derived from the ciphertext. Specifically, the server can use the serial number of the terminal's security chip to distribute the decryption key 03 of the cryptographic service, and then use the distributed subkey to decrypt the ciphertext of the random number to obtain the plaintext random number (i.e., the first random number).

[0103] Step 203: Encrypt the first random number and the plaintext communication command through the cryptographic service to obtain the plaintext communication control code.

[0104] The server encrypts the first random number and the plaintext communication command using a cryptographic service to obtain the plaintext communication control code. Specifically, the server can use the chip serial number of the terminal's security chip to distribute the encryption key 04 of the cryptographic service, and then use the distributed subkey to encrypt the plaintext communication command and the first random number to obtain the plaintext communication control code.

[0105] Step 204: Store the random number ciphertext and the plaintext communication control code.

[0106] The server stores ciphertext random numbers and plaintext communication control codes.

[0107] To facilitate the server sending plaintext communication control codes to the terminal in the event of a password service failure, the server needs to store these plaintext communication control codes. In one embodiment, the server can send the plaintext communication control codes to a database for storage. In other embodiments, the server can store the plaintext communication control codes in local storage. When the server's password service fails, the server retrieves the plaintext communication control codes from local storage and then sends them to the terminal.

[0108] To facilitate the generation of encrypted communication control codes based on random number ciphertext when the server's password service is restored, the server needs to store the random number ciphertext. In one embodiment, the server can send the random number ciphertext to a database for storage. In other embodiments, the server can store the random number ciphertext in local storage. When the server's password service is restored, the server retrieves the random number ciphertext from local storage and then generates the encrypted communication control codes based on it.

[0109] Step 205: In the event of an abnormal password service on the server, the plaintext communication control code is sent to the terminal so that the terminal switches the communication mode to plaintext communication based on the plaintext communication control code.

[0110] In the event of a malfunction in the server's password service, the server retrieves a plaintext communication control code from the database or local storage and sends it to the terminal. The terminal then uses this plaintext control code to perform decryption and verification of a first random number. If the first random number matches the random number sent by the security chip, the terminal initiates plaintext communication with the server based on the plaintext communication command. This allows the terminal to switch its communication mode to plaintext based on the plaintext communication control code.

[0111] Therefore, in this embodiment of the invention, when the password service is normal, the server calculates the plaintext communication control code and the random number ciphertext through the password service during terminal registration, and stores the plaintext communication control code and the random number ciphertext. When the password service is abnormal, the server directly sends the plaintext communication control code to the terminal, so that the terminal switches the communication mode to plaintext communication based on the plaintext communication control code, thereby completing the secure switching of the communication mode.

[0112] For other aspects of the embodiments of the present invention, please refer to Figure 6 After step 205, which involves sending the plaintext communication control code to the terminal in the event of a malfunction in the server's password service, the method further includes:

[0113] Step 206: Once the server's password service is restored to normal, decrypt the ciphertext of the random number using the password service to obtain the second random number.

[0114] Once the server's password service is restored, the server decrypts the ciphertext of the random number using the password service to obtain the second random number. Specifically, the server can use the chip serial number of the terminal's security chip to distribute the decryption key 03 of the password service, and then use the distributed subkeys to decrypt the ciphertext of the random number to obtain the plaintext of the random number (i.e., the second random number).

[0115] Step 207: Encrypt the second random number and the ciphertext communication command through the cryptographic service to obtain the ciphertext communication control code.

[0116] The server encrypts the second random number and the encrypted communication command using a cryptographic service to obtain the encrypted communication control code. Specifically, the server can use the chip serial number of the terminal's security chip to distribute the encryption key 04 of the cryptographic service, and then use the distributed subkey to encrypt the encrypted communication command and the second random number to obtain the encrypted communication control code, which is then sent to the corresponding terminal.

[0117] Step 208: Send the encrypted communication control code to the terminal so that the terminal switches the communication mode to encrypted communication based on the encrypted communication control code.

[0118] The server sends a encrypted communication control code to the terminal, enabling the terminal to decrypt and verify a second random number based on the encrypted communication control code. If the second random number matches the random number sent by the security chip, the terminal initiates encrypted communication with the server based on the encrypted communication command. This allows the terminal to switch its communication mode to encrypted communication based on the encrypted communication control code.

[0119] Therefore, in this embodiment of the invention, when the cryptographic service is abnormal, the server sends a plaintext communication control code to the terminal so that the terminal can set the plaintext communication mode after decryption and verification; when the cryptographic service returns to normal, the server sends an encrypted communication control code to the terminal so that the terminal can set the encrypted communication mode after decryption and verification. This ensures the security and reliability of communication mode switching.

[0120] Device Examples

[0121] Please refer to Figure 7 On the other hand, embodiments of the present invention also provide a communication mode switching device applied to a terminal, the terminal including a security chip for data decryption and data encryption, the device including:

[0122] The first data receiving module 701 is used to receive a plaintext communication control code sent by the server when the server's password service is abnormal; the plaintext communication control code is generated by the server based on a random number ciphertext sent by the terminal when the password service is normal; the random number ciphertext is generated by the terminal based on a random number sent by the security chip.

[0123] The first decryption module 702 is used to decrypt the plaintext communication control code through the security chip to obtain the plaintext communication instruction and the first random number;

[0124] The first comparison module 703 is used to compare the first random number with the random number sent by the security chip;

[0125] The first switching module 704 is used to perform plaintext communication with the server based on the plaintext communication command when the comparison results are the same.

[0126] In the event of an anomaly in the server's password service, the terminal of this invention receives a plaintext communication control code sent by the server; decrypts the plaintext communication control code using the security chip, and compares the first random number obtained from the decryption with the random number sent by the security chip; if the comparison result is the same, it performs plaintext communication with the server based on the plaintext communication instruction. Compared to the server typically sending communication mode switching instructions to the terminal in plaintext, and the terminal directly switching the communication mode upon receiving the instruction, the terminal in this embodiment of the invention performs security verification on the server sending the plaintext communication instruction by comparing the first random number obtained from the decryption of the plaintext communication control code with the random number sent by the security chip. Only if the verification is successful does it switch the communication mode to plaintext communication, completing a secure switching of the communication mode, thereby preventing unauthorized servers or terminals from intruding into the system and stealing data.

[0127] Optionally, the device further includes:

[0128] The second data receiving module is used to receive the encrypted communication control code sent by the server when the server's password service is restored to normal; the encrypted communication control code is generated by the server based on the random number ciphertext.

[0129] The second decryption module is used to decrypt the encrypted communication control code through the security chip to obtain the encrypted communication instruction and the second random number.

[0130] The second comparison module is used to compare the second random number with the random number sent by the security chip;

[0131] The second switching module is used to perform encrypted communication with the server based on the encrypted communication command when the comparison results are the same.

[0132] Optionally, the random number ciphertext is generated based on the following module:

[0133] The data module is used to acquire random numbers sent by the security chip;

[0134] An encryption module is used to encrypt the random number using the encryption key of the security chip to obtain the ciphertext of the random number.

[0135] The communication mode switching device includes a processor and a memory. The first data receiving module, module 701, first decryption module 702, first comparison module 703 and first switching module 704 are all stored in the memory as program units. The processor executes the program units stored in the memory to realize the corresponding functions.

[0136] A processor contains a kernel, which retrieves the corresponding program units from memory. One or more kernels can be configured.

[0137] The memory may include non-permanent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.

[0138] Please refer to Figure 8 On the other hand, embodiments of the present invention also provide a communication mode switching device, applied to a server, the device comprising:

[0139] The third data receiving module 801 is used to receive random number ciphertext sent by the terminal when the server's password service is normal; the random number ciphertext is generated by the terminal based on the random number sent by the security chip.

[0140] The third decryption module 802 is used to decrypt the random number ciphertext through a cryptographic service to obtain the first random number;

[0141] The first encryption module 803 is used to encrypt the first random number and the plaintext communication instruction through a cryptographic service to obtain the plaintext communication control code;

[0142] Storage module 804 is used to store the random number ciphertext and the plaintext communication control code;

[0143] The third switching module 805 is used to send the plaintext communication control code to the terminal in the event of an abnormality in the server's password service, so that the terminal switches the communication mode to plaintext communication based on the plaintext communication control code.

[0144] Optionally, the device further includes:

[0145] The fourth decryption module is used to decrypt the ciphertext of the random number through the password service to obtain the second random number when the server's password service is restored to normal.

[0146] The second encryption module is used to encrypt the second random number and the ciphertext communication instruction through a cryptographic service to obtain the ciphertext communication control code;

[0147] The data transmission module is used to send the encrypted communication control code to the terminal, so that the terminal switches the communication mode to encrypted communication based on the encrypted communication control code.

[0148] The communication mode switching device includes a processor and a memory. The third data receiving module 801, the third decryption module 802, the first encryption module 803, the storage module 804, and the third switching module 805 are all stored in the memory as program units. The processor executes the program units stored in the memory to realize the corresponding functions.

[0149] A processor contains a kernel, which retrieves the corresponding program units from memory. One or more kernels can be configured.

[0150] The memory may include non-permanent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.

[0151] Figure 9 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 9 As shown, the electronic device may include: a processor 910, a communication interface 920, a memory 930, and a communication bus 940, wherein the processor 910, the communication interface 920, and the memory 930 communicate with each other via the communication bus 940. The processor 910 can call logical instructions in the memory 930 to execute a communication mode switching method, which includes: receiving a plaintext communication control code sent by the server when the server's password service is abnormal; the plaintext communication control code is generated by the server based on a random number ciphertext sent by the terminal when the password service is normal; the random number ciphertext is generated by the terminal based on a random number sent by the security chip; decrypting the plaintext communication control code through the security chip to obtain a plaintext communication instruction and a first random number; comparing the first random number with the random number sent by the security chip; and if the comparison result is the same, performing plaintext communication with the server based on the plaintext communication instruction. Alternatively,

[0152] When the server's cryptographic service is functioning normally, the terminal receives a random number ciphertext sent by the receiving terminal. This random number ciphertext is generated by the terminal based on a random number sent by the security chip. The ciphertext is decrypted using the cryptographic service to obtain a first random number. The first random number and a plaintext communication command are then encrypted using the cryptographic service to obtain a plaintext communication control code. The ciphertext and the plaintext communication control code are stored. In the event of an abnormality in the server's cryptographic service, the plaintext communication control code is sent to the terminal, causing the terminal to switch the communication mode to plaintext communication based on the plaintext communication control code.

[0153] Furthermore, the logical instructions in the aforementioned memory 930 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0154] In another aspect, the present invention also provides a machine-readable storage medium storing a computer program thereon. When executed by a processor, the computer program implements a method for switching communication modes. This method includes: receiving a plaintext communication control code sent by the server when the server's cryptographic service is abnormal; the plaintext communication control code is generated by the server based on ciphertext of a random number sent by a terminal when the cryptographic service is normal; the ciphertext of the random number is generated by the terminal based on a random number sent by the security chip; decrypting the plaintext communication control code through the security chip to obtain a plaintext communication instruction and a first random number; comparing the first random number with the random number sent by the security chip; and if the comparison result is the same, performing plaintext communication with the server based on the plaintext communication instruction. Alternatively,

[0155] When the server's cryptographic service is functioning normally, the terminal receives a random number ciphertext sent by the receiving terminal. This random number ciphertext is generated by the terminal based on a random number sent by the security chip. The ciphertext is decrypted using the cryptographic service to obtain a first random number. The first random number and a plaintext communication command are then encrypted using the cryptographic service to obtain a plaintext communication control code. The ciphertext and the plaintext communication control code are stored. In the event of an abnormality in the server's cryptographic service, the plaintext communication control code is sent to the terminal, causing the terminal to switch the communication mode to plaintext communication based on the plaintext communication control code.

[0156] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0157] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0158] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for switching communication modes, characterized in that, Applied to a terminal, the terminal including a security chip for data decryption and data encryption, the method includes: In the event of an abnormal password service on the server, the server receives a plaintext communication control code sent by the server. The plaintext communication control code is generated by the server based on a random number ciphertext sent by the terminal when the password service is normal. The random number ciphertext is generated by the terminal based on a random number sent by the security chip. The plaintext communication control code is decrypted using the security chip to obtain the plaintext communication instruction and the first random number; Compare the first random number with the random number sent by the security chip; If the comparison results are the same, plaintext communication is performed with the server based on the plaintext communication instructions. The plaintext communication control code is generated through the following steps: when the server's cryptographic service is normal, the server receives a random number ciphertext sent by the terminal; the server decrypts the random number ciphertext through the cryptographic service to obtain a first random number; the server encrypts the first random number and the plaintext communication instruction through the cryptographic service to obtain the plaintext communication control code.

2. The communication mode switching method according to claim 1, characterized in that, Following the step of communicating with the server in plaintext based on the plaintext communication command, the method further includes: Once the server's password service is restored to normal, the server receives a ciphertext communication control code sent by the server; the ciphertext communication control code is generated by the server based on the random number ciphertext. The encrypted communication control code is decrypted using the security chip to obtain the encrypted communication command and a second random number. Compare the second random number with the random number sent by the security chip; If the comparison results are the same, encrypted communication is performed with the server based on the encrypted communication instructions.

3. The communication mode switching method according to claim 1 or 2, characterized in that, The random number ciphertext is generated based on the following steps: Obtain the random number sent by the security chip; The random number is encrypted using the encryption key of the security chip to obtain the ciphertext of the random number.

4. A method for switching communication modes, characterized in that, Applied to a server, the method includes: When the server's password service is functioning normally, the receiving terminal sends a random number ciphertext; the random number ciphertext is generated by the terminal based on a random number sent by the security chip; The first random number is obtained by decrypting the ciphertext of the random number using a cryptographic service. The first random number and the plaintext communication command are encrypted using cryptographic services to obtain the plaintext communication control code; Store the ciphertext of the random number and the plaintext communication control code; In the event of an abnormality in the server's password service, the plaintext communication control code is sent to the terminal so that the terminal switches the communication mode to plaintext communication based on the plaintext communication control code. The terminal switching the communication mode to plaintext communication based on the plaintext communication control code includes: the terminal decrypting the plaintext communication control code through the security chip to obtain a plaintext communication instruction and a first random number; the terminal comparing the first random number with the random number sent by the security chip; if the comparison result is the same, the terminal performs plaintext communication with the server based on the plaintext communication instruction.

5. The communication mode switching method according to claim 4, characterized in that, Following the step of sending the plaintext communication control code to the terminal in the event of a server-side cryptographic service malfunction, the method further includes: Once the server's password service is restored to normal, the ciphertext of the random number is decrypted through the password service to obtain the second random number; The second random number and the ciphertext communication command are encrypted using a cryptographic service to obtain the ciphertext communication control code; The encrypted communication control code is sent to the terminal so that the terminal switches the communication mode to encrypted communication based on the encrypted communication control code.

6. A communication mode switching device, characterized in that, Applied to a terminal, the terminal including a security chip for data decryption and data encryption, the device includes: The first data receiving module is used to receive a plaintext communication control code sent by the server when the server's password service is abnormal; the plaintext communication control code is generated by the server based on a random number ciphertext sent by the terminal when the password service is normal; the random number ciphertext is generated by the terminal based on a random number sent by the security chip. The first decryption module is used to decrypt the plaintext communication control code through the security chip to obtain the plaintext communication instruction and the first random number; The first comparison module is used to compare the first random number with the random number sent by the security chip; The first switching module is used to communicate with the server in plaintext based on the plaintext communication command when the comparison results are the same. The plaintext communication control code is generated through the following steps: when the server's cryptographic service is normal, the server receives a random number ciphertext sent by the terminal; the server decrypts the random number ciphertext through the cryptographic service to obtain a first random number; the server encrypts the first random number and the plaintext communication instruction through the cryptographic service to obtain the plaintext communication control code.

7. The communication mode switching device according to claim 6, characterized in that, The device further includes: The second data receiving module is used to receive the encrypted communication control code sent by the server when the server's password service is restored to normal; the encrypted communication control code is generated by the server based on the random number ciphertext. The second decryption module is used to decrypt the encrypted communication control code through the security chip to obtain the encrypted communication instruction and the second random number. The second comparison module is used to compare the second random number with the random number sent by the security chip; The second switching module is used to perform encrypted communication with the server based on the encrypted communication command when the comparison results are the same.

8. The communication mode switching device according to claim 6 or 7, characterized in that, The random number ciphertext is generated based on the following module: The data module is used to acquire random numbers sent by the security chip; An encryption module is used to encrypt the random number using the encryption key of the security chip to obtain the ciphertext of the random number.

9. A communication mode switching device, characterized in that, Applied to a server, the device includes: The third data receiving module is used to receive random number ciphertext sent by the terminal when the server's password service is normal; the random number ciphertext is generated by the terminal based on the random number sent by the security chip. The third decryption module is used to decrypt the random number ciphertext through a cryptographic service to obtain the first random number; The first encryption module is used to encrypt the first random number and the plaintext communication instruction through a cryptographic service to obtain the plaintext communication control code; A storage module is used to store the ciphertext of the random number and the plaintext communication control code; The third switching module is used to send the plaintext communication control code to the terminal in the event of an abnormality in the server's password service, so that the terminal switches the communication mode to plaintext communication based on the plaintext communication control code. The terminal switching the communication mode to plaintext communication based on the plaintext communication control code includes: the terminal decrypting the plaintext communication control code through the security chip to obtain a plaintext communication instruction and a first random number; the terminal comparing the first random number with the random number sent by the security chip; if the comparison result is the same, the terminal performs plaintext communication with the server based on the plaintext communication instruction.

10. The communication mode switching device according to claim 9, characterized in that, The device further includes: The fourth decryption module is used to decrypt the ciphertext of the random number through the password service to obtain the second random number when the server's password service is restored to normal. The second encryption module is used to encrypt the second random number and the ciphertext communication instruction through a cryptographic service to obtain the ciphertext communication control code; The data transmission module is used to send the encrypted communication control code to the terminal, so that the terminal switches the communication mode to encrypted communication based on the encrypted communication control code.

11. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the communication mode switching method of any one of claims 1 to 3, or the communication mode switching method of any one of claims 4 to 5.

12. A machine-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the communication mode switching method of any one of claims 1 to 3, or implements the communication mode switching method of any one of claims 4 to 5.

Citation Information

Patent Citations

  • Measurement and control data transmission method and system for satellite measurement and control link

    CN115412160A

  • Encryption transmission method and system of communication message, sending terminal and receiving terminal

    CN116208949A