A network space knowledge data-based encoding and encryption method

By constructing an ASCII character encoder and encryption rules, cyberspace knowledge data is converted into printable strings and transmitted in an encrypted manner, solving the problems of information loss and insufficient security during data transmission in cyberspace, and ensuring data integrity and security.

CN114519194BActive Publication Date: 2025-12-09SUZHOU AEROSPACE INFORMATION RES INST
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111502067.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-09
Publication Date
2025-12-09
Estimated Expiration
2041-12-09

AI Technical Summary

Technical Problem

Existing technologies suffer from information loss and insufficient security in plaintext transmission during data transmission in cyberspace, especially in data transmission based on the HTTP protocol under a B/S architecture, which cannot effectively protect data integrity and security.

Method used

The method employs encoding, decoding, and encryption based on cyberspace knowledge data. By constructing an ASCII character encoder and encryption rules, the original ASCII string is converted into a printable string. The data is then transmitted using Base64 encoding and specific encryption rules. The receiving end recovers the original data by decoding and decrypting.

Benefits of technology

It enables secure transmission of ASCII strings under the HTTP protocol, ensuring data integrity and security, solving the problems of data loss and plaintext transmission, and providing efficient encoding/decoding and encryption mechanisms.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114519194B_ABST
    Figure CN114519194B_ABST
Patent Text Reader

Abstract

The application provides a coding and decoding and encryption processing method based on network space knowledge data, which encrypts and edits original ASCII strings to form ASCII plaintext transmission string arrays and keys, encodes each element in the array by using a character encoder and writes the key, obtains a printable string array, and transmits the array based on the HTTP protocol after encapsulation; the received printable string array is decoded by the receiving end to obtain the plaintext transmission string array and the key; and the plaintext transmission string array is decrypted based on the key to obtain the original ASCII string. The application can effectively ensure the integrity and security of data.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of communication transmission, in particular to a coding and decoding and encryption processing method based on network space knowledge data. BACKGROUND

[0002] At present, with the rapid development of new network information technology, network space has become a new living space created and developed by human beings, and countries around the world have realized the important strategic significance of network space and have made a lot of personnel deployment and scientific research on how to expand the strategic space. How to comprehensively perceive the targets, information and various characteristic elements existing in the network space, comprehensively analyze the network space environment, and collect the knowledge data in the network space according to the actual business needs and store and transmit them has become a hot topic at present.

[0003] The key to maintaining network space sovereignty and guarding network space key points lies in thoroughly perceiving the dynamic law of basic element information and various network space knowledge data in network space, mining the key information contained therein and storing it, sharing knowledge with various network space knowledge data perception sources, and expanding the perception and association construction of various knowledge data. However, network space is a complex giant system with heterogeneous, dynamic and multi-dimensional characteristics, which shows extremely complex characteristic attributes at different levels, space-time angles and granularities. Especially in the storage and transmission process of some important knowledge data, there are also problems of information loss and leakage to some extent, so that the encoding and encryption of network space elements and the efficient transmission are the premise for people to better understand the network space knowledge data.

[0004] In the process of traditional front-end and back-end data interaction based on B / S architecture, the data information to be transmitted is mainly converted into a binary stream for transmission according to the general conversion rule defined in ASCII code, and there are mainly two problems: 1) The front-end and back-end data communication based on B / S architecture is usually based on HTTP protocol, and since HTTP protocol is a text protocol, binary data needs to be converted into printable character data under HTTP protocol when transmitting binary data. But it is not feasible to directly use ASCII character data defined in ASCII code for transmission, because ASCII characters include control characters and printable characters, and network transmission can only transmit printable characters. 2) There is a phenomenon of plaintext transmission or some simple encoding, and the plaintext transmission and some simple encoding cannot meet the security requirements of some network space data transmission businesses at present. SUMMARY

[0005] The present application aims to provide a coding and decoding and encryption processing method based on network space knowledge data.

[0006] The technical solution to achieve the purpose of this invention is: a method for encoding, decoding, and encrypting knowledge data in cyberspace, comprising the following steps:

[0007] Step a: Build an ASCII character encoder b', which will convert the original ASCII string A into a digital string. n Encode into a printable string P m ;

[0008] Step b: Construct encryption rule m', which takes the original ASCII string A n Encryption editing is performed to form an ASCII plaintext transmission string array [C1, C2, ... C n Using the key K, each element in the array is encoded using a character encoder b' and the key is written to obtain a printable string array [C'1, C'2, ..., C']. n After encapsulation, it is transmitted based on the HTTP protocol;

[0009] Step c: Construct decoding rule c', which is performed by the receiving end on the received printable string array [C'1, C'2, ..., C'...]. n Decode the plaintext transmitted string array [C1, C2, ... C...] to obtain the plaintext transmitted string array [C1, C2, ... C...]. n and key K;

[0010] Step d: Construct decryption rule n' based on key K and plaintext transmission string array [C1, C2, ... C n Decrypt to obtain the original ASCII string A n .

[0011] Further, in step a, an ASCII character encoder b' is constructed, through which the original ASCII string A is processed. n Encode into a printable string P m The specific encoding method is as follows:

