Attribute encryption test method, device, equipment and computer program product

By determining the target test type and object and using preset test scripts for alliance chain attribute encryption testing, the problem of low test automation in the existing technology is solved, the test efficiency is improved and visual results are generated.

CN119939646APending Publication Date: 2025-05-06HANGZHOU HIGH-TECH ZONE (BINJIANG) INSTITUTE OF BLOCKCHAIN & DATA SECURITY
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411785254.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-05
Publication Date
2025-05-06

AI Technical Summary

Technical Problem

In the prior art, the degree of automation of alliance chain attribute encryption testing methods is low, resulting in low testing efficiency.

Method used

Provides an attribute encryption testing method, which determines the corresponding target test object and test script by determining the target test type (such as attribute encryption contract testing, attribute encryption service interface testing, attribute encryption algorithm testing), and tests the target object based on the test script to generate test results.

Benefits of technology

It improves the automation and efficiency of attribute encryption-related tests, generates visual test results, and simplifies the viewing and analysis of test results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119939646A_ABST
    Figure CN119939646A_ABST
Patent Text Reader

Abstract

The embodiment of the invention is applicable to the technical field of block chains, and provides an attribute encryption test method, device and equipment and a computer program product. The method comprises the following steps: determining a target test type; the test type comprises at least one of an attribute encryption contract test, an attribute encryption service interface test and an attribute encryption algorithm test; determining a target test object and a target test script corresponding to the target test type; the target test object is tested according to the target test script, a test result is generated, automatic tests of dimensions such as an attribute encryption contract test, an attribute encryption service interface test and an attribute encryption algorithm test are carried out for attribute encryption, and a visual test result is generated. While the automation degree of the attribute encryption test is improved, the efficiency of checking the test result by related personnel is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application belong to the field of blockchain technology, and in particular, relate to an attribute encryption testing method, device, equipment and computer program product. Background Art

[0002] Consortium chain is a form of blockchain technology, which is between public chain and private chain. Consortium chain is a blockchain jointly managed by multiple organizations. Each organization or institution manages one or more nodes, and its data is only allowed to be read, written and sent by different institutions within the system.

[0003] In the consortium chain, attribute encryption is an important technology that combines the decentralized nature of blockchain and the flexibility of attribute encryption to achieve secure data sharing and fine-grained access control. Attribute encryption allows data owners to set access policies based on user attributes (such as roles, permissions, etc.), thereby controlling who can access specific data.

[0004] Currently, most of the testing methods for attribute encryption of consortium chains are semi-automated testing, that is, the test scripts are automated but the degree of automation of the entire test process is low. Summary of the invention

[0005] In view of this, the embodiments of the present application provide a method, apparatus, device and computer program product for testing attribute encryption, so as to improve the automation and efficiency of related tests on attribute encryption in alliance chains.

[0006] A first aspect of an embodiment of the present application provides an attribute encryption testing method, including:

[0007] Determine the target test type; the test type includes at least one of attribute encryption contract test, attribute encryption service interface test, and attribute encryption algorithm test;

[0008] Determine a target test object and a target test script corresponding to the target test type;

[0009] The target test object is tested according to the target test script, and a test result is generated.

[0010] In some implementations, if the test type includes attribute encryption contract testing and / or attribute encryption service interface testing; before determining a target test case matching the target test type, the method further includes:

[0011] Get cluster configuration information;

[0012] Deploy the alliance chain cluster according to the cluster configuration information.

[0013] In some implementations, if the test type includes attribute encryption contract testing; the method further includes:

[0014] Determine one or more attribute encryption management contracts to be tested;

[0015] The attribute encryption management contract is deployed in the alliance chain cluster.

[0016] In some implementations, determining a target test object and a target test script corresponding to the target test type includes:

[0017] Determine the attribute encryption management contract as the target test object;

[0018] Determine the preset contract interface test script as the target test script;

[0019] Among them, the contract interface test script matches multiple contract programming languages, and the contract interface test script is used to perform functional testing and / or security testing on the attribute encryption management contract.

[0020] In some implementations, if the test type includes an attribute encryption service interface test; before determining a target test object and a target test script corresponding to the target test type, the method further includes:

[0021] Determine the target service programming language;

[0022] Deploy an attribute encryption service based on the target service programming language;

[0023] Deploy message queue services and storage services;

[0024] Determine first configuration information of the message queue and second configuration information of the storage service;

[0025] The first configuration information and the second configuration information are added to the attribute encryption service.

[0026] In some implementations, determining a target test object and a target test script corresponding to the target test type includes:

