Certificate updating method, program product, electronic equipment and storage medium

By generating an update SDK and utilizing a configuration center and a canary release mechanism, the restart issue during certificate updates was resolved, enabling certificate updates without restarting the service, thus improving business continuity and user experience.

CN120915461APending Publication Date: 2025-11-07CHENGDU NEW HOPE FINANCIAL INFORMATION CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511098977.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-06
Publication Date
2025-11-07

AI Technical Summary

Technical Problem

Existing technology requires a system restart when renewing certificates, which affects user experience and business continuity.

Method used

By generating an update SDK, the loading environments of the original certificate and the updated certificate are securely isolated. Certificates can be updated without restarting the service. The configuration center and canary release mechanism are used to accurately match and manage the routing of certificate identifiers, ensuring business stability and user experience.

Benefits of technology

This enables certificate updates without restarting the service, improving business continuity and user experience, and reducing interference with the original business and the risk of concurrent conflicts.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120915461A_ABST
    Figure CN120915461A_ABST
Patent Text Reader

Abstract

The invention provides a certificate updating method, a program product, electronic equipment and a storage medium. The method comprises the following steps: acquiring an updated SDK generated according to an original SDK; obtaining an update certificate file, configuring the update certificate file to a configuration center, and generating configuration information; the configuration information comprises a certificate identifier for updating the certificate file; the configuration center further comprises original configuration; receiving a service calling request initiated by the application service; the service calling request comprises a certificate identifier; if the certificate identifier is not in the original configuration, calling the original SDK to load and update the certificate file, and responding to the service calling request; and if the certificate identifier is in the original configuration, calling the updating SDK to load the updating certificate file, and responding to the service calling request. According to the method, the loading environment of the original certificate and the updated certificate is safely isolated, so that the certificate can be updated without restarting the service under the scenes of newly adding the certificate and replacing the certificate, and the service continuity and the user experience are improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computers, in particular to a certificate updating method, a program product, an electronic device and a storage medium. BACKGROUND

[0002] With the business development of enterprises, the demand for interaction with external systems is increasing. When interacting with external systems, the external systems will provide corresponding SDK (Software Development Kit) and cooperate with the corresponding certificate to interact with the system. However, in actual business, there will be a certificate update situation. The existing method for responding to certificate update needs to restart the system, which affects user experience and business continuity. SUMMARY

[0003] The purpose of the embodiments of the present application is a certificate updating method, a program product, an electronic device and a storage medium, which are used to update the certificate without restarting, and improve business continuity and user experience.

[0004] In a first aspect, the embodiments of the present application provide a certificate updating method, comprising: obtaining an updated SDK generated according to an original SDK; the original SDK is an SDK that needs to update the certificate; the updated certificate includes a new certificate and a replaced certificate; obtaining an updated certificate file, configuring the updated certificate file to a configuration center, and generating configuration information; the configuration information includes the certificate identifier of the updated certificate file; the configuration center further includes an original configuration, which refers to the original configuration information before the updated certificate file is configured to the configuration center; receiving a service call request initiated by an application service; the service call request includes a certificate identifier; if the certificate identifier is not in the original configuration, calling the original SDK to load the updated certificate file and responding to the service call request; if the certificate identifier is in the original configuration, calling the updated SDK to load the updated certificate file and responding to the service call request.

[0005] In the above implementation process, the updated SDK is generated without destroying the internal logic of the original SDK, ensuring stability and greatly reducing the disturbance to the original business. For the case that the certificate identifier is not in the original configuration and the new certificate is added, the original SDK is called to load the updated certificate file, which can not change the routing logic of the existing business, and the original SDK continues to serve all known businesses, improving the stability of business service. For the case that the certificate identifier is in the original configuration and the certificate is replaced, the updated SDK is called to load the updated certificate file, which improves the risk of concurrent conflicts caused by the original SDK covering new certificates and reduces the failure of requests being processed due to the sudden invalidation of the certificate. By securely isolating the loading environment of the original certificate and the updated certificate, the certificate can be updated without restarting the service in the scenarios of adding a new certificate and replacing a certificate, improving business continuity and user experience.

[0006] Optionally, in the embodiment of the present application, the updated certificate file is obtained, the updated certificate file is configured to the configuration center, and configuration information is generated, including: obtaining the updated certificate file, uploading the updated certificate file to the storage server, and obtaining a certificate path; the updated certificate file includes a newly added certificate file or a certificate file for replacing an original certificate; and the certificate path is configured to the configuration center to generate the configuration information.

[0007] In the above implementation process, the certificate file is stored in the object storage server, and the path information is stored in the distributed configuration center, so that the security isolation between certificates is realized, the certificate update can be triggered by modifying the path, and the application does not need to be redeployed. The configuration center saves each change record, can trace the history version, uploads the updated certificate file to the storage server, configures the certificate path to the configuration center, decouples the file storage and the configuration management, and improves the security controllability and real-time performance of the certificate.

[0008] Optionally, in the embodiment of the present application, after receiving the service call request initiated by the application service, the method further includes: after the configuration center receives the updated certificate file, pushing a listening event to the application service; the application service pre-registers listening for the configuration center; and reading the original configuration of the configuration center to find whether the certificate identifier exists in the original configuration.