[0012] Step a-1: For the original ASCII string A n Specify A n = [x1,x2,…,x n ], where x n It represents any character in ASCII code. By looking up the basic ASCII code mapping table, x is... n Convert to 8-bit binary number xb n And form the binary string AB n =[xb1,xb2,…,xb n For ease of representation, the string AB will be represented as... n Defined in the following matrix form:

[0013]

[0014] AB n Each element in the matrix is binary number 0 or 1, xb n = [xb n,1 , xb n,2 …, xb n,8 ] is expressed as a binary array;

[0015] Step a-2: Constructing matrix AB m ', and each row has 6 elements, the elements in AB n are arranged in AB 1,1 ' matrix in the order of xb 1,2 , xb 1,8 , … xb 2,1 , xb 2,2 , xb n,8 , …, xb m , and the specific correspondence is as follows:

[0016]

[0017] After the arrangement of AB m ' matrix, 0 is added to the front of each row element to 8 bits, which is called f1, and a new matrix AB m " is formed by this method, and the form of AB m " is as follows:

[0018]

[0019] The above case is the ideal state, since AB n has 8 elements in each row, and AB m ' has only 6 elements in each row, when nmod3 = 0 in AB n , all elements can be arranged in AB m ' matrix, in other words, there are two cases of nmod3 = 1 and nmod3 = 2 that cannot be completely arranged, which will be discussed and processed as follows to meet nmod3 = 0;

[0020] 1) When nmod3 = 1

[0021] In this case, the last row of AB m ' matrix has only 2 elements, and the method of adding 0 to AB m ' matrix is used to make the total number of rows of AB m ' matrix satisfy mmod4 = 0, in other words, it also satisfies AB nThe total number of rows in the matrix, n mod 3 = 0, as shown in the following example:

[0022]

[0023] Using method f1 in step a-2, we can construct a matrix AB with 8 elements in each row. m ";

[0024] 2) When n mod 3 = 2

[0025] In this case, AB m The last row of the matrix has only 4 elements, and it is stipulated that the pair AB is used. m The method of filling the matrix with zeros makes AB m The total number of rows in the matrix satisfies mg mod 4 = 0, which means it satisfies AB. n The total number of rows in the matrix, n mod 3 = 0, as shown in the following example:

[0026]

[0027] Using method f1 in step a-2, we can construct a matrix AB with 8 elements in each row. m ";

[0028] Step a-3: By following step a-2, we can obtain the result that satisfies AB. n The total number of rows n mod 3 = 0 and AB m A matrix AB with a total number of rows m mod 4 = 0 m ", AB m "Each row in the matrix is ​​considered as an 8-bit binary sequence, represented as AB." m "=[xb1′,xb2′,...,xb m ′], where xb1′~xb m ' represents different 8-bit binary numbers, in which case AB is... m xb1′~xb in "″ m The '' symbol is converted to a decimal number. By consulting the Base64 encoding table, it is converted to the corresponding Base64 character. The characters are found in AB. n The total number of rows is n mod 3 = x and x ∈ [0,2]. The following discussion addresses each of these cases.

[0029] 1) When nmod3=0

[0030] In this case, AB n The matrix can be converted into AB. m "For a matrix, you only need to look up the Base64 encoding table to get AB." m Each 8-bit binary number (xb1′~xb) in " mThe character ') can be converted to Base64 characters. The resulting string is the printable character P from step a. m ;

[0031] 2) When nmod3=1.

[0032] In this case, referring to case 1) in step a-2, matrix AB m The m and m-1 rows of "" are both 0. By querying the Base64 encoding table, AB can be obtained. m Each 8-bit binary number (xb1′~xb) in " m Convert the character '' to Base64 characters. The resulting string is the printable character P from step a. m Convert rows m and m-1 to "=" symbols;

[0033] 3) When nmod3=2.

[0034] In this case, referring to case 2) in step a-2, matrix AB m The m-line of "" is 0. The AB encoding is obtained by querying the Base64 encoding table. m Each 8-bit binary number (xb1′~xb) in " m Convert the character '' to Base64 characters. The resulting string is the printable character P from step a. m , convert m lines into "=" symbols.

[0035] Further, in step b, construct encryption rule m', which converts the original ASCII string A... n Encryption editing is performed to form an ASCII plaintext transmission string array [C1, C2, ... C n Using the key K, each element in the array is encoded using a character encoder b' and the key is written to obtain a printable string array [C'1, C'2, ..., C']. n After encapsulation, it is transmitted based on the HTTP protocol. The specific method is as follows:

[0036] Step b-1: For the original ASCII string A in step a-1 n = [x1,x2,…,x n The string is split into two parts, nmod2 = 0 and nmod2 = 1. These are explained below:

[0037] 1) When nmod2=0

[0038] At this time, A n It can be split into exactly n / 2 string arrays [x 2n-1 ,x 2nAnd n∈[1,∞], let As=[x 2n-1 ,x 2n The string array As is obfuscated by adding arbitrary ASCII characters at any position. Let the added ASCII character be x′. The obfuscated string As′ is then such that As′.lengthmod3=1, x′. 2n-1 The element is in the first position of the array and satisfies x. 2n-1 x 2n The distance between two elements in the array is less than 15;

[0039] 2) When nmod2=1

[0040] Following step 1) above, the array will be split, and the final result will be... Given a 2-character array and a single character, pad the last single character with a space character to form a 2-character array. This will form a string array As that is the same as in step 1) above, and the characters will be obfuscated in the same way.

[0041] Step b-2: For A in step b-1 n The split n / 2 string arrays are then obfuscated according to the steps described above to obtain an obfuscated string array [C1, C2, ..., C...]. n ], where C n Represent each obfuscated string As′, then calculate x in As′. 2n-1 x 2n The decimal distance between two elements is denoted as k, and k ≤ 15.