[0027] Determine the interface of the attribute encryption service as a target test object;

[0028] Determine the preset service interface test script as the target test script;

[0029] The service interface test script matches a plurality of preset service programming languages; the service interface test script is used to perform at least one of functional testing, abnormal scenario testing, performance testing, and security testing on the attribute encryption service interface.

[0030] In some implementations, if the target test type is an attribute encryption algorithm test; determining a target test object and a target test script corresponding to the target test type includes:

[0031] Determine the attribute encryption algorithm interface in the preset software development kit as the target test object;

[0032] Determine the preset algorithm interface test script as the target test script;

[0033] The algorithm interface test script matches a variety of algorithm programming languages; the algorithm interface test script is used to perform at least one of functional testing, fuzz testing, and security testing on the attribute encryption algorithm interface.

[0034] A second aspect of an embodiment of the present application provides an attribute encryption testing device, including:

[0035] A test type determination module, used to determine a target test type; the test type includes at least one of an attribute encryption contract test, an attribute encryption service interface test, and an attribute encryption algorithm test;

[0036] A test object and test script determination module, used to determine a target test object and a target test script corresponding to the target test type;

[0037] The test result generating module is used to test the target test object according to the target test script and generate the test result.

[0038] A third aspect of an embodiment of the present application provides an electronic device, comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the electronic device implements the attribute encryption testing method as described in the first aspect above.

[0039] A fourth aspect of an embodiment of the present application provides a computer program product, including a computer program. When the computer program is run, the attribute encryption testing method described in the first aspect is executed.

[0040] A fifth aspect of an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the attribute encryption testing method as described in the first aspect above is implemented.

[0041] Compared with the prior art, the embodiments of the present application have the following beneficial effects:

[0042] In an embodiment of the present application, by determining at least one of attribute encryption contract testing, attribute encryption service interface testing, and attribute encryption algorithm testing as a target test type; determining a target test object and a target test script corresponding to the target test type; testing the target test object according to the target test script, and generating a test result, automated testing of attribute encryption contract testing, attribute encryption service interface testing, attribute encryption algorithm testing and other dimensions is implemented for attribute encryption, and visual test results are generated, thereby improving the degree of automation of attribute encryption testing and improving the efficiency of relevant personnel in viewing test results. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the embodiments or prior art descriptions. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0044] Figure 1 is a schematic diagram of an attribute encryption testing method provided in an embodiment of the present application;

[0045] Figure 2 This is a framework diagram of an attribute encryption service test system provided in an embodiment of the present application;

[0046] Figure 3 It is a flow chart of an attribute encryption service testing system provided by an embodiment of the present application;

[0047] Figure 4 is a schematic diagram of an attribute encryption testing device provided in an embodiment of the present application;

[0048] Figure 5 It is a schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0049] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.

[0050] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.

[0051] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0052] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.

[0053] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.

[0054] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0055] The technical solution of the present application is described below through specific embodiments.

[0056] Reference Figure 1 , shows a schematic diagram of an attribute encryption test method provided in an embodiment of the present application, which may specifically include the following steps:

[0057] Step 101, determining a target test type; the test type includes at least one of attribute encryption contract test, attribute encryption service interface test, and attribute encryption algorithm test;

[0058] The embodiments of the present application provide a variety of test types to test attribute encryption from different dimensions, and the test types include: attribute encryption contract test, attribute encryption service interface test and attribute encryption algorithm test.

[0059] Attribute encryption contract testing is to test attribute encryption from the contract layer, that is, to test the attribute encryption management contract. In practice, attribute encryption management contracts generated by different contract programming languages ​​may be deployed in the same alliance chain. The embodiment of the present application can automatically test attribute encryption management contracts that match one or more contract programming languages. The contract programming language refers to the computer language used to write management contracts, such as: Solidity, Vyper, Rust.

[0060] The attribute encryption service interface test is to test the attribute encryption service from the interface layer, that is, to test the interface provided by the attribute encryption service, such as performance testing, security testing, etc. The attribute encryption service is generated by one of a variety of service programming languages. The embodiment of the present application can automatically test the attribute encryption service matched by one or more service programming languages. The service programming language refers to the computer language used to write the attribute encryption service, such as GO, JAVA, Python.

[0061] The attribute encryption algorithm test is to test the implementation logic of the attribute encryption algorithm. Since the attribute encryption algorithms used by the attribute encryption services generated by different service programming languages ​​are also different, that is, the attribute encryption algorithm can be generated by one of a variety of algorithm programming languages, correspondingly, the embodiment of the present application can automatically test the attribute encryption algorithms that match one or more algorithm programming languages. The algorithm programming language refers to the computer language used to write the attribute encryption algorithm, such as: GO, JVA, Python.

