Secure MCP protocol authentication method and system

By using digital certificates, public and private key signature mechanisms, and timestamp verification, the system addresses the weaknesses in identity authentication and data transmission insecurity in the MCP protocol, achieving trusted communication and data integrity throughout the entire process, and improving system security and stability.

CN120896794AActive Publication Date: 2025-11-04GUIZHOU ELECTRONIC CERTIFICATION TECH CO LTD

Patent Information

Application Number
CN202511417149.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-29
Publication Date
2025-11-04
Estimated Expiration
2045-09-29

Smart Images

  • Figure CN120896794A_ABST
    Figure CN120896794A_ABST
Patent Text Reader

Abstract

The invention provides a secure MCP protocol authentication method and system, and relates to the technical field of information security, and the method comprises the steps: based on a processing result that agent identity authentication is successful and digital signature verification is passed, an MCP server analyzes a target resource identifier, constructs a resource access instruction containing agent identity information, an operation instruction and a new timestamp, and sends the resource access instruction to a server; performing digital signature by using the private key of the server, and sending an access request containing a server digital certificate, a digital signature and a resource access instruction to the target resource; and the target resource receives the access request, verifies the legality of the digital certificate of the MCP server, verifies the digital signature by using the public key of the server, and verifies the integrity and timeliness of the resource access instruction. According to the method, the multi-entity interaction security based on the MCP protocol is improved, and a solid guarantee is provided for trusted communication among the intelligent agent, the server and the target resource.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of information security, in particular to a secure MCP protocol authentication method and system. BACKGROUND

[0002] In the field of information security, with the wide popularity of various intelligent applications, the interaction scenarios based on MCP protocol are increasing. When applied, the intelligent customer service system (as an intelligent agent) needs to access the backend database (target resource) through the MCP server to obtain the customer transaction record and provide accurate service for the customer. The intelligent customer service system initiates an MCP call request instruction containing the target resource identifier (i.e. database address and other identification information), operation instruction (such as querying the transaction record of a customer in the past month) and timestamp, and sends it to the MCP server after digital signature.

[0003] However, the existing MCP protocol authentication method may have the following defects: On the one hand, in the identity authentication link, some authentication mechanisms may be weak, and the authentication requirements of different MCP servers may differ greatly, and some may even lack basic API key protection, which makes it possible for attackers to easily pretend to be a legitimate intelligent agent and send malicious requests to the MCP server. If the attacker successfully pretends to be an intelligent customer service, the MCP server will forward the malicious request to the database under the condition of failed identity authentication, which may lead to the leakage of customer transaction records.

[0004] On the other hand, there may be a lack of strict verification of data integrity and timeliness in the data transmission process. For example, an attacker intercepts the resource access instruction or response data in transmission, tampers with the operation instruction or timestamp and then sends it, and if the receiver does not strictly verify, the execution of the wrong instruction may cause data loss or business confusion, thereby affecting the security and stability of the system. SUMMARY

[0005] The technical problem to be solved by the present application is to provide a secure MCP protocol authentication method and system, which improves the security of multi-entity interaction based on MCP protocol and provides a solid guarantee for trusted communication between intelligent agents, servers and target resources.

[0006] To solve the above technical problems, the technical solution of the present application is as follows: In a first aspect, a secure MCP protocol authentication method, the method comprising: Step 1, based on the processing result of successful intelligent agent identity authentication and passed digital signature verification, the MCP server parses the target resource identifier, constructs a resource access instruction containing intelligent agent identity information, operation instruction and new timestamp, uses the server private key for digital signature, and sends an access request containing server digital certificate, digital signature and resource access instruction to the target resource; Step 2, the target resource receives the access request, verifies the legality of the MCP server digital certificate, verifies the digital signature using the server public key, and checks the integrity and timeliness of the resource access instruction; Step 3, based on the processing result that the MCP server identity authentication is successful and the digital signature verification is passed, the target resource executes the operation instruction, generates response data containing the execution result and a timestamp, performs digital signature using the target resource private key, and sends an operation response containing the target resource digital certificate, the digital signature and the response data to the MCP server; Step 4, the MCP server receives the operation response, based on the received response data, verifies the legality of the target resource digital certificate, verifies the digital signature using the target resource public key, and checks the integrity and timeliness of the response data, obtains the processing result that the target resource identity authentication is successful and the digital signature verification is passed; Step 5, based on the processing result that the target resource identity authentication is successful and the digital signature verification is passed, the MCP server forwards the response data to the agent to complete the authentication process.

[0007] The second aspect is a secure MCP protocol authentication system, comprising: The sending module is configured to, based on the processing result that the agent identity authentication is successful and the digital signature verification is passed, parse the target resource identifier by the MCP server, construct a resource access instruction containing the agent identity information, the operation instruction and a new timestamp, perform digital signature using the server private key, and send an access request containing the server digital certificate, the digital signature and the resource access instruction to the target resource; The checking module is configured to, by the target resource, receive the access request, verify the legality of the MCP server digital certificate, verify the digital signature using the server public key, and check the integrity and timeliness of the resource access instruction; The response generating module is configured to, based on the processing result that the MCP server identity authentication is successful and the digital signature verification is passed, execute the operation instruction by the target resource, generate response data containing the execution result and a timestamp, perform digital signature using the target resource private key, and send an operation response containing the target resource digital certificate, the digital signature and the response data to the MCP server; The verification module is configured to, by the MCP server, receive the operation response, based on the received response data, verify the legality of the target resource digital certificate, verify the digital signature using the target resource public key, and check the integrity and timeliness of the response data, obtain the processing result that the target resource identity authentication is successful and the digital signature verification is passed; The forwarding module is configured to, based on the processing result that the target resource identity authentication is successful and the digital signature verification is passed, forward the response data by the MCP server to the agent to complete the authentication process.

[0008] In a third aspect, a computing device includes: one or more processors; a memory device storing one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method.

[0009] In a fourth aspect, a computer-readable storage medium stores a program, when executed by a processor, implements the method.

[0010] The above scheme of the present application at least has the following beneficial effects: Through the digital certificate verification and the public and private key signature mechanism among the agent, the MCP server and the target resource, the identity of each participating entity is trusted and confirmed; the legality and validity of the digital certificate of each interactive link are verified to ensure that only entities authenticated by a trusted agency and within the effective period can participate in communication; all transmitted instructions and response data are processed by digital signature, and the receiver can confirm that the data has not been tampered with by verifying the signature through the corresponding public key, thereby ensuring the integrity of the data; at the same time, the introduction of the time stamp and the timeliness verification mechanism can effectively resist replay attacks, ensuring the freshness and validity of the data in the transmission and processing process; from the initiation of the request by the agent, to the forwarding by the MCP server, the operation by the target resource, and the response data back to the agent, the complete closed-loop verification process; each link not only verifies the legality of the upstream entity, but also provides verifiable identity and data basis for the downstream link, avoiding the overall risk that may be caused by single-point security vulnerabilities; through the detailed design of data block processing and the application of secure transmission protocol, the data transmission efficiency and security are further optimized, especially when processing large execution result data, block processing can reduce the transmission pressure, achieving a balance between efficiency and security. BRIEF DESCRIPTION OF DRAWINGS

[0011] Figure 1 is a flowchart of a secure MCP protocol authentication method provided by an embodiment of the present application.

[0012] Figure 2 is a schematic diagram of a secure MCP protocol authentication system provided by an embodiment of the present application. DETAILED DESCRIPTION

[0013] Exemplary embodiments of the present disclosure will be described more fully hereinafter with reference to the accompanying drawings; however, they are not limited to the embodiments set forth herein but can be implemented in various forms. The present disclosure can be implemented in other ways, and the embodiments are provided so that the present disclosure can be more thoroughly understood. It should be understood that the present disclosure is not limited by the embodiments set forth herein and that the scope of the claims is not limited by the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure can be more thoroughly understood.

[0014] As Figure 1 shown, the embodiment of the present application proposes a secure MCP protocol authentication method, which comprises the following steps: Step 1, based on the processing result of successful agent identity authentication and passed digital signature verification, the MCP server parses the target resource identifier, constructs a resource access instruction containing agent identity information, operation instruction and new timestamp, uses server private key for digital signature, and sends an access request containing server digital certificate, digital signature and resource access instruction to the target resource; Step 2, the target resource receives the access request, verifies the legality of the MCP server digital certificate, uses the server public key to verify the digital signature, and checks the integrity and timeliness of the resource access instruction; Step 3, based on the processing result of successful MCP server identity authentication and passed digital signature verification, the target resource executes the operation instruction, generates response data containing execution result and timestamp, uses target resource private key for digital signature, and sends operation response containing target resource digital certificate, digital signature and response data to the MCP server; Step 4, the MCP server receives the operation response, based on the received response data, verifies the legality of the target resource digital certificate, uses the target resource public key to verify the digital signature, and checks the integrity and timeliness of the response data, and obtains the processing result of successful target resource identity authentication and passed digital signature verification; Step 5, based on the processing result of successful target resource identity authentication and passed digital signature verification, the MCP server forwards the response data to the agent to complete the authentication process.