[0042] Step b-3: Since step b-1 declared that As′ satisfies As′.lengthmod3=1, and the encoder b' provided in step a is used for data encoding, As′ can be expanded into a matrix according to form 1) in step a-2. The third row from the end of the matrix has 4 bits padded with 0. Convert k in step b-2 to a binary number, and if it is less than 4 bits, pad it with 0 at the beginning to make it 4 bits. This is called the key K=[k1,k2,k3,k4], and is filled into the matrix where 0 is padded. The specific form is as follows:

[0043]

[0044] Next, through the encoder b' process in step a, the data encoding of As' is completed, and the encoded string is denoted as As″;

[0045] Step b-4: Process the string array [C1, C2, ... C3] using the steps described in step b-3 above. n Each element As′ in the string [C'1, C'2, ..., C'] performs data encoding and key writing, forming a printable string [C'1, C'2, ..., C'].n ] and then the printable character string array [C'1, C'2,... C'N] is encapsulated and transmitted based on the HTTP protocol. The receiving end will receive the same printable character string array. n ] and then the printable character string array [C'1, C'2,... C'N] is encapsulated and transmitted based on the HTTP protocol. The receiving end will receive the same printable character string array.

[0046] Further, step c, constructing the decoding rule c', decoding the received printable character string array [C'1, C'2,... C'N] to obtain the plaintext transmission character string array [C1, C2,... CN] and the key K, the specific method is: n ] and then the printable character string array [C'1, C'2,... C'N] is encapsulated and transmitted based on the HTTP protocol. The receiving end will receive the same printable character string array. n ] and then the printable character string array [C'1, C'2,... C'N] is encapsulated and transmitted based on the HTTP protocol. The receiving end will receive the same printable character string array.

[0047] Step c-1: According to the case 1) of step a-2 and the encryption rule m' of step b, the receiving end can receive the printable character string array [C'1, C'2,... C'N]. Since the processing of step b-1, it can be known that [C'1, C'2,... C'N].length mod 2 = 0. At this time, each element in the character string array is respectively executed decoding operation f2, the specific operation mode is as follows: n ] and then the printable character string array [C'1, C'2,... C'N] is encapsulated and transmitted based on the HTTP protocol. The receiving end will receive the same printable character string array. n ] and then the printable character string array [C'1, C'2,... C'N] is encapsulated and transmitted based on the HTTP protocol. The receiving end will receive the same printable character string array.

[0048] 1) By querying the base64 encoding table, each element As" in the [C'1, C'2,... C'N] array is converted into a binary matrix, which is as follows: n ] and then the printable character string array [C'1, C'2,... C'N] is encapsulated and transmitted based on the HTTP protocol. The receiving end will receive the same printable character string array.

[0049]

[0050] At this time, the key K = [k1, k2, k3, k4] can be obtained.

[0051] 2) The 0 of the first two columns, the 0 of the last two rows and the removal of k1~k4 are removed from the As" binary matrix. It is known from step a-2 that the remaining binary numbers can be converted into a matrix of 8 bits per row. After conversion, it is the binary matrix of As'. The conversion process is as follows:

[0052]

[0053] 3) Query the ASCII table to convert each row of the As' binary array into an ASCII character. At this time, As' = [x'1, x'2,..., x'3, x'4, x'N], where n mod 3 = 1. Each element in the [C'1, C'2,... C'N] array is decoded by the above method to obtain the obfuscated character string [C1, C2,... CN]. n ] and then the printable character string array [C'1, C'2,... C'N] is encapsulated and transmitted based on the HTTP protocol. The receiving end will receive the same printable character string array. n ] and then the printable character string array [C'1, C'2,... C'N] is encapsulated and transmitted based on the HTTP protocol. The receiving end will receive the same printable character string array. n ] and then the printable character string array [C'1, C'2,... C'N] is encapsulated and transmitted based on the HTTP protocol. The receiving end will receive the same printable character string array.

[0054] Further, step 4, constructing decryption rule n', based on key K, decrypting plaintext transmission string array [C1, C2, …C n ] to obtain original ASCII string A n , the specific method is:

[0055] Step d-1: the string array [C1, C2, …C n ] can be obtained through step c, and the key K=[k1, k2, k3, k4] can be obtained through step c-1, and K is converted into decimal representation, that is, k in step b-2.

[0056] Step d-2: for each element As' in the string array [C1, C2, …C n ], As'=[x'1, x'2, …, x'3, x'4, x' n ], the original string As=[x 2n-1 , x 2n ] is obtained through the key k.

[0057] Step d-3: the converted n As original string array is spliced, that is, the original ASCII string A n .

[0058] A coding and decoding and encryption processing system based on network space knowledge data, based on the coding and decoding and encryption processing method based on network space knowledge data, the coding and decoding and encryption processing based on network space knowledge data is realized.

[0059] A computer device, comprising a memory, a processor and a computer program stored on the memory and executable on the processor, when the processor executes the computer program, based on the coding and decoding and encryption processing method based on network space knowledge data, the coding and decoding and encryption processing based on network space knowledge data is realized.

[0060] A computer readable storage medium, having a computer program stored thereon, when the computer program is executed by a processor, based on the coding and decoding and encryption processing method based on network space knowledge data, the coding and decoding and encryption processing based on network space knowledge data is realized.

[0061] Compared with the prior art, the present application has the following advantages: 1) a data coding and decoding and encryption method is established, which can convert ASCII string into printable characters for transmission; 2) a new secure transmission mechanism is established, which solves the data integrity and security problems caused by data interaction, and can be used for network space knowledge data encryption communication. BRIEF DESCRIPTION OF DRAWINGS