[0009] In the above implementation process, the application service pre-registers listening for the configuration center, so that the certificate change can be quickly captured without polling query. Precise matching is performed through the certificate identifier, error identification change type is reduced to cause process error, and operation correctness is improved.

[0010] Optionally, in the embodiment of the present application, if the certificate identifier is in the original configuration, the updated SDK is called to load the updated certificate file, and the method further includes: storing the mapping relationship between the certificate identifier and the updated SDK to a business list maintained by a proxy layer, so that a subsequent request carrying the certificate identifier is called based on the business list.

[0011] In the above implementation process, the mapping relationship between the certificate identifier and the updated SDK is stored to the business list maintained by the proxy layer, and the mapping relationship is stored in the proxy layer process memory instead of a database or a file. The speed is faster than remote query of the database, even if network failure occurs, the routing function is not affected, and the request carrying the certificate identifier can still be routed to the updated SDK. And the request level routing is realized based on the certificate identifier and the business list, so that the routing error is reduced.

[0012] Optionally, in the embodiment of the present application, if the certificate identifier is in the original configuration, the updated SDK is called to load the updated certificate file, including: if the certificate identifier is in the original configuration, obtaining the original certificate information in the original configuration; based on the original certificate information, the updated SDK is called to load the updated certificate file using the gray mechanism to respond to the service call request.

[0013] In the implementation process described above, the number of service call requests handled by the updated SDK is gradually expanded through the gray mechanism, reducing the impact range caused by updating the certificate, improving the stability of updating the certificate, and reducing the business risk of updating the certificate. And it is imperceptible to users. Both methods can respond to requests and reduce the impact on users.

[0014] Optionally, in the embodiment of the present application, based on the original certificate information, the updated SDK is called to load the updated certificate file using the gray mechanism, including: determining whether the original certificate is invalid through the original certificate information; in the case where the original certificate is not invalid, the multiple service call requests are divided according to the proportion of the gray mechanism, and the gray request is determined from the multiple service call requests; if the service call request is determined as a gray request, the updated SDK is called to load the updated certificate file to respond to the service call request.

[0015] In the implementation process described above, through the gray mechanism, the potential defects of the updated certificate file will not be directly exposed to the full traffic, and there is a stable old channel as a bottom line. The gray proportion itself cuts the risk into observable small pieces. Even if the updated certificate file appears abnormal, only a small proportion of requests are affected, and the remaining traffic continues to be carried by the original certificate, improving the overall stability.

[0016] Optionally, in the embodiment of the present application, if the service call request is determined as a normal request, the original SDK is called to load the original certificate to respond to the service call request.

[0017] Optionally, in the embodiment of the present application, if the certificate identifier is in the original configuration, the updated SDK is called to load the updated certificate file to respond to the service call request, and the method further includes: in the case where the business index is met, the certificate state of the original certificate is marked as to be cleaned up; the certificate state is used for monitoring and processing the certificate; the initialization method of the original certificate corresponding to the original SDK is deleted, so that subsequent service call requests carrying the certificate identifier call the updated SDK to load the updated certificate file, and the certificate state of the original certificate is marked as cleaned up.

[0018] In the implementation process described above, for the scenario of replacing the certificate, after the gray completion, the updated SDK takes over the full traffic, the initialization method of the original certificate corresponding to the original SDK can be deleted for accurate memory recycling, and the probability of error calling is also reduced.

[0019] In an optional embodiment, based on the original certificate information, the update SDK is called to load the update certificate file using a gray-scale mechanism, including: based on the original certificate information, the update SDK is called to load the update certificate file in stages using a gray-scale mechanism.

[0020] In a second aspect, the embodiments of the present application also provide a certificate updating device, including: an obtaining update SDK module, configured to obtain an update SDK generated according to an original SDK; the original SDK is an SDK that needs to be updated certificate; the update certificate includes an added certificate and a replaced certificate; a configuration information module, configured to obtain an update certificate file, configure the update certificate file to a configuration center, and generate configuration information; the configuration information includes a certificate identifier of the update certificate file; the configuration center further includes an original configuration, which refers to original configuration information before the update certificate file is configured to the configuration center; a processing request module, configured to receive a service calling request initiated by an application service; the service calling request includes a certificate identifier; if the certificate identifier is not in the original configuration, the original SDK is called to load the update certificate file, and the service calling request is responded; if the certificate identifier is in the original configuration, the update SDK is called to load the update certificate file, and the service calling request is responded.

[0021] In a third aspect, the embodiments of the present application also provide a computer program product, including computer program instructions, which, when executed by a processor, perform the method provided by the first aspect or any one of the implementation manners of the first aspect.

[0022] In a fourth aspect, the embodiments of the present application also provide an electronic device, including a processor and a memory, the memory stores computer program instructions, and the computer program instructions are executed by the processor to perform the method provided by the first aspect or any one of the implementation manners of the first aspect.

[0023] In a fifth aspect, the embodiments of the present application also provide a computer readable storage medium, and the computer readable storage medium stores computer program instructions, and the computer program instructions are executed by a processor to perform the method provided by the first aspect or any one of the implementation manners of the first aspect.

