Digital certificate management method and device, electronic equipment and storage medium
Through certificate chain completion technology, the problem of reduced certificate security in certificate management is solved, the integrity and security of the certificate are ensured, direct modification is avoided, and the security of certificate use is improved.
Patent Information
- Application Number
- CN202310996340.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-09
- Publication Date
- 2024-10-18
AI Technical Summary
In the existing technology, abnormal certificates are directly corrected during certificate management, resulting in reduced certificate usage security.
After obtaining the digital certificate, the certificate chain is completed based on the certificate path information and user information to ensure that the public and private keys match, avoid directly correcting abnormal certificates, and improve the security of the certificate.
Through certificate chain completion, the integrity and security of digital certificates are ensured, direct modification during certificate management is avoided, and the security of certificate use is improved.
Smart Images

Figure CN118802192A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of Internet technology, and in particular to a digital certificate management method, device, electronic device and storage medium. Background Art
[0002] A digital certificate is essentially an electronic document. It is a more authoritative and fair certificate issued by an e-commerce certification center. It is an electronic document used to authenticate the identity of the public key holder to prevent third parties from impersonating. A digital certificate is actually a method used for asymmetric encryption. Therefore, it is a pair of key pairs, divided into a private key and a public key. The public key usually contains the public key, the holder information, the signature that proves the validity of the certificate content, the certificate validity period, and some other additional information. A certificate chain refers to a complete certificate trust chain composed of a root certificate, an intermediate certificate, and a user certificate. Only when all the certificates on the entire certificate trust chain are valid, will the certificate currently issued to the user be deemed valid and trusted. Only a complete certificate chain will not cause the website page to be unable to open or display a blank page. When the existing technology is performing certificate management, for abnormal certificates, it will directly correct them to make the certificates available. However, when performing certificate management, directly correcting abnormal certificates greatly reduces the security of certificate use. Summary of the invention
[0003] The embodiments of the present application provide a digital certificate management method, device, electronic device and storage medium to solve the problem of correcting abnormal certificates during certificate management, thereby reducing the security of certificate use.
[0004] In a first aspect, an embodiment of the present application provides a method for managing a digital certificate, including:
[0005] Obtain a digital certificate;
[0006] When it is determined that the public and private keys of the digital certificate do not match, the certificate chain of the digital certificate is completed based on the certificate path information and user information in the digital certificate to obtain a complete digital certificate.
[0007] In one embodiment, completing the certificate chain of the digital certificate based on the certificate path information and user information in the digital certificate to obtain a complete digital certificate includes:
[0008] Extracting parent certificate path information and issuer information and user information in user information from each public key certificate of the digital certificate;
[0009] Determine target certification path information of missing certificates in the certificate chain of the digital certificate based on the parent certification path information, the issuer information and the user information;
[0010] Acquire the missing certificate according to the target certificate path information;
[0011] The certificate chain of the digital certificate is completed according to the missing certificate to obtain a complete digital certificate.
[0012] In one embodiment, determining the target certification path information of the missing certificate in the certificate chain of the digital certificate based on the parent certification path information, the issuer information and the user information includes:
[0013] If, in each public key certificate, there is a target public key certificate whose issuer information is not used as user information in all public key certificates, the parent certificate path information corresponding to the target public key certificate is determined as the target certificate path information of the missing certificate in the certificate chain of the digital certificate.
[0014] In one embodiment, obtaining the missing certificate according to the target certificate path information includes:
[0015] According to the target certificate path information, information matching is performed in a preset certificate chain repository;
[0016] If the certificate corresponding to the target certificate path information does not exist in the preset certificate chain repository, certificate indexing is performed according to the target certificate path information, and the certificate obtained by the indexing is determined as a missing certificate.
[0017] In one embodiment, after acquiring the missing certificate according to the target certificate path information, the method further includes:
[0018] Encrypting the missing certificate to obtain an encrypted certificate;
[0019] The encryption certificate is stored in the preset certificate chain repository.
[0020] In one embodiment, after obtaining the digital certificate, the method further includes:
[0021] Obtaining public key information in the public key certificate of the digital certificate and private key information in the private key certificate of the digital certificate;
[0022] Encrypting the preset data based on the public key information to obtain encrypted data;
[0023] Decrypting the encrypted data based on the private key information to obtain decrypted data;
[0024] If the decrypted data is different from the preset data, it is determined that the public and private keys of the digital certificate do not match.
[0025] In one embodiment, after completing the certificate chain of the digital certificate to obtain a complete digital certificate, the method further includes:
[0026] A data access request is received, and access data in the data access request is encrypted according to the digital certificate.
[0027] In a second aspect, an embodiment of the present application provides a digital certificate management device, including:
[0028] An acquisition module, used to obtain a digital certificate;
[0029] The completion module is used to complete the certificate chain of the digital certificate based on the certificate path information and user information in the digital certificate to obtain a complete digital certificate when it is determined that the public and private keys of the digital certificate do not match.
[0030] In a third aspect, an embodiment of the present application provides an electronic device, including a processor and a memory storing a computer program, wherein when the processor executes the program, the digital certificate management method described in the first aspect is implemented.
[0031] In a fourth aspect, an embodiment of the present application provides a storage medium, which is a computer-readable storage medium and includes a computer program. When the computer program is executed by a processor, it implements the digital certificate management method described in the first aspect.
[0032] The digital certificate management method, device, electronic device and storage medium provided in the embodiments of the present application determine whether the digital certificate is complete by performing a public-private key matching check on the digital certificate after obtaining the digital certificate. If it is determined that the public-private key of the digital certificate does not match, indicating that the digital certificate is incomplete, the certificate chain of the digital certificate is completed through the certificate path information and user information in the digital certificate, thereby obtaining a complete digital certificate, making the digital certificate usable, avoiding direct correction of abnormal certificates when performing certificate management, and improving the security of certificate use on the basis of making the digital certificate usable. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] In order to more clearly illustrate the technical solutions in the present application or the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0034] Figure 1 It is a flowchart of a method for managing digital certificates provided in an embodiment of the present application;
[0035] Figure 2It is a schematic diagram of the public and private key matching verification process of the certificate in the digital certificate management method provided in the embodiment of the present application;
[0036] Figure 3 It is a schematic diagram of the certificate chain completion process in the digital certificate management method provided in the embodiment of the present application;
[0037] Figure 4 It is a schematic diagram of the update process of the repository in the digital certificate management method provided in the embodiment of the present application;
[0038] Figure 5 It is a functional module diagram of an embodiment of a management device for applying for a digital certificate;
[0039] Figure 6 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0040] In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions in this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0041] The digital certificate management method, device, electronic device and storage medium provided by the present invention are described in detail below in conjunction with the embodiments.
[0042] Figure 1 A flowchart of a method for managing digital certificates provided in an embodiment of the present application. Figure 1 , an embodiment of the present application provides a method for managing a digital certificate, which may include:
[0043] Step 100, obtaining a digital certificate;
[0044] It should be noted that the executor of the digital certificate management method provided in the embodiment of the present application can be a computer device, such as a mobile phone, a tablet computer, a laptop computer, a PDA, a vehicle-mounted electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook or a personal digital assistant (PDA), etc.
[0045] The digital certificate in this application is the digital certificate uploaded by the user.
[0046] Among them, the digital certificate may include a public key certificate and a private key certificate.
[0047] It is understandable that multiple public key certificates can form a certificate chain. A valid certificate chain usually includes a service certificate, an intermediate certificate and a root certificate, and the issuer of the subordinate certificate is the user of the superior certificate. For example, the issuer of the service certificate is the user of the previous intermediate certificate.
[0048] It should be noted that the public key certificate in the digital certificate uploaded by the user may include only the service certificate, may include only the service certificate and the intermediate certificate, or may include the service certificate, the intermediate certificate and the root certificate.
[0049] The content of the public key certificate can be parsed to obtain rich certificate information, including user information such as the issuer and user, as well as certification path information such as the parent certification path.
[0050] It should be noted that the issuer in the root certificate is the same as the user, that is, the issuer of the root certificate is the user.
[0051] In addition to the root certificate, the service certificate and each intermediate certificate can obtain the parent certificate path through parsing.
[0052] In this application, by parsing the public key certificate and the private key certificate, the corresponding public key information and the private key information can also be obtained.
[0053] Step 200: When it is determined that the public and private keys of the digital certificate do not match, the certificate chain of the digital certificate is completed based on the certificate path information and user information in the digital certificate to obtain a complete digital certificate.
[0054] After obtaining the digital certificate, the present application can obtain the public key information in the public key certificate of the digital certificate and the private key information in the private key certificate of the digital certificate.
[0055] Furthermore, according to the public key information and the private key information, a method of encrypting and decrypting the character string is adopted to determine whether the public and private keys of the digital certificate match.
[0056] The result of the public-private key matching check is that the public-private keys of the digital certificate do not match or the public-private keys of the digital certificate match.
[0057] If it is determined through verification that the public and private keys of the digital certificate do not match, indicating that the digital certificate is incomplete, the digital certificate chain needs to be completed to obtain a complete digital certificate.
[0058] When completing the certificate chain, this application can determine the certificate path information for obtaining the missing certificate based on the certificate path information and user information in the digital certificate.
[0059] Furthermore, the certificate can be pulled according to the certificate path information of the missing certificate to obtain the missing certificate.
[0060] Furthermore, the certificate chain of the digital certificate can be completed through the missing certificates, thereby obtaining a complete digital certificate.
[0061] The digital certificate management method provided in the embodiment of the present application determines whether the digital certificate is complete by performing a public-private key matching check on the digital certificate after obtaining the digital certificate. If it is determined that the public-private keys of the digital certificate do not match, indicating that the digital certificate is incomplete, the certificate chain of the digital certificate is completed through the certificate path information and user information in the digital certificate, thereby obtaining a complete digital certificate, making the digital certificate usable, avoiding direct correction of abnormal certificates when performing certificate management, and improving the security of certificate use on the basis of making the digital certificate usable.
[0062] In one embodiment, after obtaining the digital certificate, the method further includes:
[0063] Step A1, obtaining the public key information in the public key certificate of the digital certificate and the private key information in the private key certificate of the digital certificate;
[0064] In this application, the public key information parsing program can be called to parse the public key certificate in the digital certificate, thereby obtaining the public key information.
[0065] And, calling the private key information parsing program to parse the private key certificate in the digital certificate, thereby obtaining the private key information.
[0066] Step A2, encrypting the preset data based on the public key information to obtain encrypted data;
[0067] In the present application, the preset data can be encrypted by the public key information, and the encrypted data can be obtained after the encryption is completed.
[0068] The preset data may be a specified character string, such as a test character string.
[0069] Step A3, decrypting the encrypted data based on the private key information to obtain decrypted data;
[0070] In the present application, the encrypted data encrypted by the public key information can be decrypted by the private key information, and the decrypted data can be obtained after the decryption is completed.
[0071] Step A4: If the decrypted data is different from the preset data, it is determined that the public and private keys of the digital certificate do not match.
[0072] After obtaining the decrypted data, the present application can compare the decrypted data with the preset data before encryption and decryption, thereby determining whether the decrypted data is consistent with the preset data.
[0073] If it is determined that the decrypted data is different from the preset data, it means that the data before encryption by the public key information cannot be restored by the private key information, so it is determined that the public and private keys of the digital certificate do not match.
[0074] If it is determined that the decrypted data is consistent with the preset data, it means that the data before encryption by the public key information can be restored by the private key information, so it is determined that the public and private keys of the digital certificate match.
[0075] This embodiment can perform a public-private key matching check on a digital certificate to determine whether the digital certificate is complete. When it is determined that the public-private key of the digital certificate does not match, that is, the digital certificate is incomplete, the certificate chain of the digital certificate is completed through the certificate path information and user information in the digital certificate, thereby obtaining a complete digital certificate, making the digital certificate usable, avoiding direct correction of abnormal certificates when performing certificate management, and improving the security of certificate use on the basis of making the digital certificate usable.
[0076] In one embodiment, based on the certification path information and user information in the digital certificate, the digital certificate is completed with a certificate chain to obtain a complete digital certificate, including:
[0077] Step 201, extracting parent certificate path information and issuer information and user information in user information from each public key certificate of the digital certificate;
[0078] The present application can parse each public key certificate of a digital certificate, thereby extracting the parent certificate path information in each public key certificate, as well as the issuer information and user information in the user information of each public key certificate.
[0079] The specific process of parsing the public key certificate is not limited in this application.
[0080] Step 202, based on the parent certification path information, the issuer information and the user information, determine the target certification path information of the missing certificate in the certificate chain of the digital certificate;
[0081] After obtaining the parent certification path information, issuer information and user information of each public key certificate, this application can determine the certification path information of the missing certificate in the certificate chain of the digital certificate based on the issuer information and user information combined with the parent certification path information and use it as the target certification path information.
[0082] Step 203, obtaining the missing certificate according to the target certificate path information;
[0083] In this application, a certificate chain repository may be preset, wherein the preset certificate chain repository may store public key certificates and certification path information of each public key certificate.
[0084] This application can also be indexed through the certificate path to obtain the corresponding public key certificate.
[0085] Therefore, after obtaining the target certificate path information, the present application can obtain the missing certificate from a pre-set certificate chain repository or through a certificate index through the target certificate path information.
[0086] Step 204: Complete the certificate chain of the digital certificate according to the missing certificates to obtain a complete digital certificate.
[0087] After obtaining the missing certificate, the present application can use the missing certificate to complete the missing part in the certificate chain of the digital certificate, thereby obtaining a valid certificate chain and then obtaining a complete digital certificate.
[0088] Further, based on the parent certification path information, the issuer information and the subject information, the target certification path information of the missing certificate in the certificate chain of the digital certificate is determined, including:
[0089] Step 2021, if in each public key certificate there is a target public key certificate whose issuer information is not used as user information in all public key certificates, the parent certificate path information corresponding to the target public key certificate is determined as the target certificate path information of the missing certificate in the certificate chain of the digital certificate.
[0090] The present application can determine, by comparing the issuer information of each public key information with the user information, whether in each public key certificate the issuer information of any public key certificate is not used as user information in all public key certificates.
[0091] If, through comparison, it is determined that in each public key certificate, there is any public key certificate whose issuer information is not used as user information in all public key certificates, then the public key certificate is determined as the target public key certificate.
[0092] Further, the parent certification path information corresponding to the target public key certificate is searched from each parent certification path information, and the parent certification path information is determined as the target certification path information of the missing certificate in the certificate chain of the digital certificate.
[0093] Further, the missing certificate is obtained according to the target certificate path information, including:
[0094] Step 2031, matching information in a preset certificate chain repository according to the target certificate path information;
[0095] After obtaining the target certificate path information, the present application can use the target certificate path information as a keyword to query whether there is certificate path information consistent with the target certificate path information in the preset certificate chain repository. If so, the certificate stored in the certificate path corresponding to the certificate path information is determined to be a missing certificate.
[0096] Step 2032: If there is no certificate corresponding to the target certificate path information in the preset certificate chain repository, a certificate index is performed according to the target certificate path information, and the indexed certificate is determined as a missing certificate.
[0097] If it is determined through query that there is no certificate path information consistent with the target certificate path information in the preset certificate chain repository, then it is determined that there is no certificate corresponding to the target certificate path information in the preset certificate chain repository.
[0098] Therefore, the present application may further perform certificate indexing through the target certificate path information, extract the certificate from the path corresponding to the target certificate path information and determine it as a missing certificate.
[0099] This embodiment can complete the certificate chain of the digital certificate based on the certificate path information and user information in the digital certificate to obtain a complete digital certificate, making the digital certificate available and avoiding directly correcting abnormal certificates when performing certificate management. On the basis of making the digital certificate available, the security of certificate use is improved.
[0100] Further, after obtaining the missing certificate according to the target certificate path information, it also includes:
[0101] Step 205, encrypt the missing certificate to obtain an encrypted certificate;
[0102] After obtaining the missing certificate according to the target certificate path information, this application can encrypt the missing certificate to obtain an encrypted certificate.
[0103] In some embodiments, the present application may encrypt the missing certificate by PBEWithMD5AndDES, wherein PBEWithMD5AndDes uses Message Digest Algorithm 5 (MD5) and Data Encryption Standard (DES) to generate a key, and by default the jasypt library implements an 8-byte random salt plus 1000 iterations of the hash algorithm.
[0104] It should be noted that this application can be encrypted with the help of the Jasypt tool class under SpringBoot.
[0105] Step 206: Store the encryption certificate in a preset certificate chain repository.
[0106] After obtaining the encryption certificate, the present application may store the encryption certificate in a preset certificate chain repository.
[0107] Storing the encryption certificate in the preset certificate chain repository also makes it easier to obtain the corresponding certificate through the certificate path information when the same certificate path information is available later (when the intermediate certificate or root certificate is consistent).
[0108] However, certificates have a certain validity period. This is because Secure Socket Layer (SSL) certificates are based on trust. In the Internet age, websites change too quickly and this trust can be destroyed. Therefore, it is very important for certificate authorities that issue trusted certificates to ensure that the information verifying the identity of the server and organization is as up-to-date and accurate as possible. Once a certificate expires, it becomes invalid.
[0109] Therefore, this application can automatically update the public key certificates such as intermediate certificates and root certificates stored in the certificate chain repository, and automatically pull the content and update it after the validity period expires. Specifically, if the certificate is pulled and the verification passes, the repository is updated. If it cannot be pulled or fails the validity verification, the path is set to invalid and removed from the certificate chain repository.
[0110] This embodiment can improve the management efficiency of digital certificates by encrypting and storing the intermediate certificates and root certificates obtained from the parent certificate path parsed from the public key certificate, maintaining a self-built expandable certificate chain repository, and automatically updating or discarding the data in the repository when it expires.
[0111] Furthermore, after completing the certificate chain of the digital certificate to obtain a complete digital certificate, the method further includes:
[0112] Step 300: receiving a data access request, and encrypting access data in the data access request according to the digital certificate.
[0113] In this application, users can access data on the website where the digital certificate is mounted, and when accessing data, a data access request will be sent to the website.
[0114] After completing the certificate chain of the digital certificate to obtain a complete digital certificate and receiving a data access request, the access data specified in the data access request can be encrypted according to the public key information in the digital certificate and returned to the server. The server can decrypt the encrypted data using the private key information in the digital certificate and return the decrypted data to the user.
[0115] It should be noted that after obtaining a complete digital certificate, this application can also use the digital certificate to authenticate the website on which the digital certificate is mounted.
[0116] After obtaining a complete digital certificate, this embodiment can use the digital certificate to perform encryption and decryption processing on access data, thereby improving data security.
[0117] In one embodiment, the digital certificate management method provided in the embodiment of the present application may include the following steps:
[0118] Figure 2 A schematic diagram of the public and private key matching verification process of a certificate in the digital certificate management method provided in the embodiment of the present application. Figure 2 In this embodiment, the public and private keys of the uploaded digital certificate can be checked for matching. Specifically, the public and private keys of the digital certificate are actually the encryption and decryption keys of asymmetric encryption. The public key is used for encryption and the private key is used for decryption. If the public and private keys do not match, the website will be inaccessible.
[0119] Therefore, the present application can parse the public key content of the certificate to obtain the public key information publicKey, and parse the private key content of the certificate to obtain the private key information PrivateKey. Further, the test string is encrypted by the public key information publicKey to obtain an encrypted string. Further, the encrypted string is decrypted by the private key information PrivateKey to obtain a decrypted string. Further, the decrypted string is compared with the original string to see if they are consistent. If they are consistent, it is determined that the public and private keys match, and if they are inconsistent, it is determined that the public and private keys do not match.
[0120] For example, the public key information publicKey is parsed from the public key content of the uploaded certificate through CertificateFactory, which supports private key content in PKCS#1 and PKCS#8 formats. The private key information PrivateKey is parsed through RSAPrivateKey and PKCS8EncodedKeySpec classes. Then, by encrypting and decrypting the specified string, if the original string is obtained again, the public and private keys match.
[0121] Figure 3 A schematic diagram of the completion process of the certificate chain in the digital certificate management method provided in the embodiment of the present application. Figure 3, this embodiment can complete the certificate chain for incomplete certificates and verify the certificate chain content for complete certificates. The content of a public key certificate can be parsed to obtain rich certificate information, including the issuer, user, parent certificate path, etc. A valid certificate chain usually contains a service certificate, an intermediate certificate, and a root certificate, and the issuer of the subordinate certificate is the user of the superior certificate. This application verifies the correctness of the uploaded certificate with a complete certificate chain in this way. This application can build a certificate chain repository by itself, and pull and expand it by uploading the certificate path of the public key. The specific operation is as follows: if the uploaded certificate does not contain a complete certificate chain, the content of the upper-level certificate is obtained by parsing the certificate path. The content of the upper-level certificate is obtained as follows: if the path exists in the self-built certificate chain repository, the stored certificate content is directly used as the upper-level certificate. If it does not exist, it is pulled through the certificate path, and the path and content are saved in the certificate chain repository for standby. This cycle is repeated until the issuer and user information of the certificate are consistent, and the root certificate is obtained. The certificates obtained by the above process are aggregated to generate a complete and valid certificate chain.
[0122] In one embodiment, the format of the public key certificate can be checked, and after the format check is passed, it can be checked whether it has expired. If it has not expired, it is determined whether there is a complete certificate chain. If there is a complete certificate chain, each certificate in the certificate chain is checked step by step to determine whether the publisher of each subordinate certificate is the user of the superior certificate. If so, it is verified to obtain a complete certificate. If it is expired, the certificate chain is completed. Specifically, the certificate can be parsed to obtain the certificate path, and the certificate can be obtained from the certificate chain repository through the certificate path. It can be determined whether there is a corresponding path in the certificate chain repository. If so, it is checked whether the root certificate has been reached. If so, a complete certificate chain is formed by splicing the existing certificate with the obtained certificate. If not, the certificate is pulled through the certificate path and stored in the certificate chain repository, and it is checked whether the root certificate has been reached. If so, a complete certificate chain is formed by splicing the existing certificate with the pulled certificate.
[0123] Figure 4 A schematic diagram of the update process of the repository in the digital certificate management method provided in the embodiment of the present application. Figure 4 , this application can update the data in the certificate chain repository. Specifically, it can periodically detect whether the data in the certificate chain repository is expired. If not, it will not be updated; if it is, it will re-pull the certificate through the certificate path. Further, it is determined whether a new certificate is obtained. If so, a validity check is performed. If it fails, the original certificate and the new certificate are discarded. If it passes, it is updated to the certificate chain repository. If the certificate is not obtained, the original certificate is discarded.
[0124] Furthermore, the present application also provides a digital certificate management device.
[0125] Reference Figure 5 , Figure 5 This is a functional module diagram of an embodiment of a management device for applying for a digital certificate.
[0126] The digital certificate management device comprises:
[0127] An acquisition module 510 is used to acquire a digital certificate;
[0128] The completion module 520 is used to complete the certificate chain of the digital certificate based on the certificate path information and user information in the digital certificate to obtain a complete digital certificate when it is determined that the public and private keys of the digital certificate do not match.
[0129] The digital certificate management device provided in the embodiment of the present application determines whether the digital certificate is complete by performing a public-private key matching check on the digital certificate after obtaining the digital certificate. If it is determined that the public-private keys of the digital certificate do not match, indicating that the digital certificate is incomplete, the certificate chain of the digital certificate is completed through the certificate path information and user information in the digital certificate, thereby obtaining a complete digital certificate, making the digital certificate usable, avoiding direct correction of abnormal certificates when performing certificate management, and improving the security of certificate use on the basis of making the digital certificate usable.
[0130] In one embodiment, the acquisition module 510 is further configured to:
[0131] Obtaining public key information in the public key certificate of the digital certificate and private key information in the private key certificate of the digital certificate;
[0132] Encrypting the preset data based on the public key information to obtain encrypted data;
[0133] Decrypting the encrypted data based on the private key information to obtain decrypted data;
[0134] If the decrypted data is different from the preset data, it is determined that the public and private keys of the digital certificate do not match.
[0135] In one embodiment, the completion module 520 is used to:
[0136] Extracting parent certificate path information and issuer information and user information in user information from each public key certificate of the digital certificate;
[0137] Determine target certification path information of missing certificates in the certificate chain of the digital certificate based on the parent certification path information, the issuer information and the user information;
[0138] Acquire the missing certificate according to the target certificate path information;
[0139] The certificate chain of the digital certificate is completed according to the missing certificate to obtain a complete digital certificate.
[0140] In one embodiment, the completion module 520 includes a determination unit, the determination unit being configured to:
[0141] If, in each public key certificate, there is a target public key certificate whose issuer information is not used as user information in all public key certificates, the parent certificate path information corresponding to the target public key certificate is determined as the target certificate path information of the missing certificate in the certificate chain of the digital certificate.
[0142] In one embodiment, the completion module 520 includes an acquisition unit, which is used to:
[0143] According to the target certificate path information, information matching is performed in a preset certificate chain repository;
[0144] If the certificate corresponding to the target certificate path information does not exist in the preset certificate chain repository, certificate indexing is performed according to the target certificate path information, and the indexed certificate is determined as a missing certificate.
[0145] In one embodiment, the completion module 520 includes a storage unit, the storage unit being configured to:
[0146] Encrypting the missing certificate to obtain an encrypted certificate;
[0147] The encryption certificate is stored in the preset certificate chain repository.
[0148] In one embodiment, the completion module 520 is further configured to:
[0149] A data access request is received, and access data in the data access request is encrypted according to the digital certificate.
[0150] Figure 6 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 6 As shown, the electronic device may include: a processor 610, a communication interface 620, a memory 630 and a communication bus 640, wherein the processor 610, the communication interface 620 and the memory 630 communicate with each other through the communication bus 640. The processor 610 may call a computer program in the memory 630 to execute the steps of the digital certificate management method, for example including:
[0151] Obtain a digital certificate;
[0152] When it is determined that the public and private keys of the digital certificate do not match, the certificate chain of the digital certificate is completed based on the certificate path information and user information in the digital certificate to obtain a complete digital certificate.
[0153] In addition, the logic instructions in the above-mentioned memory 630 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art, and the computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk.
[0154] On the other hand, an embodiment of the present application further provides a storage medium, wherein the storage medium is a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, wherein the computer program is used to enable a processor to execute the steps of the methods provided in the above embodiments, for example, including:
[0155] Obtain a digital certificate;
[0156] When it is determined that the public and private keys of the digital certificate do not match, the certificate chain of the digital certificate is completed based on the certificate path information and user information in the digital certificate to obtain a complete digital certificate.
[0157] The computer-readable storage medium can be any available medium or data storage device that can be accessed by the processor, including but not limited to magnetic storage (such as floppy disks, hard disks, magnetic tapes, magneto-optical disks (MO), etc.), optical storage (such as CD, DVD, BD, HVD, etc.), and semiconductor storage (such as ROM, EPROM, EEPROM, non-volatile memory (NANDFLASH), solid-state drive (SSD)), etc.
[0158] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Those of ordinary skill in the art may understand and implement it without creative effort.
[0159] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0160] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for managing digital certificates, It is characterized in that include: Obtain a digital certificate; When it is determined that the public and private keys of the digital certificate do not match, the certificate chain of the digital certificate is completed based on the certificate path information and user information in the digital certificate to obtain a complete digital certificate.
2. The method for managing digital certificates according to claim 1, It is characterized in that The method of completing the certificate chain of the digital certificate based on the certificate path information and user information in the digital certificate to obtain a complete digital certificate includes: Extracting parent certificate path information and issuer information and user information in user information from each public key certificate of the digital certificate; Determine target certification path information of missing certificates in the certificate chain of the digital certificate based on the parent certification path information, the issuer information and the user information; Acquire the missing certificate according to the target certificate path information; The certificate chain of the digital certificate is completed according to the missing certificate to obtain a complete digital certificate.
3. The method for managing digital certificates according to claim 2, It is characterized in that The step of determining target certification path information of a missing certificate in the certificate chain of the digital certificate based on the parent certification path information, the issuer information, and the user information includes: If, in each public key certificate, there is a target public key certificate whose issuer information is not used as user information in all public key certificates, the parent certificate path information corresponding to the target public key certificate is determined as the target certificate path information of the missing certificate in the certificate chain of the digital certificate.
4. The digital certificate management method according to claim 2, It is characterized in that The obtaining the missing certificate according to the target certificate path information includes: According to the target certificate path information, information matching is performed in a preset certificate chain repository; If the certificate corresponding to the target certificate path information does not exist in the preset certificate chain repository, certificate indexing is performed according to the target certificate path information, and the certificate obtained by the indexing is determined as a missing certificate.
5. The method for managing digital certificates according to claim 4, It is characterized in that After acquiring the missing certificate according to the target certificate path information, the method further includes: Encrypting the missing certificate to obtain an encrypted certificate; The encryption certificate is stored in the preset certificate chain repository.
6. The method for managing digital certificates according to claim 1, It is characterized in that After obtaining the digital certificate, it also includes: Obtaining public key information in the public key certificate of the digital certificate and private key information in the private key certificate of the digital certificate; Encrypting the preset data based on the public key information to obtain encrypted data; Decrypting the encrypted data based on the private key information to obtain decrypted data; If the decrypted data is different from the preset data, it is determined that the public and private keys of the digital certificate do not match.
7. The digital certificate management method according to claim 1, It is characterized in that After completing the certificate chain of the digital certificate to obtain a complete digital certificate, the following steps are also included: A data access request is received, and access data in the data access request is encrypted according to the digital certificate.
8. A digital certificate management device, It is characterized in that include: An acquisition module, used to obtain a digital certificate; The completion module is used to complete the certificate chain of the digital certificate based on the certificate path information and user information in the digital certificate to obtain a complete digital certificate when it is determined that the public and private keys of the digital certificate do not match.
9. An electronic device comprising a processor and a memory storing a computer program, It is characterized in that When the processor executes the computer program, the digital certificate management method according to any one of claims 1 to 7 is implemented.
10. A storage medium, the storage medium being a computer-readable storage medium, comprising a computer program, It is characterized in that When the computer program is executed by a processor, the digital certificate management method according to any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Data certificate intelligent management method and system based on block chain
CN119743240A
Secret key generation method and device, electronic equipment and storage medium
CN121396436A