[0015] In the embodiment of the present application, the MCP protocol (Management and Control Protocol) is a communication protocol for management and control interaction between multiple entities (such as intelligent agents, servers, target resources); the MCP server (Management and Control Protocol Server) is an intermediate forwarding and security verification core node based on the MCP protocol, which plays a dual role of a bridge and a security gateway between intelligent agents (such as intelligent customer service) and target resources (such as back-end databases); by reconstructing the resource access instruction and adding a new timestamp, the instruction and the forwarding behavior of the MCP server are strongly bound, and the new timestamp provides a basis for subsequent timeliness verification; the server private key signature and the digital certificate are used to enable the target resource to directly verify the legality of the instruction source, the intelligent agent identity information contained in the instruction facilitates the target resource to trace the operation initiator, and provides a basis for permission control and auditing; the legality of the MCP server digital certificate is verified to ensure that the target resource only responds to the request of a legal server; the digital signature is verified through the server public key to determine whether the resource access instruction has been tampered with, thereby ensuring the integrity of the instruction; the timeliness of the instruction is checked to effectively prevent replay attacks and prevent attackers from repeatedly using expired instructions to illegally call resources; the target resource signs the response data and carries its own certificate, so that the MCP server can verify the real source of the response; the response data contains a timestamp, which provides a basis for the MCP server to verify its timeliness; the response data is bound with the target resource private key signature to ensure that the execution result has not been tampered with in the transmission process; the legality of the target resource certificate is verified to confirm that the response data comes from a trusted target resource, and the signature is verified through the target resource public key to ensure that the response data has not been tampered with in the transmission, thereby ensuring the data integrity; the timeliness of the response data is checked to filter expired responses and ensure that the intelligent agent receives the latest and effective execution result; only when the target resource identity and the response data are both verified, the result can be forwarded, which provides a double security endorsement for the intelligent agent and ensures that the response received by the intelligent agent is real and complete.

[0016] In a preferred embodiment of the present application, before the intelligent agent identity authentication is successful and the digital signature verification is passed, the method further comprises: The intelligent agent generates an MCP call request instruction containing a target resource identifier, an operation instruction and a timestamp, uses an asymmetric encryption algorithm to use the private key of the intelligent agent to perform digital signature processing on the call request instruction, generates an authentication request message containing the digital certificate of the intelligent agent, the digital signature and the call request instruction and sends the authentication request message to the MCP server, and specifically includes: the intelligent agent first determines the target resource to be accessed, and clearly indicates the operation content to be performed on the resource, and then generates an MCP call request instruction containing a target resource identifier, a specific operation instruction and current time information, wherein the target resource identifier is used to uniquely identify the system resource to be accessed, the operation instruction is used to instruct the target resource to perform a specific operation, and the timestamp is used to mark the generation time of the request instruction.

[0017] The intelligent agent selects an applicable asymmetric encryption algorithm, calls the private key stored by itself, and performs digital signature processing on the generated MCP call request instruction; after completing the digital signature processing, the intelligent agent combines the digital certificate of itself, the digital signature obtained through the signature and the original MCP call request instruction according to a preset format to form a complete authentication request message, and the message contains all the information required for verifying the identity of the intelligent agent and the call request instruction.

[0018] The intelligent agent sends the generated authentication request message to the MCP server through a preset communication channel.

[0019] After the MCP server receives the authentication request message, the MCP server obtains the digital certificate of the intelligent agent by analyzing the message content, verifies the legality and validity of the digital certificate according to a preconfigured access control strategy, uses the public key of the intelligent agent to perform decryption verification on the digital signature through a cryptographic verification algorithm, and checks the data integrity of the call request instruction and the timeliness of the timestamp, to obtain a processing result that the identity authentication of the intelligent agent is successful and the digital signature verification is passed, and specifically includes: the MCP server receives the authentication request message sent by the intelligent agent through the communication interface thereof, starts a message analysis program, disassembles the message according to the preset format of the message, and extracts the digital certificate of the intelligent agent, the digital signature and the MCP call request instruction and other components therefrom; then, the MCP server calls the preconfigured access control strategy from the security configuration stored locally, the strategy contains the certificate specification of the intelligent agent allowed to access the system, the permission range and other contents, then checks the digital certificate of the intelligent agent according to the access control strategy, verifies whether the certificate is signed by a trusted certificate authority, whether the certificate is within a valid period and whether the certificate meets the access specification of the system and the like.

[0020] After completing the verification of the digital certificate of the agent, the MCP server extracts the public key of the agent from the digital certificate, calls a preset cryptographic verification algorithm, decrypts the parsed digital signature using the public key, and verifies the validity of the digital signature by comparing the decryption result with the MCP call request instruction.

[0021] Through the above series of operations of verifying the digital certificate of the agent, decrypting and verifying the digital signature, checking the data integrity of the call request instruction, and verifying the timeliness of the timestamp, the MCP server comprehensively judges all the verification results, and finally determines that the agent identity authentication is successful and the digital signature verification is passed.

[0022] In the embodiment of the application, the agent includes a timestamp when generating the call request instruction, and uses its own private key to digitally sign and send the digital certificate to the MCP server. This process can ensure that the source of the call request instruction is traceable, so that the MCP server can accurately identify the identity of the agent initiating the request. After receiving the authentication request message, the MCP server first parses and obtains the digital certificate of the agent, and then verifies the legality and validity of the certificate according to the preconfigured access control policy. This operation can filter out agents without legal identity or exceeding the authority range, and avoid illegal agents accessing the system. The MCP server decrypts and verifies the digital signature using the public key of the agent, and checks the data integrity and timeliness of the call request instruction, which can effectively confirm that the call request instruction has not been tampered with during transmission, and protect the authenticity of the instruction content. At the same time, the timestamp verification prevents attackers from repeatedly using expired instructions to implement replay attacks, further improving the security of the request instruction transmission.

[0023] In a preferred embodiment of the application, the above step 1 comprises: Step 11, based on the processing result of successful agent identity authentication and passed digital signature verification, the MCP server parses the target resource identifier contained in the calling request instruction, determines the network address and access interface of the target resource through resource identifier parsing algorithm, specifically including: after successful agent identity authentication and passed digital signature verification, the MCP server extracts the target resource identifier from the calling request instruction that has passed verification; then the MCP server starts the resource identifier parsing algorithm, which parses the target resource identifier in layers according to the preset parsing rules, first identifies the resource type to which the target resource belongs, then matches the corresponding parsing logic according to the resource type, and then extracts the key information used to locate the target resource, compares the key information with the resource mapping table stored locally in the MCP server, and finally determines the network address and access interface for data interaction corresponding to the target resource.

[0024] Step 12, based on the network address and access interface of the target resource, construct a resource access instruction containing agent identity information, operation instruction and new timestamp, wherein the new timestamp is obtained from a trusted time source using a time synchronization protocol, specifically including: after obtaining the network address and access interface of the target resource, the MCP server will start to construct the resource access instruction based on these two information; first, the MCP server will extract the key identity from the previously verified agent identity information, and write it as the core content of the agent identity information into the resource access instruction, then it will copy the verified operation instruction in the calling request instruction into the resource access instruction; At the same time, the MCP server will start the time synchronization module, which will establish a connection with the trusted time source through the preset time synchronization protocol, obtain the current standard time from the trusted time source as the new timestamp, and write the new timestamp into the resource access instruction.

[0025] Step 13, based on the resource access instruction, use the server private key to calculate the digital signature of the resource access instruction, generate the server digital signature, specifically including: for the constructed resource access instruction, the MCP server will call the server private key held by itself from the local key storage area, and will load the preset digital signature algorithm, which will first hash the resource access instruction to generate the corresponding message digest; then use the server private key to encrypt the message digest, and through this series of processing, generate the server digital signature corresponding to the resource access instruction.

[0026] Step 14, based on the server digital signature and the resource access instruction, sending the access request containing the server digital certificate, the digital signature and the resource access instruction to the target resource through a secure transmission protocol, wherein the server digital certificate contains the public key information and the identity of the MCP server, specifically including: after obtaining the server digital signature and the resource access instruction, the MCP server obtains its own server digital certificate from the certificate storage area, and the server digital certificate contains the public key information of the MCP server and a unique identity for identifying the identity of the server; then the MCP server encapsulates the server digital certificate, the generated server digital signature and the resource access instruction into the same data structure in the preset message format, forms a complete access request, and then the MCP server enables the preset secure transmission protocol, establishes a secure transmission channel corresponding to the network address of the target resource through the protocol, and sends the constructed access request to the access interface of the target resource through the secure transmission channel.