[0024] The certificate updating method, the program product, the electronic device and the storage medium provided by the application can generate an updated SDK without destroying the original SDK internal logic, ensure stability, and greatly reduce the interference to the original business. For the case that the certificate identifier is not in the original configuration, that is, the new certificate, the original SDK is called to load the updated certificate file, the routing logic of the existing business can not be changed, the original SDK continues to serve all known businesses, and the business service stability is improved. For the case that the certificate identifier is in the original configuration, that is, the replacement certificate, the updated SDK is called to load the updated certificate file, the concurrent conflict risk caused by the original SDK covering the new certificate is improved, and the request being processed fails due to the sudden invalidation of the certificate. By securely isolating the loading environment of the original certificate and the updated certificate, in the scenarios of adding a certificate and replacing a certificate, the certificate can be updated without restarting the service, the business continuity and user experience are improved. BRIEF DESCRIPTION OF DRAWINGS

[0025] In order to more clearly illustrate the technical solutions of the embodiments of the application, the following will briefly introduce the drawings needed to be used in the embodiments of the application. It should be understood that the following drawings only show some embodiments of the application, and therefore should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can also be obtained without creative labor.

[0026] Figure 1 A flowchart of a certificate updating method provided by an embodiment of the application; Figure 2 A structural diagram of an electronic device provided by an embodiment of the application. DETAILED DESCRIPTION

[0027] The embodiments of the technical solutions of the application will be described in detail below with reference to the drawings. The following embodiments are only used to more clearly illustrate the technical solutions of the application, and therefore only serve as examples, and cannot limit the protection scope of the application.

[0028] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which the application belongs; the terms used herein are only for the purpose of describing specific embodiments and are not intended to limit the application.

[0029] In the description of the embodiments of the application, the technical terms "first", "second", etc. are only used to distinguish different objects, and cannot be understood as indicating or implying relative importance or implicitly indicating the number, specific order or primary and secondary relationship of the indicated technical features. In the description of the embodiments of the application, the meaning of "multiple" is two or more, unless otherwise explicitly specified.

[0030] SDK (Software Development Kit) is a set of development tools provided for a specific software, hardware or service, including library files, documents, sample code and debugging tools, etc., to help developers quickly build applications. The SDK of the embodiments of the present application is usually a software development kit provided by an external system, which encapsulates communication and encryption functions.

[0031] Certificate refers to a digital certificate or a signed certificate, which is used to verify the identity of a developer or to ensure the security of data transmission. For example, a certificate may be required for identity verification or data encryption in API calls.

[0032] As the business of an enterprise develops, application systems need to interact with more and more external systems (such as banks, payment platforms, etc.). These external systems usually provide third-party SDKs (Software Development Kits) to simplify the access process. These SDKs encapsulate complex details such as underlying communication protocols, encryption and decryption logic, significantly reducing the development cost and time of access parties.

[0033] However, the existing third-party SDK access method has a significant pain point: lack of dynamic loading and certificate update capability. This is manifested in the following two common scenarios: An application accesses multiple external systems: the application needs to load and use multiple SDKs provided by different third parties.

[0034] An SDK uses multiple sets of certificates: the same business (such as interfacing with different branches of the same bank) or different business lines need to use different certificates of the same SDK (corresponding to different access identities or permissions).

[0035] Whether it is to load new certificates or to update expired certificates, the entire application service must be restarted. This leads to the following serious consequences: New business access delay: when new certificates need to be loaded to access new external systems, the service must be restarted during the service restart window, causing new businesses to be unable to go online in a timely manner. Risk of online business interruption: when the certificate expires, it cannot be dynamically refreshed and must be restarted. If it fails to restart or the restart fails, the online business that relies on the certificate will be directly unavailable. Frequent service restarts: multiple sets of certificates loaded in the application usually have different expiration times. In order to update these certificates that expire one after another, the service needs to be restarted frequently, increasing the operational burden and system instability. Poor timeliness and low stability: restarting the service not only consumes time and affects business continuity, but also may introduce unexpected failure risks.

[0036] The embodiment of the application provides a certificate updating method, for the case of adding a certificate, calling an original SDK to load an updated certificate file, without changing the routing logic of an existing service, continuing to serve all known services by the original SDK, and improving service stability. For the case of replacing a certificate, calling an updated SDK to load an updated certificate file, improving the risk of concurrent conflicts caused by the original SDK covering a new certificate, and reducing the failure of a request being processed due to the sudden invalidation of a certificate. By securely isolating the loading environment of the original certificate and the updated certificate, the certificate updating method can be applied to the scenarios of adding a certificate and replacing a certificate, and the certificate can be updated without restarting the service, thereby improving service continuity and user experience.

[0037] Please refer to Figure 1 The embodiment of the application provides a certificate updating method. The certificate updating method provided by the embodiment of the application can be applied to an electronic device, which can include a server, a PC, a tablet computer, a smart phone, or other physical devices, or can be a virtual machine or a container, and the like. The electronic device can be a single device, or a combination of multiple devices, or a cluster of a large number of devices. The certificate updating method can include the following steps. Step S110: obtaining an updated SDK generated according to an original SDK; the original SDK is an SDK that needs to be updated; the updated certificate includes an added certificate and a replaced certificate.

[0038] Step S120: obtaining an updated certificate file, configuring the updated certificate file to a configuration center, and generating configuration information; the configuration information includes a certificate identifier of the updated certificate file; the configuration center also includes an original configuration, which refers to the original configuration information before the updated certificate file is configured to the configuration center.

[0039] Step S130: receiving a service call request initiated by an application service; the service call request includes a certificate identifier.