[0062] Step 102, determining a target test object and a target test script corresponding to the target test type;

[0063] Different test types correspond to different test objects. For example, the test object of the attribute encryption contract test is the attribute encryption management contract, the test object of the attribute encryption service interface test is the attribute encryption service, and the test object of the attribute encryption algorithm test is the attribute encryption algorithm interface.

[0064] The test type that needs to be tested is determined to be the target test type in the above test types. After the target test type is determined, the corresponding test object is determined to be the target test object according to the target test type.

[0065] Different test scripts are pre-set for different test types, and the corresponding test script is determined as the target test script according to the target test type.

[0066] Step 103: Test the target test object according to the target test script and generate a test result.

[0067] One or more test cases are pre-set in each test script. The target test object is tested automatically by running the target test script, and the test results are generated based on the test data.

[0068] After the test of each target test type is completed, visual test results can be automatically generated. For example, the visual test results show the pass rate of test case execution, the test coverage of attribute encryption development code, the security test results of attribute encryption management contracts, and the possible vulnerabilities in the underlying implementation of attribute encryption algorithms, so that relevant personnel can conduct statistical analysis on the test results, quickly locate the defect location, and improve the efficiency of relevant personnel in repairing attribute encryption defects.

[0069] As an example, the test results may also display corresponding modification suggestion information for existing defects to instruct relevant personnel to handle the existing defects.

[0070] In the application embodiment, by determining at least one of the attribute encryption contract test, attribute encryption service interface test, and attribute encryption algorithm test as the target test type; determining the target test object and the target test script corresponding to the target test type; testing the target test object according to the target test script, and generating test results, thereby realizing automated testing of attribute encryption contract testing, attribute encryption service interface testing, attribute encryption algorithm testing and other dimensions for attribute encryption, and generating visual test results, while improving the degree of automation of attribute encryption testing and improving the efficiency of relevant personnel in viewing test results.

[0071] In some embodiments of the present application, if the test type includes attribute encryption contract testing and / or attribute encryption service interface testing; before step 102, the method also includes: obtaining cluster configuration information; and deploying the alliance chain cluster according to the cluster configuration information.

[0072] If the test type includes attribute encryption contract testing and / or attribute encryption service interface testing, the attribute encryption management contract and attribute encryption service need to be tested. The attribute encryption management contract needs to be deployed on the consortium chain cluster, and the attribute encryption service also requires the consortium chain cluster for data transmission. Therefore, before performing attribute encryption contract testing or attribute encryption service interface testing, the consortium chain cluster needs to be deployed.

[0073] After obtaining the cluster configuration information, the alliance chain cluster is built according to the cluster configuration information.

[0074] As an example, cluster configuration information may be pre-set and called when testing is required.

[0075] As another example, with permission, the cluster configuration information of an existing alliance chain cluster can be read, and an alliance cluster for attribute encryption service testing can be built based on the cluster configuration information.

[0076] The above cluster configuration includes information such as node IP, port, message queue type, message queue IP, consensus algorithm, etc.

[0077] In some embodiments of the present application, if the test type includes an attribute encryption contract test; the method further includes: determining one or more attribute encryption management contracts to be tested; and deploying the attribute encryption management contract in the alliance chain cluster.

[0078] If the test type includes attribute encryption contract testing, it is determined that the attribute encryption management contract in the alliance chain cluster needs to be tested.

[0079] After completing the deployment of the alliance chain cluster, before testing the attribute encryption management contract, one or more attribute encryption management contracts to be tested are required, and the attribute encryption management contracts to be tested are deployed in the alliance chain cluster.

[0080] Since the attribute encryption management contract is an important information transmission and information storage carrier between the attribute encryption service and the alliance chain cluster, it is very important to test the contract methods in the attribute encryption management contract. In the test of the attribute encryption management contract, the functional test and security test of each contract method are carried out by simulating the contract data.

[0081] In the specific implementation, before testing the attribute encryption management contract, put the written attribute encryption management contract into the specified directory, and run the pre-written program code uniformly to implement the relevant operations of the attribute encryption management contract (compile, deploy, call, update, etc.).

[0082] In this embodiment, determining the target test object and the target test script corresponding to the target test type includes: determining the attribute encryption management contract as the target test object; determining a preset contract interface test script as the target test script; wherein the contract interface test script matches a plurality of contract programming languages, and the contract interface test script is used to perform functional testing and / or security testing on the attribute encryption management contract.