[0027] In the embodiment of the application, by analyzing the target resource identifier and determining the network address and the access interface thereof, the MCP server can be accurately positioned to the target system resource, the access object error caused by ambiguous resource identification or parsing error can be avoided, and an accurate basis is laid for accurate transmission of subsequent instructions; based on the new timestamp mechanism of the trusted time source, the authority and uniformity of the time information can be ensured, the timestamp verification deviation caused by different local times of each entity can be effectively avoided, and the new timestamp is distinguished from the timestamp of the original request of the agent, so that the target resource can clearly identify the instruction as an effective instruction forwarded by the MCP server; the resource access instruction is signed and calculated by the server private key, the identity of the MCP server is deeply bound to the instruction, so that the target resource can directly confirm whether the instruction comes from a legal MCP server by verifying the signature after receiving the instruction; the access request is sent by carrying the server digital certificate and through the secure transmission protocol, the public key information and the identity required for verifying the server identity are provided for the target resource, and the secure transmission channel is used to avoid eavesdropping or tampering of the access request in the transmission process, so that protection is formed from the aspects of identity verification and transmission security, and it is ensured that the access request can safely and completely reach the target resource.

[0028] In a preferred embodiment of the application, step 2 above comprises: Step 21, after receiving the access request sent by the MCP server, the target resource parses the request content to obtain the server digital certificate, verifies the legality of the issuing agency of the digital certificate according to the certificate authority trust list, checks whether the certificate is in a valid state, and obtains the server digital certificate that passes the verification, which specifically includes: after receiving the access request sent by the MCP server, the target resource starts the request parsing program to parse the access request, and extracts the server digital certificate contained therein; then the target resource calls the locally stored certificate authority trust list, compares the issuing agency information recorded in the server digital certificate with the agency information in the trust list, to verify whether the issuing agency belongs to the trusted range; at the same time, the target resource checks the start time and end time of the validity period recorded in the server digital certificate, to determine whether the current time is within the validity period, and confirms that the server digital certificate is legal and valid through the above verification, thereby obtaining the server digital certificate that passes the verification.

[0029] Step 22, based on the server digital certificate that passes the verification, the MCP server public key information contained therein is extracted, and the public key is used to decrypt and verify the server digital signature in the access request through an asymmetric decryption algorithm, to confirm the integrity and authenticity of the resource access instruction, and obtain the server digital signature that passes the verification, which specifically includes: after obtaining the server digital certificate that passes the verification, the target resource extracts the public key information of the MCP server from the certificate; then the target resource loads a preset asymmetric decryption algorithm, and uses the extracted MCP server public key to decrypt the server digital signature contained in the access request, to obtain the corresponding message digest through decryption, and at the same time the target resource performs hash calculation on the resource access instruction to generate a new message digest; the two message digests are compared, and if they are consistent, it is confirmed that the resource access instruction has not been tampered with and comes from a legal MCP server, i.e., the integrity and authenticity of the resource access instruction are confirmed, and then the server digital signature that passes the verification is obtained.

[0030] Step 23, based on the server digital signature that passes the verification, the timestamp information in the resource access instruction is parsed, a time window verification algorithm is used to check the timeliness of the timestamp, and it is confirmed that the instruction is within the valid time range, to obtain the result of the server timestamp timeliness verification that passes the verification, which specifically includes: based on the server digital signature that passes the verification, the target resource parses the resource access instruction to extract the timestamp information contained therein; then the target resource enables the time window verification algorithm, which first obtains the current system time of the target resource, and then determines the start and end ranges of the time window according to the preset valid time threshold; the extracted timestamp is compared with the time window, and if the timestamp is within the time window, it is confirmed that the resource access instruction is within the valid time, i.e., the timeliness of the instruction is confirmed, thereby obtaining the result of the server timestamp timeliness verification that passes the verification.

[0031] Step 24, based on the result of the server timestamp timeliness verification, combined with the passing state of the server digital certificate and the server digital signature verification, the final processing result of confirming that the MCP server identity authentication is successful and the digital signature verification is passed, specifically including: after obtaining the result of the server timestamp timeliness verification, the target resource will integrate the passing state of the server digital certificate verification and the passing state of the server digital signature verification, and the three verification results are summarized and judged, when the three verification results are all passed, the target resource finally confirms that the MCP server identity is legal and the digital signature sent by it is valid, that is, the processing result of MCP server identity authentication is successful and the digital signature verification is passed.

[0032] In the embodiment of the application, by verifying the legality and validity period of the server digital certificate issuing authority, it can be ensured that the access request received by the target resource comes from the MCP server authenticated by a trusted agency and in an effective state, avoiding the target resource responding to the instructions of an untrusted server; based on the server digital certificate verification passed, the public key is extracted to decrypt and verify the server digital signature, which can confirm that the digital signature is indeed generated by the corresponding MCP server through the corresponding relationship between the public key and the private key, and at the same time, through the consistency of the signature and the resource access instruction, it is ensured that the resource access instruction has not been tampered with in the transmission process; the time window verification algorithm is used to check the timeliness of the timestamp in the resource access instruction, which can judge whether the instruction is sent within the effective time by setting a reasonable time window range, effectively resisting replay attacks; the verification results of the server digital certificate, the digital signature and the timestamp are integrated to finally confirm the validity of the MCP server identity and the signature, which can form a complete security verification closed loop through the superposition effect of multi-dimensional verification, and ensure that only the legal access request that has passed comprehensive verification can be recognized by the target resource.

[0033] In a preferred embodiment of the application, step 3 above comprises: Step 31, based on the processing result of MCP server identity authentication being successful and the digital signature verification being passed, the target resource executes the operation instruction defined in the resource access instruction to generate the original execution result data, specifically including: The target resource here is the backend customer transaction database that the intelligent customer service system needs to access. After confirming that the MCP server identity is legal through its own verification logic, i.e., the server digital certificate is issued by a trusted agency and is within the valid period, the digital signature matches the resource access instruction and there is no tampering, the internal instruction execution and data generation process is started. First, the initialization operation is completed, the preset instruction parsing rule library is loaded, which includes the operation instruction format specified in the MCP protocol, the database field mapping relationship and the data authority verification standard. At the same time, the historical verification log of communication with the MCP server is called to confirm that this access is a continuous legal session to avoid illegal reconnection after interrupting the session.

[0034] Next, the operation instruction in the resource access instruction is deeply parsed, and the operation type identifier (here the operation type identifier is customer transaction record query), the target customer unique identifier (such as customer ID number 110101XXXX0101XXXX or system customer ID CUST202405XXXX), the time range condition (such as the last month, which will be automatically converted to a specific time interval, for example, if the current time is May 20, 2024, the converted time interval is from April 20, 2024, 00:00:00 to May 20, 2024, 23:59:59), and the transaction field list to be returned (such as transaction time, transaction amount, transaction channel, transaction object, transaction status) are extracted from the instruction field. At the same time, the parsed content is verified for legality, including whether the customer identifier conforms to the database storage format (such as the ID number needs to be 18 digits, the customer ID needs to be in the format of CUST plus 8 digits), whether the time range is valid (the start time cannot be later than the end time, and the end time cannot be later than the current system time), whether the field list is within the range of allowed query in the database (excluding sensitive fields such as customer bank card complete number and password hash value), if the verification fails, a temporary result of illegal instruction parameters is generated, if the verification passes, the data query link is entered.

[0035] Subsequently, a call is initiated to the V3.1 version of the customer transaction data query interface inside the database (this interface is a special interface preset for the database, and only allows authenticated external systems such as the MCP server to call through legal instructions); when initiating the call, the parsed legal parameters (customer ID, time interval, field list) are packaged into a query request package in the format required by the interface, with the interface call credentials (which include the internal identity of the target resource DB-CUST-TRADE-001 and the temporary authorization code for this session) attached, to ensure that the interface only responds to requests for this legal session; after the interface receives the request package, it first verifies the validity of the credentials (whether the temporary authorization code is within the valid period and whether it is bound to the MCP server session), then locates the customer's exclusive data partition in the database according to the customer ID (the database uses a partitioned storage method, and each customer's transaction data is stored independently in the corresponding partition, which not only improves query efficiency but also enhances data security), and then executes the query logic to traverse all records in the transaction record table that meet the time interval in this partition, filters out field data that matches the field list, and filters out abnormal data (such as transaction amounts that are negative, invalid records with an incomplete transaction status and more than 72 hours), and finally extracts 35 customer transaction records that meet the conditions.