[0040] Step S140a: if the certificate identifier is not in the original configuration, calling the original SDK to load the updated certificate file, and responding to the service call request.

[0041] Step S140b: if the certificate identifier is in the original configuration, calling the updated SDK to load the updated certificate file, and responding to the service call request.

[0042] In step S110: the original SDK refers to an SDK (such as a bank payment toolkit) used in the current application and needing to be updated; the updated certificate includes an added certificate or a replaced certificate, for example, the actual business needs to use multiple certificates of the same SDK, in which case the original SDK needs to add a certificate; or the original certificate is expired and invalid, in which case the original certificate of the original SDK needs to be updated.

[0043] The external system (for example, an external bank providing an SDK) generates an updated SDK according to the original SDK, and the operation mode is, for example, modifying the package path (for example, changing com.bank.sdk to xxx.com.bank.sdk) of the original SDK by using a bytecode tool ASM. After modifying the package name of the original SDK, a new SDK with the same function but a different package name is generated as the updated SDK. After the package name is changed, the class loader will regard the original SDK and the updated SDK as "two completely different libraries" and will not conflict with each other.

[0044] The external system sends the original SDK and the updated SDK to the calling system, the calling system obtains the updated SDK generated according to the original SDK, and stores the two sets of SDKs. Subsequently, the original SDK or the updated SDK is determined based on a service call request to respond to the service call request.

[0045] In step S120, the updated certificate file includes a newly added certificate file or a certificate file replacing the original certificate. The updated certificate file is provided by the external system, which can include.p12 certificate and.properties configuration file information.

[0046] After obtaining the updated certificate file, the updated certificate file is uploaded to the storage server, which can use an object storage. The certificate path returned by the storage server can be a download address in the storage server, and the download address points to the updated certificate file and is used to obtain the updated certificate file from the storage server. Then the certificate path is configured to the configuration center to generate configuration information. The configuration center is, for example, Zookeeper, and the configuration information stores the certificate identifier and path of the updated certificate file.

[0047] The certificate identifier refers to a string uniquely marking a specific certificate in a certain business scenario. For example, the form can be "WeChat payment_encryption certificate_production environment".

[0048] At the same time, the configuration center also stores the original configuration, which refers to the original configuration information before the updated certificate file is configured to the configuration center. For example, in the scenario of updating the certificate, the original configuration can include the certificate identifier and path of the original certificate; in the scenario of adding a certificate, the original configuration can include the information of other certificates of the SDK, etc.

[0049] It should be noted that for the case of replacing the certificate, the updated certificate file needs to replace the original certificate, so the certificate identifiers of the updated certificate file and the original certificate should be consistent to enable successful calling; and in the scenario of adding a certificate, the certificate identifier of the updated certificate file is different from the certificate identifiers of other certificates in the original configuration, that is, even if the same SDK corresponds to multiple different certificates, the certificate identifiers of these certificates are different.

[0050] In step S130: receive the service call request initiated by the application service, for example, a user payment request, and the request must carry a certificate identifier, for example, appId=group1.

[0051] In step S140a: query the original configuration by using the certificate identifier, and determine whether the certificate identifier is saved in the original configuration. If the certificate identifier is not in the original configuration, it means that the update certificate file corresponding to the certificate identifier is a newly added certificate, and the original configuration does not store the certificate identifier.

[0052] For the scenario of newly added certificate with certificate identifier not in the original configuration, the original SDK is called to load the update certificate file to respond to the service call request. Since the certificates loaded by the original SDK form a fixed context in the memory, such as a static key pool and a certificate cache, and the newly added certificate belongs to an independent scenario (such as accessing a new bank system) and does not conflict with the original certificate, directly calling the original SDK to load will not damage the running environment. Moreover, calling the original SDK to load the update certificate file can reduce the call of the update SDK, reduce the business complexity, and save the overhead (CPU and memory) of generating an update SDK instance.

[0053] The calling mode may, for example, download the update certificate file from a file storage server and call the initialization method of the original SDK to load the update certificate file.

[0054] In step S140b: query the original configuration by using the certificate identifier, and determine whether the certificate identifier is saved in the original configuration. If the certificate identifier is in the original configuration, it means that the update certificate file corresponding to the certificate identifier is a new certificate for replacing the original certificate, and the original configuration already stores the certificate identifier.

[0055] For this update scenario, the update SDK is called to load the update certificate file to respond to the service call request. This is because if the certificate is directly overwritten in the original SDK, it may cause business failure, for example, the request being processed fails due to the sudden invalidation of the certificate. By calling the update SDK to load the update certificate file, the original SDK can maintain the original certificate request, and they do not interfere with each other, achieving double-track parallelism. In this way, the business of the original certificate is not affected, and the new certificate can also be started to be used.

[0056] The operation mode may, for example, download the update certificate file from a file storage server, call the initialization method of the update SDK to load the new certificate, and add the business identifier to a routing set. The routing set is used to mark that the subsequent request needs to call the update SDK, and the update SDK is used to process the current request.