[0083] For attribute encryption contract testing, the target test object corresponding to the attribute encryption contract testing can be determined as the attribute encryption contract, and the pre-set contract interface test script can be determined as the target test script. By running the contract interface test script, the encryption attribute management contract can be tested using the test cases in the contract interface test script.

[0084] As an example, the test of the encryption attribute management contract includes functional testing and security testing. Among them, the functional test includes the test of contract interfaces such as registering institutions, updating institutions, obtaining institution information, registering users, adding user attributes, updating user status, updating user attribute status, adding encrypted data, updating encryption policies, and obtaining decryption keys. Security testing methods such as symbolic execution, taint analysis, and vulnerability detection can be used to test the security of the attribute encryption management contract.

[0085] Since the attribute encryption management contract can be written in contract programming languages ​​such as Solidity, Go, Java, and Rust, the above-mentioned contract interface test script supports multiple contract programming languages ​​to cover various encryption attribute contracts. The contract compilation, deployment, call, and update methods corresponding to smart contracts written in different contract programming languages ​​are also different. The embodiment of the present application can uniformly manage the compilation, deployment, call, and update operations of attribute encryption management contracts written in different languages ​​through the above-mentioned pre-written program code, and realize fully automated testing of encryption attribute contracts.

[0086] The contract interface test script integrates the methods of contract operation of different contract virtual machines, which is compatible with the functional testing and security testing of attribute encryption management contracts written in different contract programming languages. It can quickly manage the entire life cycle of attribute encryption contracts developed in different contract programming languages.

[0087] In some embodiments of the present application, if the test type includes an attribute encryption service interface test; before determining the target test object and the target test script corresponding to the target test type, the method also includes: determining the target service programming language; deploying the attribute encryption service based on the target service programming language; deploying a message queue service and a storage service; determining first configuration information of the message queue and second configuration information of the storage service; and adding the first configuration information and the second configuration information to the attribute encryption service.

[0088] If the test type includes attribute encryption service interface testing, you need to deploy the attribute encryption service after completing the alliance chain deployment. In order to realize the processing and storage of data related to the data encryption service, you also need to deploy the message queue service and storage service.

[0089] In order to connect the deployed attribute encryption service with the above-deployed alliance chain cluster to realize data interaction between the attribute encryption service and the alliance chain cluster, the relevant information of the alliance chain cluster (for example, IP information) can be automatically obtained before the attribute encryption service is deployed, and automatically read and used when the attribute encryption service is deployed.

[0090] In practice, there are a variety of service programming languages ​​that can be used to write attribute encryption services. The embodiments of the present application provide attribute encryption service deployment and testing in different service programming languages.

[0091] As an example, relevant personnel may determine a target service programming language from a plurality of preset service programming languages; and deploy attribute encryption services, message queue services, and storage services based on the target service programming language.

[0092] As another example, a service programming language matching the current test environment is automatically selected as the target service programming language, and then based on the target service programming language, the attribute encryption service, the message queue service, and the storage service are deployed.

[0093] As an example, when deploying the attribute encryption service, the message queue service needs to be set up. The embodiment of the present application supports the automated deployment of different types of message queue services, and after the message queue service is deployed, the message queue service's message IP, port number and other configuration information (first configuration information) is dynamically configured into the attribute encryption service for subsequent use of the attribute encryption service.

[0094] As an example, after the relational or non-relational database (LevelDB, MongoDB, Mysql, PostgreSQL, etc.) is deployed through the relevant service platform, the relevant configuration information (second configuration information) of the storage service is dynamically configured into the attribute encryption service for subsequent use of the attribute encryption service.

[0095] The embodiment of the present application does not restrict the deployment process of the message queue service and the storage service. It only requires that the message queue service and the storage service can interact with the attribute encryption service for data.

[0096] In this embodiment, determining the target test object and the target test script corresponding to the target test type includes: determining the interface of the attribute encryption service as the target test object; determining a preset service interface test script as the target test script; the service interface test script matches a plurality of preset service programming languages; the service interface test script is used to perform at least one of functional testing, abnormal scenario testing, performance testing, and security testing on the attribute encryption service interface.

[0097] For the attribute encryption service interface test, the target test object corresponding to the attribute encryption service test can be determined as the attribute encryption service interface contained in the deployed attribute encryption service, and the pre-set service interface test script can be determined as the target test script. By running the service interface test script, the attribute encryption service interface of the attribute encryption service can be tested using the test cases in the service interface test script.