[0036] In the process of generating original data, the geometric feature hash algorithm preprocessing flow is started synchronously to process the extracted transaction record data: first, the key numerical field (such as transaction amount, for example, 198.50 yuan, 5000.00 yuan, which will be converted to integer form 19850, 500000 to avoid floating point error; also the transaction timestamp, which will convert the transaction time 2024-04-25 14:30:21 to Unix timestamp 1714060221) is selected from each transaction record; then the two values of each record are mapped to a feature point in two-dimensional space, where the converted integer of the transaction amount is the x coordinate of the feature point, and the transaction timestamp is the y coordinate of the feature point (for example, the transaction amount of a certain record is 198.50 yuan, and the timestamp is 1714060221, the corresponding feature point is XXXXXX and XXXXXXXXXXXX); then the spatial distribution characteristics of all 35 feature points are calculated: first, the center point coordinates of the feature points are calculated, the calculation method is to sum all x coordinates and divide by 35 to get the center point x value, and sum all y coordinates and divide by 35 to get the center point y value; second, the distance of each feature point to the center point is calculated, the calculation logic is based on the calculation method of the distance between two points in the rectangular coordinate system, that is, the square root of the sum of the square of the difference between the x coordinates and the square of the difference between the y coordinates; third, after arranging the feature points in ascending order of transaction timestamp, the angle formed by the adjacent two feature points and the center point is calculated, taking the center point as the origin and the x axis as the positive direction, the direction of the line connecting the adjacent feature points and the center point is determined to determine the angle range; finally, these spatial feature information is packaged into a geometric feature preprocessing field, which contains the total number of feature points 35, the center point coordinates XXXXXX and XXXXXXXXXXXX, the average distance XXXX, and the angle deviation range XX° to XX°.

[0037] Finally, the three parts are integrated into the original execution result data through the instruction execution and data generation process. The first part is the basic information section, which contains the instruction ID of this query (the ID is consistent with the resource access instruction ID sent by the MCP server, used for association matching), query execution time (for example, May 20, 2024, 15:02:30), and 35 valid data entries. The second part is the transaction record data section, which is stored in a structured form (such as a table data structure) and contains 35 transaction records. Each record contains transaction time, transaction amount, transaction channel, transaction object, and transaction status. The field values are consistent with the original database storage and are not tampered with. The third part is the geometric feature preprocessing section, which is the geometric feature preprocessing field encapsulated above. After the integrated original execution result data is checked for integrity, it is confirmed that the three parts have no missing content, the field mapping is correct, and the number of feature points is consistent with the number of transaction records. Then it is stored in the temporary data cache area of the target resource (this cache area is only visible to this session and will be automatically emptied after the session ends), completing the generation of the original execution result data.

[0038] In step 32, based on the original execution result data, a data block algorithm is used to cut it, and the block execution result data is obtained. Specifically, it includes: The target resource first counts and analyzes the number of bytes of the original execution result data stored in the temporary data cache area. After detection, the original execution result data contains three parts, including a basic information section of about 280 bytes, a transaction record data section storing 35 transaction records (each record contains 5 fields, with an average of about 65 bytes per record) totaling about 2275 bytes, and a geometric feature preprocessing section of about 420 bytes. The total data volume is about 2975 bytes. The system preset maximum transmission threshold for single block data is 1024 bytes. The current total data volume exceeds this threshold, and direct transmission may cause network transmission timeout or data packet loss, so the block processing process needs to be started.

[0039] When entering the chunk processing flow, first load the structure mapping rule of the original execution result data, and map the original execution result data to a virtual two-dimensional data plane according to the functional area; wherein the rows of the two-dimensional data plane correspond to the functional partitions of the original data, and the columns correspond to the data unit quantity in each functional partition; the specific mapping logic is: the first row is allocated to the basic information segment, because the basic information segment is integral metadata (including instruction ID, query execution time, and valid data quantity) that cannot be split, so this is a single column structure, corresponding to the first row and the first column area in the two-dimensional plane; the second row is allocated to the transaction record data segment, which contains 35 structured transaction records, and according to the maximum transmission threshold of a single block, each column can accommodate at most 12 transaction records (12 records are about 780 bytes, less than the 1024 byte threshold), so this is a three-column structure, corresponding to the second row and the first column, the second row and the second column, and the second row and the third column in the two-dimensional plane; the third row is allocated to the geometric feature preprocessing segment, which is integral feature data (including the total number of feature points, the center point coordinates, the average distance, and the angle deviation range) that cannot be split, so this is a single column structure, corresponding to the third row and the first column area in the two-dimensional plane; finally, the entire original execution result data is mapped to a virtual two-dimensional data plane of 3 rows and 4 columns, and a total of 5 non-overlapping grid cells are divided (1 in the first row, 3 in the second row, and 1 in the third row).

[0040] Subsequently, the two-dimensional data plane is physically cut according to the preset grid size (the row height corresponds to the byte length of each functional partition, and the column width corresponds to the maximum byte number of the single column data in each functional partition) to form 5 independent grid cells; during the cutting process, the byte number of each grid cell is checked in real time: the byte number of the first row and the first column grid cell (corresponding to the basic information segment) is about 280 bytes, meeting the threshold requirement; the byte number of the second row and the first column grid cell (corresponding to the first 12 transaction records) is about 780 bytes, the byte number of the second row and the second column grid cell (corresponding to the middle 12 transaction records) is about 780 bytes, the byte number of the second row and the third column grid cell (corresponding to the last 11 transaction records) is about 715 bytes, all meeting the threshold requirement; the byte number of the third row and the first column grid cell (corresponding to the geometric feature preprocessing segment) is about 420 bytes, meeting the threshold requirement.

[0041] After the cutting is completed, the corresponding data content is extracted from each grid cell: the complete basic information segment data is extracted from the first row and the first column of the grid cell, including the instruction ID, the query execution time, and the number of valid data; the complete field data of the first to 12th transaction records (each record contains transaction time, transaction amount, transaction channel, transaction object, and transaction status) is extracted from the second row and the first column of the grid cell; the complete field data of the 13th to 24th transaction records is extracted from the second row and the second column of the grid cell; the complete field data of the 25th to 35th transaction records is extracted from the second row and the third column of the grid cell; and the complete geometric feature preprocessing segment data is extracted from the third row and the first column of the grid cell, including the total number of feature points, the center point coordinates, the average distance, and the angle deviation range.

[0042] Next, exclusive identification information is added to each extracted data block: first, grid coordinate identification, in the format of row number-column number, wherein the block identification corresponding to the first row and the first column of the grid cell is row 1 column 1, the block identification corresponding to the second row and the first column is row 2 column 1, the block identification corresponding to the second row and the second column is row 2 column 2, the block identification corresponding to the second row and the third column is row 2 column 3, and the block identification corresponding to the third row and the first column is row 3 column 1; second, block serial number, arranged according to the row priority of the grid cell in the two-dimensional plane, wherein row 1 column 1 is block 1, row 2 column 1 is block 2, row 2 column 2 is block 3, row 2 column 3 is block 4, and row 3 column 1 is block 5; and third, total grid number identification, which clearly indicates that the total number of grid cells in this block is 5; the identification information of each block is added to the header of the block data, forming a structure of identification header plus data body, wherein the identification header includes three fields of grid coordinates, block serial number, and total grid number, and the data body is the original data content extracted from the corresponding grid cell.

[0043] Finally, integrity check is performed on all the block data: the identification information of each block is checked one by one to ensure that it is unique and has no duplication, the data body of each block is checked to ensure that it contains all the data of the corresponding grid cell (for example, block 2 needs to confirm that it contains all the fields of the first to 12th transaction records without missing), and the data bodies of all blocks are merged to ensure that they are completely consistent with the original execution result data (through byte number comparison and key field check); after the check is passed, the five block execution result data with grid coordinate identification are stored in the block data cache area of the target resource, and the cache area is stored in order according to the block serial number.

[0044] In step 33, based on the block execution result data, a current timestamp information is added to construct response data containing block execution result and timestamp, specifically including: The target resource first establishes a connection with a trusted time server designated by the system through a preset network protocol for time synchronization. After the connection is established, a time request instruction is sent to the trusted time server to request the current standard time. After receiving the request, the trusted time server returns time data with an accuracy of year, month, day, hour, minute, second, and microsecond, along with a timestamp signature of the server itself (used to verify that the time data has not been tampered with). After receiving the time data, the validity of the server timestamp signature is verified to confirm that the time data comes from a trusted server and has not been modified. Then, the received standard time is compared with the local system time of the target resource to calculate the time deviation value. If the deviation value is less than the preset allowed deviation threshold (such as 50 milliseconds), the standard time is directly used as the current timestamp. If the deviation value exceeds the threshold, the local time calibration process is started, and the local system time is adjusted to be consistent with the standard time before obtaining the calibrated time as the current timestamp. The final timestamp format is YYYY-MM-DDHH:MM:SS.ssssss, for example, 2024-05-2015:05:42.123456, which will be used to mark the generation time of the response data.

[0045] Subsequently, the response data is constructed according to a preset response data structure template. The template defines that the response data must include three core parts: header meta-information, chunk data, and verification information, and each part must be arranged in a fixed order to ensure that the receiver can correctly parse it.

[0046] In constructing the header meta-information, the timestamp obtained above is first filled into the timestamp field of the header meta-information. Then, the total grid size information is extracted from the chunked execution result data generated in step 32. Since the original execution result data in step 32 is mapped to a virtual two-dimensional data plane with 3 rows and 4 columns, the total grid size is recorded as 3 rows and 4 columns and filled into the corresponding field. Finally, the total number of chunked execution result data is counted, and step 32 generates 5 data chunks, so the total number of chunks is recorded as 5 and filled into the corresponding field. At the same time, the header meta-information also needs to add a response data identification field, which is a randomly generated unique string (32 bits long), used to uniquely identify the generated response data to avoid confusion with other response data. Finally, the header meta-information contains four fields: timestamp, total grid size, total number of chunks, and response data identification, arranged in the order of response data identification, timestamp, total grid size, and total number of chunks.