[0062] Figure 1 The structure diagram of the encoding and encryption method of network space knowledge data.

[0063] Figure 2 The encoding and decoding and encrypted transmission flow chart of network space knowledge data. DETAILED DESCRIPTION

[0064] In order to make the purpose, technical scheme and advantages of the present application more clear, the present application is further described in detail below in combination with the drawings and examples. It should be understood that the specific examples described herein are only used to explain the present application and do not limit the present application.

[0065] A coding and decoding and encryption processing method based on network space knowledge data, comprising the following steps:

[0066] Step a: develop a special ASCII character encoder b', through which the original ASCII string A n can be encoded into a printable string P m . This step is mainly used to explain the encoding method and encoding ability of the encoder b', and P m is generally not used for transmission.

[0067] Step b: develop a special encryption rule m', which can be used to encrypt and edit the original ASCII string A n to form an ASCII plaintext transmission string array [C1, C2, … C n ] and a key K. Then, each element in the array is encoded using the character encoder b' to obtain a printable string array [C'1, C'2, … C' n ], and the key K can be secretly encoded into [C'1, C'2, … C' n ] at this time. After encapsulating the printable string array [C'1, C'2, … C' n ], transmission is carried out based on the HTTP protocol, and the receiving end will receive the same printable string array.

[0068] Step c: develop a special decoding rule c', according to which the receiving end decodes the received printable string array [C'1, C'2, … C' n ] to obtain the plaintext transmission string array [C1, C2, … C n ] and the key K.

[0069] Step d: develop a special decryption rule n', which can be used to decrypt the plaintext transmission string array [C1, C2, … C n ] based on the key K to obtain the original ASCII string A n .

[0070] Preferably, for the character encoder b' in step a, the specific encoding method includes:

[0071] Step a-1: For the original ASCII string A mentioned in step a n A is now designated. n = [x1,x2,…,x n ], where x n This represents any character in ASCII code. Now, by consulting the basic ASCII code mapping table, we can find x... n Convert to 8-bit binary number xb n And form the binary string AB n =[xb1,xb2,…,xb n Special note: xb n It is an 8-bit binary number. For ease of representation, the string AB is... n Defined in the following matrix form:

[0072]

[0073] AB n Each element in the matrix is ​​a binary number, either 0 or 1, therefore xb can be... n Represented as [xb n,1 ,xb n,2 …,xb n,8 A binary array of ].

[0074] Step a-2: Construct matrix AB m ', and each row has 6 elements, AB n The elements in xb 1,1 、xb 1,2 ...xb 1,8 、xb 2,1 、xb 2,2 ... xb n,8 Arrange them in order into AB. m The specific correspondences within the matrix can be seen in the following diagram:

[0075]

[0076] In AB m After arranging the matrix, pad each row of elements with 0 to 8 leading bits. This padding operation is called f1. A new matrix AB is formed using this method. m ",AB m "The presentation format is as follows:"

[0077]

[0078] The above situation represents a relatively ideal state, due to AB n Each row has 8 elements, and AB m Each row has only 6 elements, when AB n When the total number of rows n mod 3 = 0, all elements can be arranged into AB. m In the matrix, there are two cases where elements cannot be completely included: nmod3=1 and nmod3=2. We will discuss and handle these two cases separately to ensure that nmod3=0 is satisfied.

[0079] 1) When n mod 3 = 1

[0080] In this case, AB m The last row of the matrix has only two elements, and it is stipulated that the pair AB is used. m The way to fill the matrix with zeros makes AB m The total number of rows in the matrix satisfies mg mod 4 = 0, which means it satisfies AB. n The total number of rows in the matrix, n mod 3 = 0, as shown in the following example:

[0081]

[0082] Using method f1 in step a-2, we can construct a matrix AB with 8 elements in each row. m The process will not be described in detail here.

[0083] 2) When n mod 3 = 2

[0084] In this case, AB m The last row of the matrix has only 4 elements, and it is stipulated that the pair AB is used. m The method of filling the matrix with zeros makes AB m The total number of rows in the matrix satisfies mg mod 4 = 0, which means it satisfies AB. n The total number of rows in the matrix, n mod 3 = 0, as shown in the following example:

[0085]

[0086] Using method f1 in step a-2, we can construct a matrix AB with 8 elements in each row. m The process will not be described in detail here.

[0087] Step a-3: By following step a-2, we can obtain the result that satisfies AB. n The total number of rows n mod 3 = 0 and AB m A matrix AB with a total number of rows m mod 4 = 0 m "。Put AB m"Each row in the matrix is ​​considered as an 8-bit binary sequence, represented as AB." m "=[xb1′,xb2′,...,xb m ′], where xb1′~xb m ' represents a different 8-bit binary number. At this point, AB... m xb1′~xb in "″ m The decimal number is converted to a base 10 number, which is then looked up in the Base64 encoding table and converted to the corresponding Base64 character. It is particularly important to note the existence of AB... n There are three cases: the total number of rows n mod 3 = x and x ∈ [0,2]. The following discussion addresses each case separately.

[0088] 1) When nmod3 = 0.

[0089] In this case, AB n The matrix can be converted into AB. m "For a matrix, you only need to look up the Base64 encoding table to get AB." m Each 8-bit binary number (xb1′~xb) in " m The character ') can be converted to Base64 characters. The resulting string is the printable character P from step a. m Since Base64 characters are all printable, the conversion result can be directly used for data transmission.

[0090] 2) When nmod3=1.