[0098] After completing the deployment of the alliance chain cluster, attribute encryption service, message queue service and storage service, the test case execution phase of the interface layer test (attribute encryption service test) is entered. The service interface test script is written in advance by the tester, which supports the automated testing of attribute encrypted user registration, organization registration, user status query, organization status query and other interfaces, and includes conventional functional testing, abnormal scenario testing, performance testing, security testing and other functions.

[0099] As an example, the service interface test script matches the multiple preset service programming languages, so that attribute encryption services corresponding to different service programming languages ​​can be tested using the same service interface test script, thereby improving the automation level and testing efficiency of the attribute encryption service interface test.

[0100] In some embodiments of the present application, if the target test type is an attribute encryption algorithm test; the determination of the target test object and the target test script corresponding to the target test type includes: determining the attribute encryption algorithm interface in the preset software development kit as the target test object; determining the preset algorithm interface test script as the target test script; the algorithm interface test script matches multiple algorithm programming languages; the algorithm interface test script is used to perform at least one of functional testing, fuzz testing, and security testing on the attribute encryption algorithm interface.

[0101] Unlike the tests at the interface layer (attribute encryption service test) and the contract layer (attribute encryption contract test), the tests at the algorithm layer (encryption attribute algorithm test) are more inclined to the underlying algorithm implementation of attribute encryption technology. Testing at the algorithm layer does not require the deployment of attribute encryption services and consortium chains. The algorithm interface implemented in the SDK (software development kit) for attribute encryption technology can be directly tested, including the attribute encryption global parameter generation interface, the organization private key and public key pair generation interface, the encryption interface, the user attribute key pair generation interface, and the decryption interface. The above algorithm interface can be automated tested through the algorithm interface test script, and the execution of the algorithm interface test script includes functional testing, fuzz testing, and security testing for the above algorithm interface.

[0102] As an example, the algorithm interface test script is matched with the multiple algorithm programming languages, so that the attribute encryption algorithm interfaces corresponding to different algorithm programming languages ​​can be tested using the same algorithm interface test script, so that testers do not need to pay attention to the internal implementation of the attribute encryption algorithm interface to carry out testing, thereby improving the degree of automation and testing efficiency of the attribute encryption algorithm test.

[0103] The embodiment of the present application discloses a testing method for attribute encryption. After determining the target test type through attribute encryption contract testing, attribute encryption service interface testing, and attribute encryption algorithm testing, the corresponding target test object and target test script are determined according to the target test type, and the target test object is tested according to the target test script to realize automated attribute encryption contract testing, attribute encryption service interface testing, and attribute encryption algorithm testing, and generate visual test results. While improving the degree of automation of attribute encryption testing, the efficiency of relevant personnel in viewing test results is improved.

[0104] It should be noted that the target test type can be one or more of the attribute encryption contract test, the attribute encryption service interface test, and the attribute encryption algorithm test. In the case where the target test type includes at least two of the attribute encryption contract test, the attribute encryption service interface test, and the attribute encryption algorithm test, parallel testing can be performed for different test types to improve test efficiency. For example: if the target test type includes the attribute encryption contract test and the attribute encryption service interface test, the corresponding target test objects and target test scripts can be determined in parallel for the attribute encryption contract test and the attribute encryption service interface test, and the attribute encryption contract test and the attribute encryption service interface test can be automatically completed in parallel, and the generated visual test results include the processing results of the attribute encryption contract test and the attribute encryption service interface test.

[0105] In order to implement the attribute encryption test method provided in the embodiment of the present application, the embodiment of the present application discloses an attribute encryption service test system. Figure 2A framework diagram of an attribute encryption service test system provided by an embodiment of the present application is shown. The attribute encryption service test system includes: automated test code, an attribute encryption service scheduling platform, an auxiliary unit, and a consortium chain cluster. The automated test code includes three different levels of test code, namely, the interface layer, the contract layer, and the algorithm layer; the attribute encryption service scheduling platform is used to automatically build an attribute encryption service platform implemented in languages ​​such as Go / Java / Python according to the upper-level test requirements when the attribute encryption service needs to be deployed; the auxiliary unit module is used to automatically deploy message queue services and storage services (relational and non-relational databases such as LevelDB, MongoDB, Mysql, PostgreSQL, etc.) as needed; the consortium chain cluster is used for auxiliary testing of attribute encryption services and deployment of attribute encryption management contracts, and consortium chain clusters of different consensus algorithm types are deployed according to different needs.