[0057] In the implementation process described above, the updated SDK is generated without breaking the original SDK internal logic, ensuring stability and greatly reducing the disturbance to the original business. For the case where the certificate identifier is not in the original configuration, i.e., a new certificate, the original SDK is called to load the updated certificate file, and the routing logic of the existing business can be changed. The original SDK continues to serve all known businesses, improving business service stability. For the case where the certificate identifier is in the original configuration, i.e., a replacement certificate, the updated SDK is called to load the updated certificate file, which improves the risk of concurrent conflicts caused by the original SDK covering new certificates and reduces the number of requests being processed that fail due to sudden certificate invalidation. By securely isolating the loading environment of the original certificate and the updated certificate, in the scenarios of adding a new certificate and replacing a certificate, the certificate can be updated without restarting the service, improving business continuity and user experience.

[0058] Optionally, in the embodiments of the present application, the updated certificate file is obtained, the updated certificate file is configured to the configuration center, and configuration information is generated, including: The updated certificate file is obtained, the updated certificate file is uploaded to the storage server, and the certificate path is obtained; the updated certificate file includes a newly added certificate file or a certificate file for replacing the original certificate; the certificate path is configured to the configuration center, and configuration information is generated.

[0059] The newly added certificate file refers to the digital certificate (such as a.p12 encryption certificate) and its configuration file (such as a.properties key parameter) required for the first access to a certain business.

[0060] The replacement certificate file refers to a certificate file that needs to be updated due to expiration or rotation (same name but different content), and the certificate identifier of the replacement certificate is consistent with the certificate identifier of the original certificate.

[0061] The storage server uses object storage service and supports HTTPS encrypted transmission of file cloud storage, such as Aliyun OSS and Tencent Cloud COS. The certificate file is uploaded to the specified directory of the storage server through a secure channel (such as VPN + HTTPS). The server returns the certificate path, i.e., the unique file access address.

[0062] The configuration center uses a distributed configuration center and supports a real-time monitoring configuration management system, such as ZooKeeper or Nacos. A separate configuration record is created for each certificate file in the configuration center console or by calling the configuration center interface, including keys and values. The key includes the certificate identifier, and the value can be the certificate path returned by the storage server.

[0063] In the implementation process of the above embodiment: the certificate file is stored in the object storage server, and the path information is stored in the distributed configuration center, thereby realizing the secure isolation between certificates, triggering certificate update by modifying the path, and without the need to redeploy the application. The configuration center saves each change record and can trace the history version. The updated certificate file is uploaded to the storage server, and the certificate path is configured to the configuration center, thereby decoupling file storage and configuration management, improving the security controllability and real-time performance of the certificate.

[0064] Optionally, in the embodiment of the application, after receiving the service call request initiated by the application service, the method further includes: After the configuration center receives the updated certificate file, the configuration center pushes the listening event to the application service; and the application service registers the listening in advance.

[0065] The application service calls the listening registration interface provided by the configuration center when starting or after starting, declares the configuration node path to be monitored, the configuration center records the network address of the application service, and establishes a long connection for real-time pushing of changes. The configuration center modifies or adds the certificate path, pushes the listening event to the application service, and the pushing content includes the change details, thereby avoiding repeated query of the application service.

[0066] The original configuration of the configuration center is read, and it is determined whether the certificate identifier exists in the original configuration. The application service reads the last valid configuration in the cache, determines whether the certificate identifier exists in the original configuration, and executes step S140a or step S140b according to the query result. For example, the certificate identifier in the listening event can be parsed, and the certificate identifier is compared with the key name set in the original configuration. If the certificate identifier completely matches and the path value is different, it is considered that the certificate is replaced, and step S140b is executed. If the certificate identifier does not exist, it is considered that the certificate is added, and step S140a is executed.

[0067] In the implementation process of the above embodiment: the application service registers the listening in advance, which can quickly capture the certificate change without the need to poll and query. The certificate identifier is accurately matched, the error recognition change type is reduced, the process error is avoided, and the operation correctness is improved.

[0068] Optionally, in the embodiment of the application, if the certificate identifier exists in the original configuration, the updated SDK is called to load the updated certificate file, and the method further includes: storing the mapping relationship between the certificate identifier and the updated SDK in the business list maintained by the proxy layer, so that the subsequent request carrying the certificate identifier calls the updated SDK based on the business list.

[0069] If the certificate identifier is in the original configuration, it means that the update certificate file corresponding to the certificate identifier is a new certificate for replacing the original certificate, and the certificate identifier has been stored in the original configuration. After the application service completes the certificate update operation, a registration instruction is sent to the proxy layer, a dedicated service list is opened in the memory of the proxy layer (i.e., the request forwarding hub), and the service list is a routing table, which is used to route the request carrying the certificate identifier to the update SDK in the scenario of replacing the certificate. The application service delivers a structured message, for example: [certificate identifier: "update certificate file"; SDK address: "update SDK"], and after transmission to the proxy layer, the proxy layer can verify the legality of the message, for example, whether the certificate instance identifier conforms to the naming specification and whether the address of the update SDK is valid. After verification, the service list is updated. The service list uses a hash table structure to bind the relationship between the certificate identifier of the update certificate and the update SDK.

[0070] Before the service list is updated, the service list may store the mapping relationship between the certificate identifier and the original SDK. However, after the original certificate is replaced by the update certificate, although the certificate identifier remains unchanged, the called SDK changes, and the update certificate is called through the update SDK. Therefore, it is necessary to store the mapping relationship between the certificate identifier and the update SDK in the service list, which can cover the mapping relationship between the certificate identifier and the original SDK. In this way, after receiving a subsequent external service request (such as a user payment request), if the request includes the certificate identifier, the update SDK will be directly called to load the update certificate because the mapping relationship between the certificate identifier and the update SDK is stored in the service list.