[0091] In this case, referring to case 1) in step a-2, matrix AB m The m and m-1 rows of "" are both 0. By querying the Base64 encoding table, AB can be obtained. m Each 8-bit binary number (xb1′~xb) in " m Convert the character '' to Base64 characters. The resulting string is the printable character P from step a. m Note that rows m and m-1 need to be converted to "=" symbols.

[0092] 3) When nmod3=2.

[0093] In this case, referring to case 2) in step a-2, matrix AB m The m-line of "" is 0. The AB encoding is obtained by querying the Base64 encoding table. m Each 8-bit binary number (xb1′~xb) in " m Convert the character '' to Base64 characters. The resulting string is the printable character P from step a. mNote that lines m need to be converted to "=" symbols.

[0094] Preferably, the printable string generated in step a can be used for data transmission, but because its encoding and decoding methods are convenient and reversible, it cannot be used for private message communication. Therefore, the original ASCII string needs to be encrypted. Regarding the encryption rule m' in step b above, the specific rules include:

[0095] Step b-1: Define the original ASCII string A from step a-1. n = [x1,x2,…,x n Then, the string is split into two parts, resulting in two cases: nmod2 = 0 and nmod2 = 1. These are explained below:

[0096] 1) When nmod2=0

[0097] At this time, A n It can be split into exactly n / 2 string arrays [x 2n-1 ,x 2n And n∈[1,∞], let As=[x 2n-1 ,x 2n The string array As is obfuscated by adding arbitrary ASCII characters at any position. Let x' be the character added. The obfuscated string would be, for example, As' = [x'']. 2n-1 ,x′1,x′2,x 2n [x′3,x′4,x′5], this is just an example; the actual obfuscated string satisfies As′.lengthmod3=1, x 2n-1 The element is in the first position of the array and satisfies x. 2n-1 x 2n The distance between two elements in the array is less than 15.

[0098] 2) When nmod2=1

[0099] Following step 1) above, the array will be split, and the final result will be... A 2-character array and a single character are given. The last single character is padded with a space character (ASCII code 0) to form a 2-character array. At this time, a string array As can be formed in the same way as in step 1) above. The characters are confused in the same way, which will not be repeated here.

[0100] Step b-2: For A in step b-1 n The split n / 2 string arrays are then obfuscated according to the steps described above to obtain an obfuscated string array [C1, C2, ..., C...]. n ], where Cn Represent each obfuscated string As', in particular, the obfuscation method of each As' can be arbitrarily set, then calculate x 2n-1 , x 2n The decimal interval of two elements is denoted as k, and satisfies k≤15.

[0101] Step b-3: Since step b-1 declares that As' satisfies As'. lengthmod3=1, data encoding is performed using the encoder b' provided in step a, then As' can be matrix expanded in the form of 1) in step a-2, it can be observed that there are 4 bits of 0 in the third row of the matrix, convert k in step b-2 to a binary number, and fill the front with 0 to make up 4 bits, count as the key K=[k1,k2,k3,k4], and fill in the 0 of the matrix, the specific form is as follows:

[0102]

[0103] Then the data encoding of As' is completed through the encoder b' process in step a, and the encoded string is denoted as As''.

[0104] Step b-4: Through the above step b-3, data encoding and key writing are realized for each element As' in the string array [C1,C2,…C n ] to form a printable string [C'1,C'2,…C' n ], then the printable string array [C'1,C'2,…C' n ] is encapsulated and transmitted based on the HTTP protocol, and the receiving end will receive the same printable string array.

[0105] Preferably, the decoding rule c' in step c is as follows:

[0106] Step c-1: According to the case 1) of step a-2 and the encryption rule m' of step b, the receiving end can receive the printable string array [C'1,C'2,…C' n ], and since step b-1, it can be known that [C'1,C'2,…C' n ]. lengthmod 2=0. At this time, each element in the string array is respectively executed decoding operation f2, and the specific operation mode is as follows:

[0107] 1) Through the base64 encoding table, each element As'' in the array [C'1,C'2,…C' n ] is converted into a binary matrix, and the form is as follows:

[0108]

[0109] At this point, the key K = [k1, k2, k3, k4] can be obtained.

[0110] 2) Remove the 0s from the first two columns and the last two rows of the As″ binary matrix, as well as the bits containing k1 to k4. As shown in step a-2, the remaining binary number can be converted into a matrix with 8 bits per row. The resulting binary matrix is ​​As′. The conversion process is as follows:

[0111]