[0106] Relevant personnel can use Figure 2 The system framework shown in the figure is used to test the interface layer, contract layer, and algorithm layer of the attribute encryption algorithm. Figure 3 , shows a flow chart of an attribute encryption service testing system provided by an embodiment of the present application, Figure 2 The test system shown can be performed as follows Figure 3 The process shown. It includes:

[0107] 3001. When it is necessary to test the interface / contract layer of attribute encryption, deploy a consortium chain cluster for subsequent use of the attribute encryption platform and deployment of the attribute encryption management contract.

[0108] 3002. When testing the interface layer, the system automatically loads the attribute encryption scheduling module. If the user does not specify an attribute encryption platform, the system will randomly select an attribute encryption platform developed in languages ​​such as Java / Go / Python and deploy it. If the user specifies it, the system will select the platform specified by the user for deployment.

[0109] 3003. After completing the platform construction of the attribute encryption service, the steps of building the message queue service and creating the topics required for testing are automatically triggered to complete the automated deployment process of the message queue module.

[0110] 3004. According to the storage type supported by the attribute encryption service platform, the storage module is built and initialized. The attribute encryption service platform is successfully deployed only after the entire storage module is started.

[0111] 3005. Test the interface of the attribute encryption platform deployed in step 3002 according to the interface automation test script that has been written. The interface automation test script uniformly supports the attribute encryption platform written in Java / Go / Python.

[0112] 3006. When testing the contract layer, complete the deployment of the attribute encryption management contract in the alliance chain.

[0113] 3007. Use a unified contract interface test script to perform automated testing on the attribute encryption management contract. The contract interface test script supports contracts in languages ​​such as Solidity, Go, and Rust.

[0114] 3008. When testing the algorithm layer, directly call the attribute encryption algorithm interface implemented in the SDK.

[0115] 3009. Use a unified algorithm interface test script to perform automated testing on the underlying implementation algorithm of attribute encryption.

[0116] 3010. After executing the tests of the interface layer, contract layer, and algorithm layer, generate a test report (test results) based on the results of the automated testing.

[0117] In the specific implementation, you can test one of the interface layer, contract layer, and algorithm layer, and generate a corresponding test report. Taking the interface layer as an example, you can test attribute encryption through the following process:

[0118] 3101. Before starting the full process automated test, the tester specifies the test type of the attribute encryption service system to be tested, such as specifying the interface layer of the attribute encryption system to be tested. If the test type is not specified, the system will randomly select one from the interface layer, contract layer, and algorithm layer.

[0119] 3102. Select the alliance chain version and generate the configuration file required to deploy the alliance chain. The alliance chain configuration file is automatically generated based on the available node information. The file contains the IP, port, user, password, message queue type, consensus algorithm type and other information of each node in the alliance chain. At the same time, the configuration file required for the normal startup of the alliance chain, such as the permission information of each node and the node certificate, is configured.

[0120] 3103. Use the alliance chain automatic deployment tool to deploy the alliance chain cluster according to the alliance chain version selected in step 3102 and the generated related configuration files.

[0121] 3104. Schedule and deploy the attribute encryption service (end). If the attribute encryption service version to be tested (Java / Go / Python) has been specified, the configuration file required to start the attribute encryption service is generated and the service is started. If not specified, the default is to randomly select from all development language versions of the attribute encryption service. If there are new attribute encryption services developed in other programming languages ​​in the future, they can be added here directly.

[0122] 3105. Deploy the message queue service. Deploy the message queue service, such as starting the RabbitMQ service. After starting, add the IP and port number of the RabbitMQ to the configuration file of the attribute encryption server, which is dynamically loaded. After the attribute encryption server dynamically adds the message queue service, it automatically creates a topic based on the current configuration file for event subscription with the alliance chain cluster.

[0123] 3106. According to the attribute encryption server deployed in step 3104, automatically select and deploy a storage module that matches it. For example, start LevelDB in the current environment to store information such as organizations, users, and encryption keys on the server.

[0124] 3107. After the basic information of the above tests is started, select the interface test related test script and execute it. The interface test related test script includes conventional function test, boundary value test, abnormal scenario test and performance test.

[0125] 3108. After the test in step 3107 is completed, a visual test report is automatically generated. The test report contains information such as the pass rate of the test cases, the test coverage of the attribute encryption server, and the performance test results of each interface. At the same time, modification suggestions can also be given for common interface problems.

[0126] It should be noted that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0127] Reference Figure 4 , shows a schematic diagram of an attribute encryption test device provided in an embodiment of the present application, which may specifically include a test type determination module 401, a test object and test script determination module 402, and a test result generation module 403, wherein:

[0128] The test type determination module 401 is used to determine the target test type; the test type includes at least one of attribute encryption contract test, attribute encryption service interface test, and attribute encryption algorithm test;

[0129] A test object and test script determination module 402, used to determine a target test object and a target test script corresponding to the target test type;

[0130] The test result generating module 403 is used to test the target test object according to the target test script and generate a test result.

[0131] In some embodiments of the present application, if the test type includes attribute encryption contract test and / or attribute encryption service interface test; the device further includes:

[0132] A cluster configuration information acquisition module is used to obtain cluster configuration information;

[0133] The alliance chain cluster deployment module is used to deploy the alliance chain cluster according to the cluster configuration information.

[0134] In some embodiments of the present application, the device further comprises:

[0135] An attribute encryption management contract determination module, used to determine one or more attribute encryption management contracts to be tested;

[0136] The attribute encryption management contract deployment module is used to deploy the attribute encryption management contract in the alliance chain cluster.

[0137] In some embodiments of the present application, the test object and test script determination module 402 includes:

[0138] A first target test object determination unit, configured to determine the attribute encryption management contract as a target test object;

[0139] A target test script first determination unit, used to determine a preset contract interface test script as a target test script;

[0140] Among them, the contract interface test script matches multiple contract programming languages, and the contract interface test script is used to perform functional testing and / or security testing on the attribute encryption management contract.

[0141] In some embodiments of the present application, if the test type includes attribute encryption service interface testing; before the test object and test script determination module 402, the device further includes:

[0142] A target service programming language determination module, used to determine the target service programming language;

[0143] An attribute encryption service deployment module, used to deploy the attribute encryption service based on the target service programming language;

[0144] Message queue and storage service deployment module, used to deploy message queue services and storage services;

[0145] A service configuration information determination module, used to determine the first configuration information of the message queue and the second configuration information of the storage service;

[0146] A service configuration information adding module is used to add the first configuration information and the second configuration information to the attribute encryption service.

[0147] In some embodiments of the present application, the test object and test script determination module 402 includes:

[0148] A second target test object determination unit, configured to determine an attribute encryption service interface in the attribute encryption service as a target test object;

[0149] A target test script second determination unit, used to determine a preset service interface test script as a target test script;

[0150] The service interface test script matches a plurality of preset service programming languages; the service interface test script is used to perform at least one of functional testing, abnormal scenario testing, performance testing, and security testing on the interface of the attribute encryption service.

[0151] In some embodiments of the present application, if the target test type is an attribute encryption algorithm test; the test object and test script determination module 402 includes:

[0152] A third target test object determination unit is used to determine the attribute encryption algorithm interface in the preset software development toolkit as the target test object;

[0153] A target test script third determination unit, used to determine a preset algorithm interface test script as a target test script;

[0154] The algorithm interface test script matches a variety of algorithm programming languages; the algorithm interface test script is used to perform at least one of functional testing, fuzz testing, and security testing on the attribute encryption algorithm interface.

[0155] An embodiment of the present application provides an attribute encryption testing device, and by using the device, each step in the aforementioned method embodiments can be implemented.

[0156] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiment part.

[0157] Reference Figure 5 , shows a schematic diagram of an electronic device provided by an embodiment of the present application. Figure 5 As shown, the electronic device 500 in the embodiment of the present application includes: a processor 510, a memory 520, and a computer program 521 stored in the memory 520 and executable on the processor 510. When the processor 510 executes the computer program 521, the steps in each embodiment of the above-mentioned attribute encryption test method are implemented, such as Figure 1Alternatively, when the processor 510 executes the computer program 521, the functions of each module / unit in the above-mentioned device embodiments are realized, for example Figure 4 Functions of modules 401 to 403 are shown.

[0158] Exemplarily, the computer program 521 may be divided into one or more modules / units, which are stored in the memory 520 and executed by the processor 510 to complete the present application. The one or more modules / units may be a series of computer program instruction segments capable of completing specific functions, which may be used to describe the execution process of the computer program 521 in the electronic device 500. For example, the computer program 521 may be divided into a test type determination module, a test object and test script determination module, and a test result generation module, and the specific functions of each module are as follows:

[0159] A test type determination module, used to determine a target test type; the test type includes at least one of an attribute encryption contract test, an attribute encryption service interface test, and an attribute encryption algorithm test;

[0160] A test object and test script determination module, used to determine a target test object and a target test script corresponding to the target test type;

[0161] The test result generating module is used to test the target test object according to the target test script and generate the test result.