[0071] In the implementation process of the above embodiment: by storing the mapping relationship between the certificate identifier and the update SDK in the service list maintained by the proxy layer, the mapping relationship is stored in the proxy layer process memory rather than a database or a file, which is faster than remotely querying the database, that is, even if a network failure occurs, the routing function is not affected, and the request carrying the certificate identifier can still be routed to the update SDK. And based on the certificate identifier and the service list, the request-level routing is realized, and the routing error situation is reduced.

[0072] Optionally, in the embodiment of the present application, if the certificate identifier is in the original configuration, the update SDK is called to load the update certificate file, including: If the certificate identifier is in the original configuration, the original certificate information in the original configuration is obtained. First, it is necessary to confirm that the certificate identifier has been configured in the original configuration, and here the certificate identifier can be used as a key value for querying, and it can also be checked whether the path of the update certificate corresponding to the identifier is different from the path of the original certificate. If the key value query is successful and the paths are the same, it means that the update certificate file corresponding to the certificate identifier is a new certificate for replacing the original certificate, and the certificate identifier has been stored in the original configuration.

[0073] Based on the original certificate information, the update SDK is called to load the update certificate file using the gray mechanism to respond to the service call request.

[0074] The original certificate information can include expiration time, usage date, and the like, which are used to determine whether the original certificate can be used. If the original certificate information indicates that the original certificate is still within the effective period, it means that both the original certificate and the update certificate file in the calling system can be used. The original certificate is loaded by calling the original SDK, and the update certificate is loaded by calling the update SDK.

[0075] In the scenario of replacing the certificate, the original certificate is not invalidated at the moment when the update certificate exists, and the update certificate is usually prepared before it is invalidated. Considering that the update certificate file may face some unknown errors or delays due to the first use, in order to reduce the situation that the business is affected on a large scale due to serious errors in the update certificate, the original certificate that has not yet been invalidated can be fully utilized to handle requests in stages using the gray mechanism to call the SDK.

[0076] For example, a plurality of service call requests are divided according to the proportion of the gray mechanism, and the gray request is determined from the plurality of service call requests. The gray request is a part of all service call requests, and the update SDK is called to load the update certificate file for the part of the gray request, and the remaining non-gray request service call request is still handled by calling the original SDK to load the original certificate.

[0077] The proportion of the gray request can be controlled in stages, and the gray time can also be set according to the error rate of the gray request processing. For example, if the error rate of the divided gray request is low, the gray time can be reduced to realize gradual transition.

[0078] In the implementation process of the above embodiment: the number of requests handled by calling the update SDK to load the update certificate is gradually expanded through the gray mechanism, the maximum impact range caused by the update certificate is reduced, the stability of the update certificate is improved, and the business risk of certificate update is reduced. And it is imperceptible to users, both of which can respond to requests and reduce the impact on users.

[0079] Optionally, in the embodiment of the present application, based on the original certificate information, the update SDK is called to load the update certificate file using the gray mechanism, comprising: The original certificate information is used to determine whether the original certificate is invalid, for example, the original certificate information can include expiration time or recent call success rate. If the system time is before the certificate expiration time stamp, it means that the original certificate is not invalid; and if the recent call success rate is greater than a preset threshold, it means that the original certificate is not invalid.

[0080] In the case that the original certificate is not expired, the multiple service call requests are divided according to the proportion of the gray mechanism, and the gray request is determined from the multiple service call requests. The original certificate is not expired, which means that the original certificate can guarantee the normal business. The multiple service call requests are divided according to the proportion of the gray mechanism. If the service call request is determined as a gray request, the updated SDK is called to load the updated certificate file to respond to the service call request.

[0081] The service call request is divided into two parts, one part is the gray request in the test environment, and the other part is the normal request. The updated SDK is called to load the updated certificate file for the gray request in the test environment. The original SDK is called to load the original certificate to respond to the normal request.

[0082] In the middle stage, the number of requests handled by calling the updated SDK to load the updated certificate can be gradually increased, and the number of requests responded by calling the original SDK to load the original certificate can be gradually reduced. Until the error rate or the delay of calling the updated SDK to load the updated certificate to handle the request is within the preset threshold through detection and verification, it is indicated that the new certificate is relatively stable and will not have a negative impact on the business. The full amount of requests carrying the certificate identifier can be routed to the updated SDK for processing, and the complete certificate update process.

[0083] In the implementation process of the above embodiment: through the gray mechanism, the potential defects of the updated certificate file will not be directly exposed to the full amount of traffic, and there is a stable old channel as a bottom line. The gray proportion itself cuts the risk into a small piece that can be observed. Even if the updated certificate file appears abnormal, it only affects a small proportion of requests, and the remaining traffic continues to be carried by the original certificate, which improves the overall stability.

[0084] Optionally, in the embodiment of the application, if the certificate identifier is in the original configuration, after the updated SDK is called to load the updated certificate file to respond to the service call request, the method further comprises: In the case that the business index is met, the certificate state of the original certificate is marked as to be cleaned. The certificate state is used for monitoring and processing the certificate. For example, if the error rate of the updated certificate file is less than the preset error rate threshold, the average delay is less than the preset delay threshold, and / or the updated SDK loads the updated certificate to handle the full amount of traffic, the certificate state of the original certificate can be marked as to be cleaned. For example, the state field can be updated in the certificate state registration table. The certificate state registration table can be stored in the memory and the persistent storage.