[0112] 3) Look up the ASCII table and convert each row of the As′ binary array into an ASCII character. At this point, As′ = [x′1, x′2, ..., x′3, x′4, x′...]. n Where nmod3=1. [C'1,C'2,…C' n Each element in the array is decoded using the method described above, resulting in the obfuscated string [C1, C2, ... C]. n ].

[0113] Preferably, for the decryption rule n' in step d, the specific decryption method is as follows:

[0114] Step d-1: Step c yields the string array [C1, C2, ... C n In step c-1, the key K = [k1, k2, k3, k4] is obtained. K is then converted into decimal and represented as k in step b-2.

[0115] Step d-2: For the string array [C1, C2, ... C n For each element As′ in the array, let As′ = [x′1, x′2, ..., x′3, x′4, x′...]. n ], obtain the original string As = [x] using key k. 2n-1 ,x 2n Since k represents the distance between two original characters, and the first original character is at the beginning, for example, when k=3, the obtained original string array is As=[x1,x4].

[0116] Step d-3: Concatenate the converted array of n original As strings to obtain the original original ASCII string A. n .

[0117] This invention also proposes a coding, decoding, and encryption system based on cyberspace knowledge data, which realizes coding, decoding, and encryption processing of cyberspace knowledge data based on the aforementioned coding, decoding, and encryption method.

[0118] A computer device comprises a memory, a processor and a computer program stored on the memory and executable on the processor, and when the processor executes the computer program, the coding and encryption processing based on cyberspace knowledge data is realized based on the coding and encryption processing method based on cyberspace knowledge data.

[0119] A computer readable storage medium has a computer program stored thereon, and when the processor executes the computer program, the coding and encryption processing based on cyberspace knowledge data is realized based on the coding and encryption processing method based on cyberspace knowledge data.

[0120] In summary, the present application is directed to cyberspace knowledge data, such as name information, relationship information, behavior description information, etc., and specifically to string data that meets certain significance (hereinafter collectively referred to as knowledge data). The ASCII characters of the knowledge data to be transmitted are converted into printable strings that can be communicated and transmitted based on the HTTP protocol through a specific encoding method, and the printable characters are encrypted and transmitted using a specific encryption method. The receiving end can completely accept the transmitted printable characters and decrypt them using a specific method, solving the problem of encrypted communication of knowledge data using conventional base64 encoding for data transmission.

[0121] Embodiment

[0122] In order to verify the effectiveness of the present application, the following experiment is performed.

[0123] Figure 1 The coding and encryption method structure diagram for cyberspace knowledge data, Figure 2 The data coding and decoding and encryption transmission flowchart in the specific embodiment of the present application will be described in the following specific embodiment, and the main process steps include:

[0124] Stage 1: Encrypt the original ASCII string data to obtain a printable string array and a key, and the key is secretly packaged in the printable string array for transmission.

[0125] Step 1.1: Set the original knowledge data ASCII string A6 to be transmitted as "crisis", which represents a crisis event that is often involved in knowledge data and is commonly used for intelligence information transmission between multiple users in cyberspace.

[0126] Step 1.2: Split A6 every two characters to form a string array ['cr', 'is', 'is'], and use the rule in step b-1) to generate a mixed string array ['circles', 'islands', 'iphones']

[0127] Step 1.3: Encode each string in the obfuscated string array using the character encoder b' from step a, in the following way:

[0128] 1) Encode for 'circles'

[0129] Referring to step b-2, the distance between the original string 'cr' in the obfuscated string 'circles' is 1, and the key K = 0001 is obtained.

[0130] Referring to step a-1, the 8-bit binary matrix A is generated by looking up the ASCII code table 1st :

[0131]

[0132] Then, referring to step a-2, the matrix A with 6 elements in each row is constructed 1st , and the constructed matrix is as follows:

[0133]

[0134] The boxed elements in the matrix are the 0-padded bits according to the method 1) in step a-2. Then, the A 1st matrix is 0-padded to 8 bits in front of each row element, and the key K = 0001 is supplemented to the 0-padded bits, to obtain the following matrix A 1st :

[0135]

[0136] Then, referring to the base64 encoding table, the printable string A 1st is obtained by looking up each row element in A 1st ″′ = "Y2lyY2xlcx == = ".

[0137] 2) Encode for 'islands'

[0138] The current encoding method is similar to the encoding method of 1) above, and the printable string A 2nd ″′ = "aXNsYW5kc1 == = " is obtained, and the key K = 0101 is obtained.

[0139] 3) Encode for 'iphones'

[0140] The current encoding method is similar to the encoding method of 1) above, and the printable string A 3rd ″′ = "aXBob25lc1 == = " is obtained, and the key K = 0101 is obtained.