[0047] When constructing the chunked data part, the five chunked execution result data generated by step 32 is read from the chunked data cache area, and the chunked data is arranged in the order of grid coordinate row priority (i.e., first by row number from small to large, and then by column number from small to large in the same row). The specific arrangement order is: first, arrange chunk 1 (basic information segment data) corresponding to row 1 column 1, then arrange chunk 2 (1st to 12th transaction record) corresponding to row 2 column 1, then arrange chunk 3 (13th to 24th transaction record) corresponding to row 2 column 2, then arrange chunk 4 (25th to 35th transaction record) corresponding to row 2 column 3, and finally arrange chunk 5 (geometric feature preprocessing segment data) corresponding to row 3 column 1. At the front end of each chunk data, the grid coordinate identifier, chunk number, and total grid number identifier added by step 32 are retained to ensure that the receiving party can clearly determine the position of each chunk in the original data plane and the overall chunking situation. After the arrangement is completed, the chunked data part forms a continuous data stream, and each chunk is distinguished by a predetermined separator (a fixed character sequence of 8 bits in length) to avoid parsing errors after the chunked data is spliced.

[0048] When constructing the verification information part, the geometric feature hashing algorithm processing flow is used to first traverse each chunk of the chunked data part and extract data related to the spatial feature: for chunk 2, chunk 3, and chunk 4 (all transaction record data chunks), the feature point coordinates corresponding to the transaction records in each chunk are extracted (i.e., the integer corresponding to the transaction amount after conversion and the Unix timestamp corresponding to the transaction timestamp); for chunk 1 (basic information segment) and chunk 5 (geometric feature preprocessing segment), the grid coordinate identifier and key metadata of the chunk (such as the instruction ID of chunk 1 and the total number of feature points of chunk 5) are extracted; then, all the extracted data is integrated according to the chunk arrangement order to form a data set containing the association relationship between spatial feature points and metadata; then, the data set is subjected to hash calculation. In the calculation process, the numerical data (such as feature point coordinates and grid coordinates) in the data set is first converted into a fixed-length byte stream, and then the non-numerical data (such as instruction ID) is converted into a byte stream according to a predetermined encoding rule. Finally, after all the byte streams are spliced, a fixed-length (such as 256 bits) hash value is generated by the geometric feature hashing algorithm. This hash value is the geometric feature check code of the entire response data. After generating the check code, a local verification is performed to compare the check code with the recalculated data set hash value to confirm that the check code is generated correctly.

[0049] Finally, the header meta-information, the chunked data and the check information are spliced in the order of the header meta-information, the chunked data and the check information to form complete response data. After splicing, the whole byte number of the response data is counted and the structure is checked to confirm that the total number of chunks of the header meta-information is consistent with the actual number of chunks of the chunked data, the arrangement order of the chunked data conforms to the grid coordinate row priority rule, the geometric feature check code format of the check information is correct and the verification is passed. After the check is passed, the complete response data is stored to the response data cache area of the target resource.

[0050] At step 34, based on the response data containing the chunked execution result and the timestamp, the target resource private key is used to calculate the signature by a digital signature algorithm to generate a target resource digital signature, specifically including: The target resource first establishes a connection with a local hardware security module (which is a physical device specially used for storing encryption keys and has tamper-proof and mandatory access control functions), sends a key calling request to the hardware security module, and the request contains the device identification of the target resource and the permission token of the current signature operation. The permission token is generated by the security chip of the target resource in real time and contains the operation time and the device unique code. The hardware security module verifies the legality of the device identification and the permission token, confirms that the request comes from an authorized operation, unlocks the encrypted partition storing the private key of the target resource, and transmits the private key to the target resource in the form of an encrypted data stream. In the transmission process, a hardware-level encryption channel is used to prevent the key from being stolen in transmission. After receiving the private key, the target resource temporarily decrypts and verifies the validity of the key in the memory: checks whether the format of the key conforms to the preset asymmetric encryption standard, and confirms that the use period of the key is within the valid period. After no error is found, the key is temporarily stored in the encrypted buffer area of the memory to avoid persistent storage to prevent leakage.

[0051] At the same time, the target resource loads the digital signature algorithm fused with the geometric feature (the algorithm consists of two parts: the basic part is a non-symmetric signature algorithm conforming to the national cryptographic standard, which is used to realize the traditional digital signature function; the extended part is the geometric feature fusion logic, which is used to embed the spatial feature information into the signature process). Before loading, the integrity of the algorithm program is verified: the hash value of the algorithm program is compared with the preset reference value to confirm that the algorithm has not been tampered with. Then, the algorithm running environment is initialized, independent memory space and operation resources are allocated to prevent resource conflicts with other processes, and the independence and security of the signature calculation process are ensured.

[0052] Into the hash processing phase, the target resource reads the complete response data from the response data cache area, and converts the entire response data into a continuous binary byte stream in the order of header meta-information, chunk data, and check information, while recording the total length of the byte stream and the starting offset of each part; then the traditional hash calculation is performed: using a hash function matching the basic part of the algorithm, the extracted byte stream is segmented according to the maximum processing unit (such as 64 bytes) specified by the algorithm, and the iterative hash operation is performed on each piece of data in turn, and finally a fixed-length byte stream hash value (such as 256 bits) is generated, which uniquely corresponds to the original content of the response data.

[0053] Subsequently, the geometric feature fusion process is started, the geometric feature check code generated in step 33 is extracted from the check information part of the response data, and the check code is converted into a binary sequence with the same length as the byte stream hash value; a composite message digest containing data content and spatial features is generated through a preset fusion rule (bitwise logical operation, XOR operation is performed on the corresponding bits of the byte stream hash value and the geometric feature check code); after the composite message digest is generated, it is checked whether its format meets the algorithm requirements and whether there are abnormal values, to ensure that the subsequent encryption process can proceed normally.

[0054] After completing the generation of the composite message digest, the encryption processing phase is entered: the target resource private key is called from the encryption buffer area in the memory, and the composite message digest is encrypted using the asymmetric encryption mechanism of the basic part of the algorithm. When encrypting, the composite message digest is grouped according to the key length, and the private key is applied to each group of data to perform mathematical operations. During the operation process, temporary random numbers generated by the random number generator are combined (to enhance the anti-forgery ability of the signature), and after multiple rounds of operation, a continuous binary data string, i.e. a preliminary digital signature, is generated. At the same time, key parameters (including random numbers and operation rounds) in the encryption process are recorded for parameter matching in subsequent verification.

[0055] To ensure the validity of the signature, the target resource starts the geometric feature reverse verification: first, extract the public key from the digital certificate of the target resource (the public key and the private key used before are a pair of asymmetric keys), use the public key to decrypt the preliminary digital signature, and restore the composite message digest before encryption through the inverse operation corresponding to the encryption process; then the restored composite message digest is reversely split according to the fusion rule to obtain the original byte stream hash value and the geometric feature check code.

[0056] The two parts are checked respectively: for the byte stream hash value, the response data is hashed again, and the newly generated hash value is compared with the split byte stream hash value to confirm that they are completely consistent; for the geometric feature check code, the original geometric feature check code is extracted from the check information of the response data, and compared with the split check code to confirm that they are completely consistent; if both parts pass the check, the preliminary digital signature is determined to be valid; if any part is inconsistent, the signature is determined to be invalid, and the signature generation process needs to be restarted to check for abnormalities in the hash calculation or encryption process (such as data transmission errors, key calling abnormalities, etc.).

[0057] After verification, the preliminary digital signature is converted to a format that meets the transmission standard (such as Base64 encoding), and signature identification information (including signature algorithm version, generation time (consistent with the timestamp of the response data), and feature fusion identification (used to indicate that the signature contains geometric feature information)) is added. The final target resource digital signature is composed of encoded signature data and identification information in a fixed structure, ensuring that the receiver can correctly parse the signature content. The digital signature is stored in the signature cache area and associated with the response data (through the response data identifier for quick matching), preparing for subsequent encapsulation operation response.