[0085] In an optional embodiment, after the original certificate is marked as to be cleaned, the cleaning operation is not necessarily performed immediately. The original certificate in the to-be-cleaned state can be used as a buffer to roll back to the original certificate after an update certificate fails to cope with an emergency. However, due to the marking of to-be-cleaned, the original certificate will not be loaded normally. In summary, through the state marking, both the bottom solution and the reduction of the probability of error calling are achieved.

[0086] The initialization method of the original certificate corresponding to the original SDK is deleted, so that subsequent service calling requests carrying the certificate identifier call the update SDK to load the update certificate file, and the certificate state of the original certificate is marked as cleaned.

[0087] The initialization method of the original certificate corresponding to the original SDK refers to a function entry for loading the certificate in the original SDK. The function memory address can be located by dynamic bytecode modification technology, the function is replaced with a null operation instruction (returns success immediately when executed), and the certificate buffer memory occupied by the function is recycled.

[0088] In the implementation process of the above embodiment: for the certificate replacement scenario, after the gray completion, the update SDK undertakes the full amount of traffic, the initialization method of the original certificate corresponding to the original SDK can be deleted for precise memory recycling, and the probability of error calling is also reduced.

[0089] The embodiment of the application provides a certificate updating device, which comprises: An acquisition update SDK module is configured to acquire an update SDK generated according to an original SDK; the original SDK is an SDK that needs to update a certificate; the update certificate comprises an added certificate and a replaced certificate; A configuration information module is configured to acquire an update certificate file, configure the update certificate file to a configuration center, and generate configuration information; the configuration information comprises a certificate identifier of the update certificate file; the configuration center further comprises an original configuration, which refers to original configuration information before the update certificate file is configured to the configuration center; A processing request module is configured to receive a service calling request initiated by an application service; the service calling request comprises a certificate identifier; If the certificate identifier is not in the original configuration, the original SDK is called to load the update certificate file, and the service calling request is responded; If the certificate identifier is in the original configuration, the update SDK is called to load the update certificate file, and the service calling request is responded.

[0090] Optionally, in this embodiment of the application, the certificate update device includes a configuration information module, which is used to obtain an updated certificate file, upload the updated certificate file to a storage server, and obtain a certificate path; the updated certificate file includes a newly added certificate file or a certificate file that replaces the original certificate; the certificate path is configured in a configuration center to generate configuration information.

[0091] Optionally, in this embodiment of the application, the certificate update device further includes a listening module, which is used to push a listening event to the application service after the configuration center receives the updated certificate file; the application service pre-registers a listening device for the configuration center; and reads the original configuration of the configuration center to check whether the certificate identifier exists in the original configuration.

[0092] Optionally, in this embodiment of the application, the certificate update device further includes a routing module, which stores the mapping relationship between the certificate identifier and the update SDK in a service list maintained by the proxy layer, so that subsequent requests carrying the certificate identifier can call the update SDK based on the service list.

[0093] Optionally, in this embodiment of the application, the certificate update device is further configured to: if the certificate identifier is in the original configuration, obtain the original certificate information in the original configuration; based on the original certificate information, use a grayscale mechanism to call the update SDK to load the update certificate file, and respond to the service call request.

[0094] Optionally, in this embodiment of the application, the certificate update device is further configured to determine whether the original certificate has expired based on the original certificate information; if the original certificate has not expired, the device divides multiple service call requests according to the proportion of the grayscale mechanism, and determines grayscale requests from the multiple service call requests; if a service call request is determined to be a grayscale request, the device loads the update certificate file by calling the update SDK and responds to the service call request.

[0095] Optionally, in this embodiment of the application, the certificate update device further includes a processing module, configured to respond to the service call request by loading the original certificate through the original SDK if the service call request is determined to be a normal request.

[0096] Optionally, in this embodiment of the application, the certificate update device further includes: a status marking module, used to mark the certificate status of the original certificate as pending cleanup when business indicators are met; the certificate status is used to monitor and process the certificate; the initialization method of the original certificate corresponding to the original SDK is deleted so that subsequent service call requests carrying certificate identifiers will call the update SDK to load the update certificate file and mark the certificate status of the original certificate as cleanup.

[0097] It should be understood that the device corresponds to the certificate updating method embodiments described above, and can perform each step involved in the above method embodiments. The specific functions of the device can be referred to the description above, and the detailed description is appropriately omitted here to avoid repetition. The device includes at least one software function module that can be stored in the memory in the form of software or firmware or solidified in the operating system (OS) of the device.

[0098] Please refer to Figure 2 The electronic device provided by the embodiments of the present application is shown in the structural schematic diagram. The electronic device 300 provided by the embodiments of the present application includes a processor 310 and a memory 320. The memory 320 stores machine readable instructions executable by the processor 310. When the machine readable instructions are executed by the processor 310, the method described above is performed.

[0099] Figure 2 The components shown in the above embodiments can be realized by hardware, software or a combination thereof. The electronic device 300 can be a physical device such as a server, a PC, etc., or a virtual device such as a virtual machine, a virtual container, etc. In addition, the electronic device 300 is not limited to a single device, but can also be a combination of multiple devices or a cluster of a large number of devices.