[0141] Step 1.4: Combine all printable character strings obtained in the above steps into a new character string array [A 1st ",A 2nd ",A 3rd "], which is composed of printable characters and can be transmitted based on the HTTP protocol after encapsulation.

[0142] Phase 2: The receiving end decodes the received printable character string array to obtain the key and the obfuscated character string array contained therein, and obtains the original ASCII string data through decryption and splicing, completing the encryption transmission process of knowledge data.

[0143] Step 2.1: The character string array obtained by the receiving end is [A 1st ",A 2nd ",A 3rd "], that is, ["Y2lyY2xlcx==", "aXNsYW5kc1==", "aXBob25lc1=="]. Each element in the array is converted to a binary matrix through step c-1, and the form of A 1st " is as follows:

[0144]

[0145] At this time, the selected part can obtain the key of this character string, denoted as K = 0001, and then the decoding operation f2 in c-1 is performed on the character string array [A 1st ",A 2nd ",A 3rd "], and the obfuscated character string array ['circles', 'islands', 'iphones'] can be obtained, which will not be described here.

[0146] Step 2.2: According to the decryption rule n' in step d, the distance between the original ASCII code characters hidden in the obfuscated character string can be determined by using each character string in the above obtained character string array and the corresponding key, and then the characters at the corresponding positions are selected to form the character string array ['cr', 'is', 'is'].

[0147] Step 2.3: The above character string array ['cr', 'is', 'is'] is spliced to restore the original knowledge data ASCII string "crisis".

[0148] In summary, using the data encoding and encryption technology described in the present application for data transmission can effectively ensure the integrity and security of the data, and even if the relevant data is intercepted by a third party, it can still have strong confidentiality.

[0149] Any combination of the technical features in the above embodiments can be made, and for the sake of brevity, not all possible combinations are described above, however, as long as the combination of the technical features does not exist in contradiction, it shall be considered within the scope of the present disclosure.

[0150] The above embodiments only express several implementation manners of the present application, and the description is relatively specific and detailed, but it shall not be understood as a limitation on the patent scope of the present application. It shall be pointed out that, for ordinary skilled persons in the art, several modifications and improvements can be made without departing from the concept of the present application, and these shall be within the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the appended claims.

Claims

1. A coding and encryption processing method based on network space knowledge data, characterized in that, Comprising the following steps: Step a: Construct an ASCII character encoder b' by which the original ASCII string A n is encoded into a printable string P m ; Step b: Constructing encryption rule m', original ASCII string A n Performing encryption editing, forming ASCII plaintext transmission string array [C1, C2, … C n ] and key K, using character encoder b' on each element in the array to obtain printable string array [C'1, C'2, … C' n ] for transmission based on HTTP protocol after encapsulation; Step c: Construct decoding rule c', which is performed by the receiving end on the received printable string array [C'1, C'2, ..., C'...]. n Decode the plaintext transmitted string array [C1, C2, ... C...] to obtain the plaintext transmitted string array [C1, C2, ... C...]. n and key K; Step d: Construct decryption rule n', decrypt the array of plaintext transmission strings [C1, C2,... Cn] based on the key K, and obtain the original ASCII string A n ] based on the key K, and obtain the original ASCII string A n ; Wherein, For the original ASCII string A n , specify A n = [x1, x2,..., x n ], where x n represents any character in ASCII code.

2. The method for encoding and encryption processing based on cyberspace knowledge data according to claim 1, characterized in that, Step a, construct an ASCII character encoder b' by which the original ASCII string A n is encoded into a printable string P m , in particular by Step a-1: for original ASCII string A n , convert x n to 8-bit binary number xb n by querying the base ASCII code table, and compose binary string AB n = [xb1, xb2…, xb n ]. For convenience, define string AB n as the following matrix form: AB n Each element in the matrix is a binary number 0 or 1, xb n = [xb n,1 ,xb n,2 …,xb n,8 ] is expressed as a binary array; Step a-2: Constructing matrix AB m AB' is a 6x6 matrix, and the elements in AB n are arranged in AB 1,1 ' according to the order of xb 1,2 , xb 1,8 , …, xb 2,1 , xb 2,2 , xb n,8 , …, xb m , respectively. The specific correspondence is as follows: In AB m After the matrix arrangement is completed, 0 is added in front of each row element to 8 bits, and this 0 addition method is called f1. A new matrix AB is formed through this method m ″, AB m The expression form is as follows: The above is the ideal state, because AB n There are 8 elements in each row, while AB m There are only 6 elements in each row, while AB n When the total number of rows nmod3=0, all elements can be arranged in AB m In other words, there are two cases that nmod3=1 and nmod3=2, which cannot be completely arranged, and the following will discuss and process the two cases to meet nmod3=0; 1) when n mod 3 = 1 In this case, AB m The last row of the matrix has only 2 elements, and it is specified to adopt the method of supplementing 0 to AB m The last row of the matrix has only 2 elements, and it is specified to adopt the method of supplementing 0 to AB m The total number of rows of the matrix satisfies mmod4=0, in other words, it satisfies AB n The total number of rows of the matrix satisfies nmod3=0, and a specific example is as follows: By the method f1 in step a-2 again, the matrix AB of 8 elements per row can be constructed m "; 2) when n mod 3 = 2 In this case, AB m The last row of the matrix has only 4 elements, and the AB m The matrix is supplemented with 0 in this way, and the AB m The total number of rows of the matrix satisfies mmod4=0, that is, the AB n The total number of rows of the matrix satisfies nmod3=0, and a specific example is as follows: By the method f1 in step a-2 again, the matrix AB of 8 elements per row can be constructed m "; Step a-3: By following step a-2, we can obtain the result that satisfies AB. n The total number of rows n mod 3 = 0 and AB m A matrix AB with a total number of rows m mod 4 = 0 m ", AB m "Each row in the matrix is ​​considered as an 8-bit binary sequence, represented as AB." m "=[xb1′,xb2′,…,xb m ′], where xb1′~xb m ' represents different 8-bit binary numbers, in which case AB is... m xb1′~xb in "″ m The '' symbol is converted to a decimal number. By consulting the Base64 encoding table, it is converted to the corresponding Base64 character. The characters are found in AB. n The total number of rows is n mod 3 = x and x ∈ [0,2]. The following discussion addresses each of these cases. 1) when n mod 3 = 0 In this case, AB n The matrix can be converted to AB m "Matrix, only need to query Base64 encoding table will AB m "Each 8-bit binary number (Xb1 ~ Xb m ') into Base64 characters, the resulting string after the conversion is the printable characters P m ; 2) when n mod 3 = 1 In this case, referring to the case 1) in step a-2, the matrix AB m " has m and m-1 rows of 0, and each 8-bit binary number (xbl'~xb m ') in AB m " is converted into a Base64 character by referring to the Base64 encoding table, and the string formed after the conversion is the printable character P m in step a; and m and m-1 rows are converted into "=" symbols. 3) when n mod 3 = 2 In this case, referring to the case 2) in step a-2, the matrix AB m is converted into Base64 characters by referring to the Base64 encoding table, and the string formed after the conversion is the printable character P m in step a). Each 8-bit binary number (xbl' ~ xbn' ) in the matrix AB m is converted into a Base64 character, and the string formed after the conversion is the printable character P m in step a). The m rows are converted into "=" symbols.

3. The method of claim 2, wherein the method further comprises: Step b, build encryption rule m', original ASCII string A n encrypted and edited to form ASCII plaintext transmission string array [C1, C2, … C n ] and key K, each element in the array is encoded and key written using character encoder b' to obtain printable string array [C'1, C'2, … C' n ] which is encapsulated and transmitted based on HTTP protocol. Step b-1: for the original ASCII string A in step a-1 n = [x1, x2..., xn-1, xn], split the string by every 2 characters, at this time there are two cases of n mod 2 = 0 and n mod 2 = 1, which are described as follows: n ], split the string by every 2 characters, at this time there are two cases of n mod 2 = 0 and n mod 2 = 1, which are described as follows: 1) when n mod 2 = 0 This time A n Can be exactly split into n / 2 string array [x 2n-1 ,x 2n ] and n ∈ [1, ∞], let As=[x 2n-1 ,x 2n ], the editing in As string array by adding any ASCII character at any position makes it confused, set any added ASCII character as x', the confused string As', then the confused string satisfies As'.length mod3=1, x 2n-1 Element in the first position of the array, and satisfies x 2n-1 ,x 2n Two elements in the array distance is less than 15; 2) when n mod 2 = 1 Following step 1) above, the array will be split, and the final result will be... Given a 2-character array and a single character, pad the last single character with a space character to form a 2-character array. This will form a string array As that is the same as in step 1) above, and the characters will be obfuscated in the same way. Step b-2: the A n strings in the n / 2 split arrays are scrambled according to the above steps, and the scrambled string arrays [C1, C2, … Cn / 2] are obtained, where C n represents each scrambled string As′, and then the 10-base interval of the two elements x n , x 2n-1 in As′ is calculated, denoted as k, and k≤15 is satisfied. 2n ​ Step b-3: Since step b-1 declares that As' satisfies As'.length mod 3 = 1, data encoding is performed using the encoder b' provided in step a, then As' can be matrix expanded in the form of 1) in step a-2, and the fourth bit in the third row of the matrix inverse is a 0 bit. Convert k in step b-2 to a binary number, and fill in the key K = [k1, k2, k3, k4] to the 0 bit in the matrix, and the specific form is as follows: Then, through the encoder b' process in step a, the data encoding of As' is completed, and the encoded string is denoted as As"; Step b-4: Process the string array [C1, C2, ... C3] using the steps described in step b-3 above. n Each element As′ in the string [C'1, C'2, ..., C'] performs data encoding and key writing, forming a printable string [C'1, C'2, ..., C']. n Then, the printable string array [C'1, C'2, ..., C'] will be generated. n After encapsulation, the data is transmitted via the HTTP protocol, and the receiving end will receive the same printable string array.