[0058] Step 35, based on the target resource digital signature and the constructed response data, the operation response containing the target resource digital certificate, digital signature and response data is sent to the MCP server through the secure transmission protocol, wherein the target resource digital certificate contains the public key information and identity of the target resource, specifically including: The target resource first performs a certificate retrieval operation, connecting to a local encryption certificate repository (which is divided into different partitions according to resource type, and the target resource's customer transaction database certificate is stored in a dedicated database certificate partition, which is protected by a hardware encryption lock and requires multi-factor authentication to access). Send a certificate retrieval request to the encryption certificate repository, carrying the target resource's device unique code, the current operation session ID, and its own permission certificate; the encryption certificate repository verifies the request information: first, check whether the device unique code is consistent with the target resource code pre-stored in the repository, then verify whether the session ID is the current legal session (bound to the communication session with the MCP server), and finally verify the validity of the permission certificate (whether it is issued by the system security center and within the valid period). After verification, the encryption certificate repository unlocks the database certificate partition, extracts the target resource digital certificate and transmits it to the target resource through an encrypted channel.

[0059] After receiving the digital certificate, the target resource checks the integrity and legality of the certificate content: first, check whether the certificate format conforms to the X.509 standard, confirm that the certificate contains the version number, serial number, signature algorithm identifier, issuing authority name, validity period, target resource subject name, subject public key information, issuing authority signature and other fields; then verify the issuing authority signature of the certificate, decrypt the issuing authority signature by calling the locally pre-stored public key of the trusted issuing authority root certificate, and compare it with the hash value of the certificate subject information to confirm that the certificate has not been tampered with; then check the certificate validity period, compare the current time with the start time and end time in the certificate to ensure that the certificate is in a valid state; finally, query the certificate revocation list to confirm that the certificate has not been revoked by the issuing authority. After the verification is passed, the key information in the certificate (including the identity of the target resource, that is, the system unique ID of the customer transaction database such as DB-CUST-TRADE-001, and the subject public key data conforming to the RSA2048 encryption standard) is extracted, and the complete certificate is temporarily stored in the certificate cache area.

[0060] Subsequently, the target resource encapsulates the operation response according to the system preset operation response message format template (the template defines the message into three parts: message header, message middle part and message tail, each part is divided according to fixed byte length, and contains field identification and length identification, which is convenient for MCP server parsing): When encapsulating the message header, read the target resource digital certificate from the certificate cache area, write the certificate data completely into the certificate field of the message header, and add the certificate length field (record the total number of bytes of the certificate such as 2048 bytes), the message version number field (the current version is V2.1), and the message type identification field (identify the message as an operation response, the type code is 0x02); the header fields are arranged in the order of version number, message type, certificate length, and certificate data, and the total length is fixed at 2080 bytes.

[0061] When encapsulating the message middle part, read the target resource digital signature from the signature cache area, write the signature data (including the encoded signature content and identification information) into the signature field of the message middle part, and add the signature length field (record the number of bytes of the signature such as 512 bytes); then read the complete response data from the response data cache area, write it into the response data field of the middle part, and add the response data length field (record the total number of bytes of the response data such as 3200 bytes); the middle part fields are arranged in the order of signature length, signature data, response data length, and response data, and the length is dynamically adjusted according to the actual number of bytes of the signature and response data, and 4-byte separation identifiers are added between the fields to avoid data concatenation confusion.

[0062] When encapsulating the tail of the packet, the transmission check information is generated based on the spatial grid segmentation algorithm: first, the sum of the grid coordinates of each block is calculated, and the grid coordinates (row 1 column 1, row 2 column 1, row 2 column 2, row 2 column 3, row 3 column 1) of the five blocks in step 32 are converted into numerical values (11, 21, 22, 23, 31) according to the rule of row number x 10 + column number, and the sum is 108, which is the grid coordinate sum field; then the expected receiving order field is determined, and the grid coordinate sequence of the block (row 1 column 1-row 2 column 1-row 2 column 2-row 2 column 3-row 3 column 1) is recorded according to the row priority order; finally, the CRC32 check value of the whole packet is calculated, and the CRC32 operation is performed on all the data in the header and the middle part of the packet to obtain a 4-byte check value; the tail field is arranged in the order of grid coordinate sum, expected receiving order, and overall CRC32 check value, and the total length is fixed at 64 bytes (coordinate sum 4 bytes + receiving order 40 bytes + CRC32 check value 4 bytes + reserved 16 bytes).

[0063] After encapsulation, the target resource performs integrity check on the entire operation response packet: checks whether the certificate length in the packet header is consistent with the actual certificate byte number, whether the signature length and response data length in the middle part are consistent with the actual byte number of the corresponding data, and whether the grid coordinate sum in the tail part is consistent with the block coordinate calculation result. After the check is passed, the operation response packet is stored in the transmission buffer area.

[0064] Next, the target resource enables the TLS secure transmission protocol to establish an encrypted communication channel with the MCP server: first, the TLS handshake request is sent to the MCP server, and the request includes the TLS version supported by the target resource (preferably TLS1.3), the encryption suite list (supporting ECDHE-ECDSA-AES256-GCM-SHA384 security suite), and the random number A; the MCP server returns the TLS handshake response, including the selected TLS version (TLS1.3), the selected encryption suite (ECDHE-ECDSA-AES256-GCM-SHA384), the random number B, and the digital certificate of the MCP server; the target resource verifies the MCP server certificate (verifies the certificate signature through the public key of the trusted issuing authority root certificate, checks the certificate validity period and revocation status, confirms that the MCP server identity is legal, and extracts the MCP server public key in the certificate).

[0065] Subsequently, the target resource generates a temporary key pair using the ECDHE algorithm, and sends the public key part to the MCP server after encrypting it with the MCP server public key; the MCP server receives it and decrypts it with its own private key to obtain the temporary public key, and both parties calculate and generate a session key (used for subsequent data encryption transmission) based on the random number A, the random number B, and the temporary key pair; the target resource and the MCP server exchange session key verification information, and after confirming that the session keys generated by both parties are consistent, the encrypted communication channel is established, and the subsequent transmitted data is all encrypted using the session key for AES256-GCM encryption.

[0066] During transmission, the target resource uses a block transmission mechanism to split the operation response message in the transmission buffer area by 1024 bytes, encrypts each block and sends it to the designated receiving port (port number 8443, designed for MCP protocol secure communication) of the MCP server; after each block is transmitted, the MCP server returns block reception confirmation information (including the reception status of the block such as success or failure, and the block sequence number); the target resource synchronously performs real-time verification when receiving the confirmation: checks whether the block sequence number fed back by the MCP server is consistent with the transmission sequence, if the corresponding block contains a block data (response data in the middle of the message), it additionally checks whether the block grid coordinates corresponding to the block are within the preset 3-row 4-column space grid range (such as block 2 corresponding to row 2 column 1, it needs to confirm that the row number ≤ 3, the column number ≤ 4), and whether the coordinates are within the expected receiving sequence. If the verification finds that the block sequence number is disordered or the grid coordinates are abnormal, the transmission is immediately stopped, a retransmission request is sent to the MCP server to resend the abnormal block; if the retransmission is still abnormal for 3 times in a row, the transmission is terminated and an abnormal log is recorded, and an alarm information is sent to the system security center.

[0067] When all blocks are transmitted and the reception confirmation is correct, the target resource sends a transmission completion notification to the MCP server (including the total number of blocks, the total number of bytes, and the overall CRC32 check value of the message tail); the MCP server receives the notification, recombines all the received blocks, calculates the CRC32 check value of the recombined message, compares it with the check value sent by the target resource, confirms the message integrity, and returns a transmission success response. After receiving the transmission success response, the target resource records the transmission log (including the transmission time, MCP server address, message length, transmission time consumption, and check result), clears the temporary data in the transmission buffer area, certificate buffer area, and signature buffer area, and completes the secure transmission of the response data.

[0068] In the embodiment of the present application, the operation instruction is executed based on the result that the MCP server identity and the signature are both verified, ensuring that the target resource only responds to legitimate instructions that have passed strict authentication, guaranteeing the safety and controllability of system resources from the execution link, and the original execution result data generated is the basis for subsequent response; the data block algorithm is used to cut the original execution result data, decomposing the possibly large original data into multiple blocks, facilitating subsequent data transmission and processing; the current timestamp is added to the block execution result data, so that the response data has a time identifier, which cooperates with the subsequent verification link to enable the receiver to accurately determine the generation time of the response data, providing a key basis for verifying the timeliness of the response; the target resource private key is used to sign the response data containing the block execution result and the timestamp, tightly binding the identity of the target resource with the response data, and the receiver can confirm that the response data indeed comes from the target resource and has not been tampered with in the transmission process through the corresponding public key verification signature, guaranteeing the authenticity, integrity and reliability of the source of the response data; the target resource digital certificate, digital signature and response data are integrated into an operation response and sent through a secure transmission protocol, the target resource digital certificate provides the public key and identity for identity verification, and the secure transmission protocol ensures that the operation response is not tampered with in the transmission process, forming protection from two aspects of identity verification and transmission security, so that the MCP server can safely and accurately receive and process the response data.

[0069] In a preferred embodiment of the present application, the above step 4 comprises: Step 41, after the MCP server receives the operation response sent by the target resource, the response content is parsed to obtain the target resource digital certificate, the legality of the issuing authority of the digital certificate is verified according to the certificate authority trust list, and the validity period is checked to be in the valid state, and the target resource digital certificate that passes the verification is obtained, specifically including: after the MCP server receives the operation response sent by the target resource, a response parsing program is started to parse the operation response, and the target resource digital certificate contained therein is extracted; then the MCP server calls the locally stored certificate authority trust list, compares the issuing authority information recorded in the target resource digital certificate with the authority information in the trust list, to verify whether the issuing authority belongs to the trusted range; at the same time, the MCP server checks the start time and the end time of the validity period recorded in the target resource digital certificate, to determine whether the current time is within the validity period; through the above verification, it is confirmed that the target resource digital certificate is legal and valid, so that the target resource digital certificate that passes the verification is obtained.

[0070] Step 42, based on the target resource digital certificate, extract the target resource public key information contained therein, use the public key to decrypt the target resource digital signature in the operation response through an asymmetric decryption algorithm, confirm the integrity and authenticity of the response data, and obtain a verified target resource digital signature, specifically including: after obtaining the verified target resource digital certificate, the MCP server extracts the public key information of the target resource from the certificate; then the MCP server loads the preset asymmetric decryption algorithm, uses the extracted target resource public key to decrypt the target resource digital signature contained in the operation response, and obtains the corresponding message digest through decryption; at the same time, the MCP server will generate a new message digest by hashing the response data, and compare the two message digests. If they are consistent, it is confirmed that the response data has not been tampered with and comes from a legal target resource, that is, the integrity and authenticity of the response data are confirmed, and then a verified target resource digital signature is obtained.

[0071] Step 43, based on the verified target resource digital signature, parse the timestamp information in the response data, use a time window verification algorithm to verify the timeliness of the timestamp, confirm that the response data is within the valid time range, and obtain a result of target resource timestamp timeliness verification, specifically including: based on the verified target resource digital signature, the MCP server will parse the response data and extract the timestamp information contained therein; then the MCP server will enable the time window verification algorithm, which will first obtain the current system time of the MCP server, and then determine the start and end range of the time window according to the preset valid time threshold; compare the extracted timestamp with the time window, if the timestamp is within the time window, it is confirmed that the response data is within the valid time, that is, the timeliness of the response data is confirmed, and thus a result of target resource timestamp timeliness verification is obtained.

[0072] Step 44, based on the result of target resource timestamp timeliness verification, combined with the passing state of target resource digital certificate and target resource digital signature verification, finally confirm the processing result that target resource identity authentication is successful and digital signature verification is passed, specifically including: after obtaining the result of target resource timestamp timeliness verification, the MCP server will comprehensively consider the passing state of the target resource digital certificate and the passing state of the target resource digital signature verification, and make a summary judgment on the three verification results; when the three verification results are all passed, the MCP server finally confirms that the identity of the target resource is legal and the digital signature sent by it is valid, that is, the processing result that the target resource identity authentication is successful and the digital signature verification is passed is obtained.

[0073] In the embodiment of the present application, by verifying the legality and validity period of the target resource digital certificate, it can be ensured that the operation response received by the MCP server comes from the target resource authenticated by a trusted agency and in a valid state, filtering out the response corresponding to the certificate issued by an illegal agency or expired certificate from the source, avoiding the MCP server processing untrusted response data; based on the verified target resource digital certificate, the public key is extracted to decrypt and verify the target resource digital signature, which can confirm that the digital signature is indeed generated by the corresponding target resource through the corresponding relationship between the public key and the private key, and ensure that the response data has not been tampered with in the transmission process through the verification of the consistency of the signature and the response data, thereby protecting the integrity and authenticity of the response data; the time window verification algorithm is used to check the timeliness of the timestamp in the response data, which can judge whether the response data is generated within the valid time by setting a reasonable time window range, effectively resisting replay attacks on the response data; the verification results of the target resource digital certificate, digital signature and timestamp are combined to finally confirm the validity of the target resource identity and signature, which can form a complete response verification closed loop through the superposition effect of multi-dimensional verification, ensuring that only the legal response data that has been fully verified can be recognized and forwarded by the MCP server, thereby improving the security discrimination ability of the MCP server for the response data as a whole.

[0074] In a preferred embodiment of the present application, the above step 5 comprises: Step 51, based on the processing result of successful target resource identity authentication and passed digital signature verification, the MCP server extracts the execution result data from the verified response data, specifically including: in the case of successful target resource identity authentication and passed digital signature verification, the MCP server will process the verified response data, start the data parsing program to disassemble the response data, and filter and extract the execution result data which can accurately reflect the execution of the operation instruction.

[0075] Step 52, based on the execution result data, constructing an agent response message containing the execution result and a forwarding timestamp, wherein the forwarding timestamp is obtained from a trusted time source by using a time synchronization protocol, specifically including: according to the extracted execution result data, the MCP server will activate the message construction module, which will construct the agent response message according to the pre-set format of the agent response message in the system; first, fill the execution result data into the corresponding field in the message according to the format requirements, after this step, the MCP server will establish a communication connection with the trusted time source by using the time synchronization protocol; through the connection, the current standard time is obtained from the trusted time source, and the time is used as the forwarding timestamp; then the forwarding timestamp is added to the time field specially designed in the agent response message, and the complete agent response message containing the execution result and the forwarding timestamp is formed through such operation.

[0076] Step 53, based on the agent response message, it is forwarded to the agent through the secure transmission protocol, and the current authentication interaction process is completed, specifically including: after generating the agent response message, the MCP server will enable the preset secure transmission protocol in the system, and a secure communication link is established between the MCP server and the agent by using the protocol; after the communication link is established, the MCP server will deliver the constructed agent response message to the agent through the secure communication link; when the MCP server confirms that the agent has successfully received the response message, the complete authentication interaction process from the request initiated by the agent to the reception of the response by the agent is formally ended.

[0077] In the embodiment of the application, the execution result data is extracted based on the result that the target resource identity and the signature are both verified, ensuring that the execution result forwarded by the MCP server to the agent comes from a legal target resource that has passed strict authentication, avoiding incorrect judgments by the agent due to the use of unverified or illegal result data, and guaranteeing the reliability of the forwarded content from the data source; the agent response message containing the execution result and the forwarding timestamp is constructed, and the forwarding timestamp comes from a trusted time source, so that the response message has a unified and authoritative time identifier; this design not only facilitates the verification of the timeliness of the response by the agent, preventing the reception of expired or repeated result data, but also ensures the consistency of the time information through the trusted time source, avoiding verification deviations caused by the asynchronous time of each entity, and improving the time credibility of the response message; the agent response message is forwarded to the agent through the secure transmission protocol, and the encryption and protection mechanism of the secure transmission protocol is used to ensure that the response message is not tampered with or intercepted during the transmission from the MCP server to the agent, guaranteeing the security and integrity of the data transmission, and finally realizing the full-link secure interaction from the target resource to the agent, and completing the entire authentication process in a closed loop.

[0078] As shown in Figure 2 , the embodiment of the application also provides a secure MCP protocol authentication system, which comprises: The sending module is configured to, based on the processing result that the agent identity authentication is successful and the digital signature verification is passed, parse the target resource identifier by the MCP server, construct a resource access instruction containing the agent identity information, the operation instruction and a new timestamp, perform digital signature using a server private key, and send an access request containing a server digital certificate, a digital signature and a resource access instruction to the target resource; The verification module is configured to, by the target resource, receive the access request, verify the legality of the MCP server digital certificate, verify the digital signature using a server public key, and verify the integrity and timeliness of the resource access instruction. The response generation module is configured to generate response data containing an execution result and a timestamp based on the processing result that the MCP server identity authentication is successful and the digital signature verification is passed, use a private key of the target resource to perform digital signature, and send an operation response containing a digital certificate of the target resource, the digital signature, and the response data to the MCP server; The verification module is configured to verify the legality of the digital certificate of the target resource based on the received response data, verify the digital signature using a public key of the target resource, and check the integrity and timeliness of the response data, to obtain the processing result that the target resource identity authentication is successful and the digital signature verification is passed. The forwarding module is configured to forward the response data to the intelligent agent to complete the authentication process based on the processing result that the target resource identity authentication is successful and the digital signature verification is passed.

[0079] It should be noted that the system corresponds to the above method, and all implementation manners in the above method embodiment are applicable to this embodiment and can achieve the same technical effects.

[0080] Embodiments of the application also provide a computing device, comprising a processor and a memory storing a computer program, wherein the computer program is executed by the processor to perform the method described above. All implementation manners in the above method embodiment are applicable to this embodiment and can achieve the same technical effects.

[0081] The application aims to provide a technical security authentication scheme, which is only used to standardize the interaction logic among the intelligent agent, the MCP server and the target resource, does not involve the collection, storage and use of user privacy data, and does not bear the legal liability and risks caused by the illegal collection and leakage of user privacy (such as customer transaction records) by a third party.

[0082] The privacy-related examples mentioned in the application, such as "customer transaction records" and "customer identity", are only technical parameters listed to illustrate the application scenarios of the technical scheme, and do not represent that the application has the function of obtaining and processing actual user privacy data; when the application is actually applied, the application party should establish a compliant privacy protection mechanism according to relevant laws and regulations to ensure that the processing of user privacy data is legal, proper and necessary.

[0083] Any unit or individual using the application technology has nothing to do with the technical scheme and the patentee of the application in the event of user privacy leakage and data security incidents caused by not following the relevant laws and regulations of privacy protection, not establishing a perfect data security protection system, or third-party attacks, system vulnerabilities and other non-defects of the application technology, and the relevant responsibilities should be borne by the actual application party.

[0084] The above is the preferred embodiment of the present application, it should be noted that for those skilled in the art, without departing from the principles described in the present application, can also be made several improvements and refinements, these improvements and refinements should also be considered the scope of protection of the present application.

Claims

1. A secure MCP protocol authentication method, characterized in that, The method includes: Step 1: Based on the successful authentication of the agent's identity and the successful verification of the digital signature, the MCP server parses the target resource identifier, constructs a resource access instruction containing the agent's identity information, operation instructions and a new timestamp, performs digital signature using the server's private key, and sends an access request containing the server's digital certificate, digital signature and resource access instruction to the target resource. Step 2: The target resource receives the access request, verifies the legality of the MCP server's digital certificate, verifies the digital signature using the server's public key, and checks the integrity and timeliness of the resource access instruction. Step 3: Based on the successful authentication and digital signature verification results of the MCP server, the target resource executes the operation instructions, generates response data containing the execution results and timestamps, performs digital signature using the target resource's private key, and sends the operation response containing the target resource's digital certificate, digital signature, and response data to the MCP server. Step 4: The MCP server receives the operation response, verifies the legality of the target resource digital certificate based on the received response data, verifies the digital signature using the target resource public key, and checks the integrity and timeliness of the response data to obtain the processing result that the target resource identity authentication is successful and the digital signature verification is passed. Step 5: Based on the successful authentication of the target resource identity and the successful verification of the digital signature, the MCP server forwards the response data to the intelligent agent to complete the authentication process.

2. The secure MCP protocol authentication method according to claim 1, characterized in that, Before the agent's identity authentication is successful and the digital signature verification is passed, the following steps are also included: The agent generates an MCP call request instruction containing a target resource identifier, operation instructions, and a timestamp. Using an asymmetric encryption algorithm and the agent's private key, the agent performs digital signature processing on the call request instruction, generating an authentication request message containing the agent's digital certificate, digital signature, and call request instruction, and sends it to the MCP server. After receiving the authentication request message, the MCP server obtains the agent's digital certificate by parsing the message content, verifies the legality and validity of the digital certificate according to the pre-configured access control policy, and uses the agent's public key to decrypt and verify the digital signature through a cryptographic verification algorithm. At the same time, it verifies the data integrity and timestamp validity of the call request instruction, and obtains the processing result that the agent's identity authentication is successful and the digital signature verification is passed.

3. The secure MCP protocol authentication method according to claim 2, characterized in that, Step 1 includes: Based on the successful authentication of the intelligent agent's identity and the successful verification of the digital signature, the MCP server parses the target resource identifier contained in the call request instruction and determines the network address and access interface of the target resource through the resource identifier parsing algorithm. Based on the network address and access interface of the target resource, a resource access instruction is constructed that includes the agent's identity information, operation instructions and a new timestamp, wherein the new timestamp is obtained from a trusted time source using a time synchronization protocol; Based on the resource access command, the server's private key is used to perform a digital signature calculation to generate a server digital signature. Based on the server's digital signature and resource access instructions, an access request containing the server's digital certificate, digital signature, and resource access instructions is sent to the target resource via a secure transmission protocol. The server's digital certificate contains the MCP server's public key information and identity identifier.

4. The secure MCP protocol authentication method according to claim 3, characterized in that, Step 2 includes: After receiving the access request sent by the MCP server, the target resource parses the request content to obtain the server's digital certificate, verifies the legitimacy of the issuing authority of the digital certificate according to the Certificate Authority Trust List, and checks that the certificate is valid, thus obtaining the verified server digital certificate. Based on the verified server digital certificate, the MCP server public key information contained therein is extracted. Using this public key, an asymmetric decryption algorithm is used to decrypt and verify the server digital signature in the access request, confirming the integrity and authenticity of the resource access instruction, and obtaining the verified server digital signature. Based on the verified server digital signature, the timestamp information in the resource access instruction is parsed, and the time window verification algorithm is used to verify the timeliness of the timestamp. The instruction is confirmed to be within the valid time range, and the result of the server timestamp timeliness verification is obtained. Based on the successful verification of the server timestamp validity, combined with the successful verification of the server digital certificate and server digital signature, the final result confirms that the MCP server identity authentication and digital signature verification are successful.

5. The secure MCP protocol authentication method according to claim 4, characterized in that, Step 3 includes: Based on the successful authentication of the MCP server and the successful verification of the digital signature, the target resource executes the operation instructions defined in the resource access instruction and generates the original execution result data. Based on the original execution result data, a data segmentation algorithm is used to divide it into segments to obtain segmented execution result data; Based on the segmented execution result data, add the current timestamp information to construct response data containing the segmented execution results and timestamps; Based on the response data containing the segmented execution results and timestamps, the target resource's private key is used to perform a digital signature calculation using a digital signature algorithm to generate a digital signature for the target resource. Based on the target resource's digital signature and the constructed response data, the operation response, which includes the target resource's digital certificate, digital signature, and response data, is sent to the MCP server via a secure transmission protocol. The target resource's digital certificate contains the target resource's public key information and identity identifier.

6. The secure MCP protocol authentication method according to claim 5, characterized in that, Step 4 includes: After receiving the operation response sent by the target resource, the MCP server parses the response content to obtain the target resource's digital certificate, verifies the legitimacy of the issuing authority of the digital certificate according to the Certificate Authority Trust List, and checks that the certificate is valid, thus obtaining the verified target resource digital certificate. Based on the target resource digital certificate, extract the target resource public key information contained therein, and use the public key to decrypt and verify the target resource digital signature in the operation response using an asymmetric decryption algorithm to confirm the integrity and authenticity of the response data, and obtain the verified target resource digital signature. Based on the verified digital signature of the target resource, the timestamp information in the response data is parsed, and the time window verification algorithm is used to verify the timeliness of the timestamp. The response data is confirmed to be within the valid time range, and the result of the timeliness verification of the target resource timestamp is obtained. Based on the result of the successful verification of the target resource's timestamp validity, combined with the successful verification status of the target resource's digital certificate and digital signature, the final result confirms that the target resource's identity authentication and digital signature verification have been successful.

7. The secure MCP protocol authentication method according to claim 6, characterized in that, Step 5 includes: Based on the successful authentication of the target resource identity and the successful verification of the digital signature, the MCP server extracts the execution result data from the verified response data; Based on the execution result data, construct an agent response message containing the execution result and forwarding timestamp, wherein the forwarding timestamp is obtained from a trusted time source using a time synchronization protocol; Based on the agent's response message, it is forwarded to the agent through a secure transmission protocol to complete this authentication interaction process.

8. A secure MCP protocol authentication system, wherein the system implements the method as described in any one of claims 1 to 7, characterized in that, include: The sending module is used to parse the target resource identifier based on the processing result of successful agent identity authentication and digital signature verification. It constructs a resource access instruction containing agent identity information, operation instructions and a new timestamp, performs digital signature using the server's private key, and sends the access request containing the server's digital certificate, digital signature and resource access instruction to the target resource. The verification module is used to receive access requests for the target resource, verify the legality of the MCP server's digital certificate, verify the digital signature using the server's public key, and verify the integrity and timeliness of the resource access instructions. The response generation module is used to execute operation instructions on the target resource based on the processing result of successful identity authentication and digital signature verification on the MCP server, generate response data containing the execution result and timestamp, perform digital signature using the target resource's private key, and send the operation response containing the target resource's digital certificate, digital signature, and response data to the MCP server. The verification module is used by the MCP server to receive operation responses, verify the legality of the target resource digital certificate based on the received response data, verify the digital signature using the target resource public key, and check the integrity and timeliness of the response data, so as to obtain the processing result that the target resource identity authentication is successful and the digital signature verification is passed. The forwarding module is used to forward the response data to the intelligent agent to complete the authentication process based on the successful authentication of the target resource identity and the successful verification of the digital signature.

9. A computing device, characterized in that, include: One or more processors; A storage device for storing one or more programs, which, when executed by one or more processors, cause the one or more processors to implement the method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a program that, when executed by a processor, implements the method as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Apparatus and method for providing authentication, non-repudiation, governed access and twin resolution for data utilizing a data control signature

    CN113348455A

  • AI interactive data protection method and system based on security context protocol

    CN120200863A

  • Data processing method and device based on context protocol, equipment and medium

    CN120542540A

  • Resource acquisition method and system, server and storage medium

    EP4131045A1

  • Methods and systems for a distributed certificate authority

    US20220158855A1

Cited By

  • Intelligent agent data signature method and device and storage medium

    CN121441514A

  • Intelligent agent data signing method and device, and storage medium

    CN121441514B