[0100] The embodiments of the present application also provide a storage medium, which stores a computer program. When the computer program is run by a processor, the method described above is performed.

[0101] The storage medium can be realized by any type of volatile or non-volatile storage devices or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk or optical disk.

[0102] The embodiments of the present application also provide a computer program product, which includes computer program instructions. When the computer program instructions are run by a processor, the method described above is performed.

[0103] It should be understood that the disclosed apparatus and method can also be implemented in other manners. The embodiments described above are merely exemplary embodiments of the present application. In the embodiments of the present application, the described apparatus embodiments are merely schematic, and the functions of the flowcharts and the block diagrams can be implemented in other manners. For example, the flowcharts and the block diagrams can be implemented by using a computer program, a digital signal processor, an application-specific integrated circuit, a field programmable gate array, a processor, a controller, another hardware device, or a combination thereof. In this case, the disclosed apparatus and method can be implemented in a form of a computer program product. The computer program product is directly downloadable from a network, or stored in a computer-readable storage medium, and includes a plurality of instructions. When the instructions are executed by a processor, the processor performs the method according to the embodiments of the present application.

[0104] In addition, each functional module in each of the embodiments of the present application can be integrated together to form a separate part, or each module can exist independently, or two or more modules can be integrated to form a separate part.

[0105] The above description is merely optional implementation of the embodiments of the present application, but the protection scope of the present application is not limited thereto, and any person skilled in the art can easily think of changes or replacements within the technical range disclosed by the embodiments of the present application, which should be covered within the protection scope of the embodiments of the present application.

Claims

1. A certificate updating method characterized by comprising: The method comprises the following steps: obtaining an updated SDK generated according to an original SDK; the original SDK is an SDK that needs to be updated; the updated certificate includes an added certificate and a replaced certificate; obtaining an updated certificate file, configuring the updated certificate file to a configuration center, and generating configuration information; the configuration information includes a certificate identifier of the updated certificate file; the configuration center also includes an original configuration, which refers to the original configuration information before the updated certificate file is configured to the configuration center; receiving a service call request initiated by an application service; the service call request includes the certificate identifier; if the certificate identifier is not in the original configuration, calling the original SDK to load the updated certificate file to respond to the service call request; if the certificate identifier is in the original configuration, calling the updated SDK to load the updated certificate file to respond to the service call request.

2. The method of claim 1, wherein, The method further comprises the following steps: obtaining an updated certificate file, uploading the updated certificate file to a storage server, and obtaining a certificate path; the updated certificate file includes an added certificate file or a certificate file for replacing an original certificate; configuring the certificate path to the configuration center to generate the configuration information.

3. The method of claim 1, wherein, After receiving the service call request initiated by the application service, the method further comprises the following steps: After the configuration center receives the updated certificate file, pushing a listening event to the application service; the application service registers listening to the configuration center in advance; reading the original configuration of the configuration center and checking whether the certificate identifier exists in the original configuration.

4. The method of claim 1, wherein, If the certificate identifier is in the original configuration, calling the updated SDK to load the updated certificate file, the method further comprises the following steps: storing a mapping relationship between the certificate identifier and the updated SDK to a business list maintained by a proxy layer, so that subsequent requests carrying the certificate identifier can call the updated SDK based on the business list.

5. The method of claim 1, wherein, If the certificate identifier is in the original configuration, calling the updated SDK to load the updated certificate file, comprising the following steps: if the certificate identifier is in the original configuration, obtaining original certificate information in the original configuration; based on the original certificate information, using a gray mechanism to call the updated SDK to load the updated certificate file to respond to the service call request.

6. The method of claim 5, wherein, Based on the original certificate information, using a gray mechanism to call the updated SDK to load the updated certificate file, comprising the following steps: determining whether the original certificate is invalid through the original certificate information; in the case that the original certificate is not invalid, dividing a plurality of service call requests according to a proportion of the gray mechanism, and determining a gray request from the plurality of service call requests; if the service call request is determined to be the gray request, loading the updated certificate file by calling the updated SDK to respond to the service call request.

7. The method of claim 6, wherein, The method further comprises the following steps: If the service call request is determined as a normal request, the original SDK is called to load the original certificate to respond to the service call request.

8. The method according to any one of claims 1 to 7, characterized in that, If the certificate identifier is in the original configuration, the method further comprises: In the case of meeting the business index, the certificate state of the original certificate is marked as to-be-cleaned; the certificate state is used for monitoring and processing the certificate; The initialization method of the original certificate corresponding to the original SDK is deleted, so that subsequent service call requests carrying the certificate identifier call the update SDK to load the update certificate file, and the certificate state of the original certificate is marked as cleaned.

9. The method of claim 6, wherein, Based on the original certificate information, the update SDK is called to load the update certificate file using a gray-scale mechanism, including: Based on the original certificate information, the update SDK is called to load the update certificate file using a gray-scale mechanism in stages.

10. A computer program product, characterised in that, Computer program instructions are included, which are executed by a processor to perform the method of any one of claims 1 to 9.

11. An electronic device, comprising: Including: A processor and a memory, the memory stores computer program instructions, the computer program instructions are executed by the processor to perform the method of any one of claims 1 to 9.

12. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer program instructions, the computer program instructions are executed by the processor to perform the method of any one of claims 1 to 9.