4. The method of claim 3, wherein the method further comprises: Step c, construct decoding rule c', for the received printable string array [C'1, C'2, ..., C' n Decode the plaintext transmitted string array [C1, C2, ... C...] to obtain the plaintext transmitted string array [C1, C2, ... C...]. n And the key K, the specific method is as follows: Step c-1: Based on step a-2, step 1), and the encryption rule m' in step b, the receiving end can receive the printable string array [C'1, C'2, ..., C'...]. n Due to the processing in step b-1, we can know that [C'1, C'2, ..., C'] n When `length mod2 = 0`, the decoding operation `f2` is performed on each element of the string array. The specific operation method is as follows: 1) By querying the base64 encoding table, [C'1,C'2,…C' n Each element As″ in the array is converted into a binary matrix, as follows: At this time, the key K = [k1, k2, k3, k4] can be obtained; 2) Remove the 0 in the first two columns of the As" binary matrix, the 0 in the last two rows, and the bits occupied by k1-k4. As known from step a-2, the remaining binary numbers can be converted into a matrix of 8 bits per row. The conversion process is as follows: 3) Query the ASCII table and convert each row of the As′ binary array into an ASCII character. At this point, As′ = [x1′, x′2, ..., x3′, x4′, x′...]. n ], where nmod3=1, and [C'1,C'2,…C' n Each element in the array is decoded using the method described above, resulting in the obfuscated string [C1, C2, ... C]. n ].

5. The method for encoding, decoding and encryption processing based on cyberspace knowledge data according to claim 4, characterized in that, Step 4, Constructing the decryption rule n', decrypting the array of plaintext transmission strings [C1, C2, … Cn] based on the key K to obtain the original ASCII string A n , the specific method is: n ​ Step d-1: Step c yields the string array [C1, C2, ... C n ], and step c-1 can obtain the key K = [k1,k2,k3,k4], convert K into decimal for representation, which is k in step b-2; Step d-2: For the string array [C1, C2, ... C n For each element As′ in the array, let As′ = [x1′, x′2, ..., x3′, x4′, x′] n ], obtain the original string As = [x] using key k. 2n-1 ,x 2n ]; Step d-3: Concatenate the converted n As original string arrays, i.e. get the original ASCII string A n .

6. A coding and encryption processing system based on cyber space knowledge data, characterized by, The coding and decoding and encryption processing method based on cyberspace knowledge data according to any one of claims 1-5 is realized.

7. A computer device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein when the processor executes the computer program, the coding and decoding and encryption processing method based on cyberspace knowledge data according to any one of claims 1-5 is realized.

8. A computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the coding and decoding and encryption processing method based on cyberspace knowledge data according to any one of claims 1-5 is realized.

Citation Information

Patent Citations

  • Fuzzing encoded data

    US20090164975A1

  • Complementary Character Encoding for Preventing Input Injection in Web Applications

    US20110252475A1