[0162] The electronic device 500 may be a computing device such as a desktop computer or a cloud server. The electronic device 500 may include, but is not limited to, a processor 510 and a memory 520. Those skilled in the art will appreciate that Figure 5 It is only an example of the electronic device 500 and does not constitute a limitation of the electronic device 500. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the electronic device 500 may also include input and output devices, network access devices, buses, etc.

[0163] The processor 510 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0164] The memory 520 may be an internal storage unit of the electronic device 500, such as a hard disk or memory of the electronic device 500. The memory 520 may also be an external storage device of the electronic device 500, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device 500. Further, the memory 520 may also include both an internal storage unit of the electronic device 500 and an external storage device. The memory 520 is used to store the computer program 521 and other programs and data required by the electronic device 500. The memory 520 may also be used to temporarily store data that has been output or is to be output.

[0165] The embodiments of the present application further disclose a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the attribute encryption testing method described in the aforementioned embodiments is implemented.

[0166] An embodiment of the present application further discloses a computer program product, including a computer program. When the computer program is run, the attribute encryption testing method described in the above embodiments is executed.

[0167] The above-described embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application is described in detail with reference to the above-mentioned embodiments, a person skilled in the art should understand that the technical solutions described in the above-mentioned embodiments can still be modified, or some of the technical features can be replaced by equivalents; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application.

Claims

1. A property encryption testing method, characterized in that: include: Determine the type of test to target; The test type includes at least one of attribute encryption contract test, attribute encryption service interface test, and attribute encryption algorithm test; Determine a target test object and a target test script corresponding to the target test type; The target test object is tested according to the target test script, and a test result is generated.

2. The method according to claim 1, characterized in that If the test type includes attribute encryption contract test and / or attribute encryption service interface test; before determining the target test case matching the target test type, the method further includes: Get cluster configuration information; Deploy the alliance chain cluster according to the cluster configuration information.

3. The method according to claim 2, characterized in that If the test type includes attribute encryption contract testing; the method further includes: Determine one or more attribute encryption management contracts to be tested; The attribute encryption management contract is deployed in the alliance chain cluster.

4. The method according to claim 3, characterized in that: The determining of the target test object and the target test script corresponding to the target test type includes: Determine the attribute encryption management contract as the target test object; Determine the preset contract interface test script as the target test script; Among them, the contract interface test script matches multiple contract programming languages, and the contract interface test script is used to perform functional testing and / or security testing on the attribute encryption management contract.

5. The method according to claim 2, characterized in that: If the test type includes an attribute encryption service interface test; before determining a target test object and a target test script corresponding to the target test type, the method further includes: Determine the target service programming language; Deploy an attribute encryption service based on the target service programming language; Deploy message queue services and storage services; Determine first configuration information of the message queue and second configuration information of the storage service; The first configuration information and the second configuration information are added to the attribute encryption service.

6. The method according to claim 5, characterized in that The determining of the target test object and the target test script corresponding to the target test type includes: Determine an attribute encryption service interface in the attribute encryption service as a target test object; Determine the preset service interface test script as the target test script; The service interface test script matches a plurality of preset service programming languages; the service interface test script is used to perform at least one of functional testing, abnormal scenario testing, performance testing, and security testing on the attribute encryption service interface.

7. The method according to claim 1, characterized in that If the target test type is an attribute encryption algorithm test; the determining of a target test object and a target test script corresponding to the target test type includes: Determine the attribute encryption algorithm interface in the preset software development kit as the target test object; Determine the preset algorithm interface test script as the target test script; The algorithm interface test script matches a variety of algorithm programming languages; the algorithm interface test script is used to perform at least one of functional testing, fuzz testing, and security testing on the attribute encryption algorithm interface.

8. An attribute encryption testing device, characterized in that: include: A test type determination module, used to determine a target test type; The test type includes at least one of attribute encryption contract test, attribute encryption service interface test, and attribute encryption algorithm test; A test object and test script determination module, used to determine a target test object and a target test script corresponding to the target test type; The test result generating module is used to test the target test object according to the target test script and generate the test result.

9. An electronic device, characterized in that: The electronic device comprises a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the electronic device implements the method according to any one of claims 1 to 7.

10. A computer program product, characterized in that The invention comprises a computer program, which, when being executed, enables the method according to any one of claims 1 to 7 to be performed.

Citation Information

Cited By

  • Method and device for testing message queue of alliance chain, electronic equipment and program product

    CN121509281A

  • Message queue testing method and device for consortium chain, electronic equipment and program product

    CN121509281B