Automatic password scheme generation method and system based on large language model

CN123020032APending Publication Date: 2026-10-30HEILONGJIANG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610960383.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-30
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

[0006]发明目的:本发明旨在解决当前密码方案设计中存在的专家依赖度高、通用大语言模型生成缺乏安全边界以及人工验证覆盖率不足等技术问题

Benefits of technology

[0017]有益效果:与现有技术相比,本发明所提供的一种基于大语言模型的自动密码方案生成方法的实质性特征和显著效果包括:

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123020032A_ABST
    Figure CN123020032A_ABST
Patent Text Reader

Abstract

The application discloses an automatic password scheme generation method based on a large language model, and belongs to the technical field of information security and artificial intelligence. In view of the problems that existing password design relies on experts, is low in efficiency, is easy to introduce vulnerabilities, and lacks constraints in large model generation, the application utilizes natural language processing to analyze user requirements, accurately matches algorithms in a local password component library through retrieval augmentation technology (RAG), and combines a multi-model cooperative generation scheme. The system introduces a hinge type verification mechanism to perform full-process closed-loop evaluation and automatic correction on the security and compliance of design and code. The application realizes efficient and reliable generation of a password scheme, significantly reduces the cost of manual intervention, and improves the security and deployability of the scheme.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of information security and artificial intelligence, and in particular to an automatic cryptographic scheme generation method and system based on large language models, retrieval-enhanced generation (RAG) technology and closed-loop feedback mechanism. Background Technology

[0002] With the rapid development of distributed computing scenarios such as cloud computing, the Internet of Things (IoT), and connected vehicles, the security protection needs of data throughout its entire lifecycle are becoming increasingly complex. Cryptographic technology, as the cornerstone of information security, requires a comprehensive consideration of security strength, computational performance, compliance standards, and resource constraints specific to the application scenario when designing solutions. However, existing cryptographic solutions face the following significant technical challenges in design and implementation: Manual design is both technically challenging and error-prone. Cryptography is a highly specialized discipline with strict constraints on algorithm selection, mode configuration, key management, and random number generation. Ordinary developers often struggle to accurately grasp complex cryptographic specifications, easily introducing security vulnerabilities into engineering implementations, such as misusing ECB modes, using insecure pseudo-random number generators, or hard-coded keys. These vulnerabilities are highly concealed and difficult to detect in timely routine testing.

[0003] Traditional automation tools lack flexibility. Existing low-code security development platforms or code generation tools are mostly based on fixed rule templates or static algorithm libraries. While this approach lowers the barrier to entry, it lacks the ability to understand complex business semantics, struggles to flexibly adapt to diverse customization needs (such as low power consumption, high concurrency, quantum resistance, etc.), and has poor scalability.

[0004] General Large Language Models (LLMs) lack necessary security constraints and closed-loop verification mechanisms in the cryptography vertical field. Since large models are essentially based on probabilistic statistics for text generation, they are prone to "illusion" phenomena when handling rigorous cryptographic logic, i.e., fabricating non-existent algorithm standards or referencing incorrect parameter configurations. More importantly, general models typically prioritize syntactic correctness in code generation, neglecting deep cryptographic semantic security. This makes them highly susceptible to generating code with known vulnerabilities such as side-channel leakage, weak random number generation, or padding oracle attacks. Furthermore, existing generation methods are mostly one-way "open-loop" outputs, lacking automated auditing, vulnerability detection, and logic correction feedback mechanisms for the generated results. Consequently, the generated cryptographic schemes fail to meet the stringent requirements of correctness, compliance, and robustness for engineering implementation.

[0005] Therefore, there is an urgent need for an intelligent cryptographic scheme generation technology that can deeply understand the security needs of natural language, integrate professional cryptographic knowledge bases, and have automated verification and self-correction capabilities, in order to solve the problems of low design efficiency, difficulty in ensuring security, and poor compliance in the current design. Summary of the Invention

[0006] Purpose of the Invention: This invention aims to address the technical problems existing in current cryptographic scheme design, such as high expert dependence, lack of security boundaries in general large language model generation, and insufficient coverage of manual verification. This invention proposes an automatic cryptographic scheme generation method and system based on large language models, retrieval-enhanced generation (RAG) technology, and a closed-loop feedback mechanism. By constructing an automated pipeline including semantic parsing, knowledge retrieval, collaborative generation, and closed-loop verification, it achieves automated, customized, and verifiable generation of cryptographic schemes while ensuring compliance and security.

[0007] Technical solution: An automatic cryptographic scheme generation method based on a large language model, comprising the following steps: S1. Obtain the password security requirements in natural language form input by the user, use natural language processing technology to perform semantic parsing, extract key elements including application scenario features, security goals and performance constraints, and construct a structured requirement representation; S2. Based on the structured requirement representation, using retrieval enhancement generation technology, retrieve and filter cryptographic components that meet the key elements from the pre-built structured cryptographic component library to form a candidate component set; S3. Input the structured requirement representation, the candidate component set, and the preset generation constraints as prompt information into the large language model to generate a candidate cryptographic scheme containing algorithm combination logic, parameter configuration, and implementation code; S4. Perform multi-dimensional verification processing on the candidate cryptographic schemes; if the verification fails, trigger a backtracking correction mechanism based on the verification feedback information, adjust the structured requirement representation or regenerate the candidate cryptographic schemes until all verifications are passed and the target cryptographic scheme is output.

[0008] Furthermore, step S1 also includes the following requirement integrity verification process: Based on the preset cryptographic scheme generation rules, it is determined whether there are any missing key parameters in the structured requirement representation; if there are any missing parameters, targeted guidance prompts are generated, supplementary input from the user is obtained through interactive means, and the structured requirement representation is updated until the minimum parameter conditions for generating the cryptographic scheme are met.

[0009] Furthermore, step S2 also includes: The structured requirements are represented and mapped to query vectors; Calculate the similarity between the query vector and the component vectors in the structured cryptographic component library, and select the components with similarity higher than a preset threshold as the initial set; Based on the performance constraints and compliance requirements in the structured requirements representation, the initial set is filtered to remove components that do not meet the constraints, thus obtaining the candidate component set. The components in the structured cryptographic component library are pre-associated with security attributes, parameter value ranges, and inter-component dependencies.

[0010] Furthermore, step S3 employs a multi-model collaborative generation mechanism, specifically including: The structured requirement representation is feature extracted using a requirement understanding model; The logical architecture of the cryptographic scheme is constructed using the scheme generation model based on the extracted features and the set of candidate components. The code generation model is used to generate standardized implementation code based on the logical architecture; A preliminary scan of the implementation code was performed using a security audit model; The models mentioned above are all large language models or intelligent agents configured for specific tasks.

[0011] Furthermore, the verification process in step S4 includes at least: Security verification: Check whether the candidate cryptographic schemes contain weak cryptographic algorithms, insecure random number generation methods, or known vulnerabilities; Performance verification: Evaluate whether the computational latency, throughput, or resource consumption of the candidate cryptographic schemes meet the performance constraints; Compatibility verification: Check whether there are any conflicts in the dependencies between components in the candidate cryptographic schemes.

[0012] Furthermore, the backtracking correction mechanism described in step S4 specifically includes: Locate conflicting constraints or incorrect parameters that caused the validation to fail; Based on the conflict constraint type, perform at least one of the following adjustment operations: Adjust the prompt words for the large input language model; Replace the candidate component in the set of candidate components; Provide feedback to the user regarding the conflict and request adjustments to the security requirements; After the adjustment is completed, return to step S3.

[0013] Furthermore, the structured requirement representation in step S1 includes at least: application scenario identifier, security target set, performance constraint parameter set, and compliance and security level parameter set; wherein, the performance constraint parameter set includes at least one of the following: computation latency threshold, memory usage limit, and throughput indicator.

[0014] The structured cryptographic component library in step S2 is built on a vector database. Its retrieval process uses an embedding model to convert textual requirements and component descriptions into high-dimensional vectors for matching.

[0015] The output target cryptographic scheme can take the form of: source code that can be directly called by a computer system; or a configuration file that includes component composition relationships, parameter descriptions, and verification reports.

[0016] On the other hand, the present invention also provides an automatic cryptographic scheme generation system based on a large language model, including a processor and a memory for storing a computer program, wherein the processor executes the method described above when running the computer program.

[0017] Beneficial effects: Compared with the prior art, the substantive features and significant effects of the automatic cryptographic scheme generation method based on a large language model provided by this invention include: The technical logic of this method encompasses four dimensions: semantic-driven requirement modeling, knowledge-enhanced constraint retrieval, controlled generation through multi-model collaboration, and closed-loop verification throughout the entire lifecycle. First, a formal modeling mechanism for requirements based on deep semantic understanding is constructed. Addressing the semantic gap between natural language descriptions and professional cryptographic specifications, as well as the unstructured characteristics of user business scenario input, this invention utilizes natural language processing technology to perform fine-grained entity extraction and intent recognition. This mechanism maps fuzzy business logic into a structured requirement representation that includes application scenario characteristics, security objectives, performance indicators, and compliance requirements, thereby establishing precise computational constraints and a formal foundation for subsequent cryptographic scheme generation.

[0018] Second, this invention introduces the Retrieval Enhanced Generation (RAG) paradigm and a structured cryptographic component library. Addressing the inherent probabilistic illusions and domain knowledge deficiencies in generative models, this invention uses high-dimensional vector retrieval technology to semantically align and match the aforementioned structured requirement representation with standard algorithm components, parameter configuration rules, and side-channel defense strategies in the cryptographic component library. The system recalls candidate cryptographic components that meet the hard constraints. By introducing external deterministic knowledge, strict security boundaries are set for the generation process of large models, effectively avoiding the risk of generating false algorithms or insecure parameters.

[0019] Third, a controlled generation architecture based on multi-agent collaboration is constructed. Addressing the uncontrollability of end-to-end generation from a single model, this invention designs a hierarchical collaborative reasoning mechanism. The system dynamically constructs contextual hints including retrieved evidence, constraints, and chain-of-thought, driving multiple agents, each focused on requirement understanding, solution logic construction, and code implementation, to collaborate. These agents interact and collaborate within a defined solution space, achieving a gradual refinement from abstract protocol logic to concrete code implementation, significantly improving the logical coherence and code robustness of complex cryptographic protocol generation.

[0020] Fourth, a closed-loop cross-validation strategy based on a negative feedback mechanism is implemented. To ensure the engineering feasibility and security of the generated results, this invention integrates formal verification, static code analysis, and dynamic performance testing tools to perform automated auditing of the generated cryptographic scheme throughout its entire lifecycle. Through a closed-loop feedback mechanism, once potential vulnerabilities such as insufficient random number entropy, algorithm dependency conflicts, or side-channel leakage are detected, the system automatically generates a negative feedback signal containing error location and correction suggestions. This drives the generation model to perform multiple rounds of iterative optimization and backtracking correction until the scheme passes all audit indicators, achieving a mechanism shift from "open-loop generation" to "closed-loop convergence." Attached Figure Description

[0021] Figure 1 Overall flow of the automatic cryptographic scheme generation method based on large language models; Figure 2 Schematic diagram of component retrieval and constraint filtering process. Detailed Implementation

[0022] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0023] The automatic cryptographic scheme generation method based on a large language model described in this embodiment follows the core logic of the entire lifecycle of data flow within the system. For example... Figure 1 As shown, this process is not a simple stacking of modules, but rather consists of four tightly coupled cascaded stages: requirement semantic parsing and formal modeling, knowledge-enhanced component constraint retrieval, controlled generation through multi-agent collaboration, and closed-loop verification throughout the entire lifecycle. The structured output generated in the previous stage serves as the logical constraint input for the next stage. Through a progressive processing mechanism, convergence towards a secure and usable cryptographic scheme is ultimately achieved.

[0024] The following will strictly follow the time sequence logic of data processing to explain the implementation details of each of the above stages.

[0025] This embodiment performs deep semantic parsing and formal modeling on the natural language requirements input by the user, aiming to transform unstructured business descriptions into a set of machine-computable cryptographic constraints. This is applied to the natural language text sequence input by the user. The system first performs domain-knowledge-based preprocessing. To address the adaptability issues of general-purpose word segmentation tools in the cryptography vertical domain, the system includes building a hybrid word segmentation engine integrating the SpaCy framework and a dedicated cryptographic ontology library, and mounting a domain dictionary containing over 2000 specialized terms. Building upon this foundation, the system utilizes a pre-trained BERT model (a pre-trained language model based on the Transformer encoder proposed in 2018) to generate context-aware word vectors. By calculating the cosine similarity of the vectors in high-dimensional space, it accurately resolves the ambiguity of polysemous words. Furthermore, it normalizes non-standard expressions into standard algorithm identifiers through regular mapping rules, thereby establishing the data standardization for subsequent processing.

[0026] For example, in a data encryption configuration scenario for a hospital's electronic medical record (EMR) system, developers of a medical information platform input natural language requirements through a management terminal. The requirements include encrypting EMR data during in-hospital transmission and cloud backup, ensuring the system meets medical data security compliance requirements, minimizing access latency for doctors, and supporting tiered protection of sensitive patient information and periodic key updates. After semantic parsing, the system transforms this input into a structured requirement model. First, it identifies that the requirement pertains to a medical information system environment and involves secure processing of EMR data during in-hospital transmission and cloud backup. Based on this, it further extracts security objectives such as data confidentiality protection, tiered control of sensitive information, and periodic key updates. Simultaneously, it identifies low-latency performance requirements for system access and, in conjunction with medical industry data security standards, determines the corresponding compliance constraints. Finally, these multi-dimensional constraints are uniformly encoded as input conditions for subsequent cryptographic component retrieval and scheme generation.

[0027] After text normalization, the system utilizes the BERT-CRF (Bidirectional Encoder Representation-Conditional Random Field) architecture to perform fine-grained key entity recognition. This model leverages BERT layers to capture deep semantic features and combines this with the CRF layer's ability to constrain label transition probabilities, ensuring the legitimacy of the output label sequence. The system predefines a multi-dimensional entity label space encompassing algorithm, protocol, security level, and platform constraints. The objective function for generating the optimal cryptographic scheme is defined as follows:

[0028] in, The input feature vector represents the cryptographic application scenarios, functional requirements, and constraints proposed by the user. Represent candidate cryptographic schemes; Indicates that under given demand characteristics Generate candidate cryptographic schemes under the condition The conditional probability is used to measure how well the solution matches the demand. This indicates selecting the option from all candidate solutions that satisfies the conditional probability. The scheme that yields the maximum value; thus generating the final optimal cryptographic scheme. .

[0029] Experiments have shown that this architecture achieves an F1-score of 92.3% on cryptographic entity recognition tasks, effectively extracting key technical elements from complex business descriptions.

[0030] In parallel with entity recognition, the system employs the BERT For Sequence Classification model to perform multi-label classification of user intent. The predefined intent category space includes encryption, authentication, key exchange, and random number generation, among others. The model outputs the Logits values ​​for each category, which are then processed by Sigmoid activation and normalization to obtain the ... Confidence score of class label The system is based on a preset threshold. The logic for filtering out high-confidence intents is as follows:

[0031] The system introduces an intent dependency graph mechanism to logically complete the model output. For example, if the recognition result contains "encryption" but lacks "key generation", the system will automatically deduce and complete the missing intent based on the graph dependency relationship, thereby solving the problem of implicit requirement omission caused by incomplete user description.

[0032] To address the specific numerical parameters involved in the requirements, the system further employs a hybrid extraction strategy combining rule engines and machine learning to perform structured parsing of fine-grained parameters such as key length, number of rounds, and block size. To eliminate computational obstacles caused by heterogeneous units, the system incorporates a unit conversion module to uniformly map various throughput and time units to standard units. Let the original value be... The conversion factor is Then the normalized parameter values The calculation is as follows:

[0033] In the formula, This indicates the source unit of the original parameters; it represents the initial unit of measurement carried by the user when inputting the original performance parameters. The target unit, together, serves as the conversion coefficient function. The input parameters are used to eliminate computational obstacles caused by heterogeneous units.

[0034] The system utilizes an inference engine to handle implicit constraints. For example, based on user input describing the application object, performance requirements, and security goals, it can automatically complete the implicit technical boundaries required to generate the cryptographic scheme. In the scenario of encrypting electronic medical record data in hospitals, after the system identifies requirements such as "cloud backup," "access latency should not be too high," and "meeting medical data security compliance requirements," it can further derive implicit constraints related to key encapsulation, remote updates, backup data protection, algorithm complexity, message processing efficiency, and the selection range of candidate cryptographic components. Similarly, in the description of IoT terminal scenarios, the system can automatically derive... .

[0035] The system performs logical integrity and consistency checks on all extracted results to ensure there are no inherent logical conflicts such as "RSA-4096" and "extremely low latency". After successful checks, the system encapsulates the cleaned information into structured quadruples. This is then passed as a defined formal input to the component retrieval module in the next stage: ,in, , , , These correspond to application scenario characteristics, a set of security objectives, a vector of performance constraints, and a set of compliance requirements, respectively, thus completing the transformation from natural language to a computable model.

[0036] After establishing the formalized requirement constraint model, the core challenge of the system lies in how to accurately map abstract mathematical constraints into cryptographic primitives that can be engineered and implemented. To this end, this embodiment constructs a Full-Spectrum Structured Cryptographic Knowledge Base and introduces a Retrieval Enhanced Generation (RAG) paradigm. Through a dual mechanism of "semantic alignment - hard constraint filtering," deterministic security boundaries are anchored in the probability space of the generative model. Figure 2 As shown, the component retrieval and constraint filtering process in this embodiment includes vectorized query mapping, component library similarity retrieval, and constraint filtering steps based on performance and compliance requirements, ultimately forming a candidate component set.

[0037] In this embodiment, the present invention constructs a highly complete cryptographic component library containing 152 components verified by international standards and top academic papers. This knowledge base is not simply a collection of code snippets, but rather covers the entire spectrum from classical cryptography to cutting-edge post-quantum cryptography. Its horizontal classification encompasses ten core technology areas: including 15 symmetric cryptographic components represented by AES and ChaCha20; 4 stream cipher components represented by Salsa20 and Grain-128; 22 hash functions including SHA-2 / 3, BLAKE2 / 3, and Keccak; and 11 message authentication code components including HMAC and Poly1305. Particularly noteworthy is that, addressing potential security threats from future quantum computing, this knowledge base proactively integrates post-quantum cryptographic algorithms such as Kyber and Dilithium, and supports 14 advanced privacy computing protocols such as zk-SNARK and MPC. This full-spectrum component coverage ensures that the system not only meets current conventional commercial cryptographic needs but also flexibly adapts to high-security levels or future quantum-resistant special scenarios.

[0038] To support efficient retrieval and intelligent reasoning, each component node in the knowledge base is assigned high-dimensional metadata tags and structured attributes. Vertically, each component is associated with security attributes, performance fingerprints, and dependency constraints. Based on this knowledge foundation, the system performs semantic retrieval based on dense vectors. The system then uses the structured requirement quadruples output from the previous stage... The application scenario characteristics and security objectives are mapped into a high-dimensional query vector. Correspondingly, each component in the knowledge base is encoded as an index vector through a fine-tuned Dense Passage Retrieval model. The system performs an approximate nearest neighbor search in the vector space, calculating the cosine similarity between the query intent and the component functionality. Its scoring function is formally defined as:

[0039] in, Indicates candidate cryptographic components The overall score represents the query vector corresponding to the demand characteristics. This represents the query vector corresponding to the demand characteristics. Indicates candidate cryptographic components The vector representation of , Represents the dot product of two vectors. and ... This represents the prior weight of the candidate cryptographic component, used to characterize the component's preset weight in terms of security, compliance, or historical usage, thereby weighting and correcting the similarity results.

[0040] To further ensure the compliance and feasibility of the solution, the system introduces a hard constraint masking mechanism after recalling the Top-K candidate set. This mechanism masks the performance constraint vectors in the requirement model. With compliance set Convert to Boolean filtering conditions. For example, if... Specifying the "National Cryptographic Standard" will automatically generate a mask vector, setting the similarity score of all non-GM / T series components to zero. If the requirement involves quantum-resistant scenarios, it will automatically mask traditional RSA or ECDH algorithms, retaining only PQC components such as Kyber or Dilithium. The resulting set of valid components... It can be represented as:

[0041] in, This represents the set of candidate components to be recalled. This represents the set of valid components after constraint filtering. Indicates candidate cryptographic components; This represents the performance constraints in the demand model. Represents the set of compliance constraints; The function is an indicator function that takes the value 1 when a candidate component meets the corresponding constraint, and takes the value 0 otherwise. Only when a candidate component meets both the performance constraint and the compliance constraint simultaneously will its corresponding product be 1, thus being included in the set of valid components.

[0042] To form a logical closed loop, the system utilizes the dependency graph in the knowledge base to complete the execution components. Since a single algorithm often cannot work independently, the system employs... The core algorithm in the process is anchoring, which automatically indexes and aggregates necessary auxiliary components. Assume the retrieved core algorithm is... The system will recursively parse its dependency tree and automatically complete supporting components such as the initialization vector generator (IV Gen) or key derivation function, thereby constructing a complete and logically consistent set of candidate components. This set not only contains algorithmic entities, but also carries parameter configuration templates and security warning information, providing an enhanced context that "understands both semantics and rules" for the next stage of multi-agent collaborative generation.

[0043] A complete set of candidate components was established through knowledge-enhanced retrieval. Subsequently, the system enters the core multi-agent collaborative controlled generation stage. This stage aims to leverage the strong reasoning capabilities of large language models to assemble discrete cryptographic primitives into a logically rigorous and executable complete solution. To overcome the limitations of single models in understanding specific domain knowledge or long texts, this embodiment innovatively constructs a heterogeneous large language model resource pool, integrating multiple cutting-edge foundational models, including OpenAI GPT-4, Anthropic Claude, and Zhipu AI GLM-4. The system is designed with an intelligent routing mechanism based on task characteristics, which dynamically schedules based on the characteristics of different models: it leverages GPT-4's superior logical reasoning capabilities to handle complex protocol interaction process design; it utilizes Claude's ultra-long context window to handle component descriptions containing a large number of technical specification documents; and it takes special advantage of GLM-4's deep understanding of Chinese context and China's national cryptographic standards (GM / T) to be specifically responsible for the parameter configuration and compliance checks of national cryptographic algorithms (such as SM2 / 3 / 4), thereby achieving complementary advantages of the models and ensuring that the generated solutions are both logical and compliant.

[0044] To drive the controlled generation of the aforementioned heterogeneous models, the system implemented a dynamic prompt word engineering approach. The system abandons the simple natural language question-answering model and instead adopts a structured context injection strategy. Specifically, the system injects the structured requirement quadruples generated in the first stage... Serialization into a task description, and the collection of components retrieved in the second stage. The interface documentation, parameter templates, and security warnings are transformed into retrieval evidence and combined with preset security coding standards, all through template functions. Mapped to high-dimensional prompt word vectors The construction process can be formally represented as:

[0045] in, This indicates a context concatenation operation. For knowledge reordering functions, These are system-level security constraint instructions. This structured input method effectively limits the generation scope of large models to the retrieved security components and compliance constraints, suppressing the generation of model "illusions" from the source.

[0046] At the generation and execution level, the system adopts a thought-chain-driven, layered collaborative architecture. First, the scheduled architect agent is based on... The system performs top-level design, outlining the interaction sequence and key lifecycle of the cryptographic protocol, and outputs a logical blueprint in the form of an abstract syntax tree. Subsequently, the coding agent receives this blueprint and, based on the characteristics of the target programming language, instantiates it into concrete source code. During this process, the system mandates that the model call... When processing components, the parameters defined in the knowledge base are strictly followed, and the final output is candidate cryptographic scheme code containing complete comments and dependency descriptions, providing an executable entity for the next stage of closed-loop verification.

[0047] Following the generation phase, to ensure the security and robustness of candidate cryptographic schemes during engineering implementation, the system initiates a closed-loop cross-validation process throughout its entire lifecycle. This phase goes beyond traditional syntax checking, integrating a multi-dimensional automated auditing engine. The system utilizes static application security testing tools to analyze the control flow and data flow of the generated source code, focusing on detecting the presence of hard-coded keys, weak random number generators, and side-channel leakage risks. Simultaneously, the system compiles and runs the code in an isolated dynamic sandbox environment, performing fuzzing and unit testing to verify the algorithm's behavioral stability under boundary conditions. The correctness of the encryption results is then verified using test vectors from national cryptographic standards, thus achieving comprehensive coverage from static code structure to dynamic runtime behavior.

[0048] For detected vulnerabilities or conflicts, the system triggers iterative solutions using a self-healing mechanism based on negative feedback. Defect information is transformed into correction prompts and fed back to the coding agent, driving the large model to perform targeted refactoring. This repair process is modeled as an objective function optimization problem, aiming to achieve... The next iteration searches for the optimal code. :

[0049] in, Indicates a combination of candidate cryptographic components. This represents the final optimal combination of components. Indicate combination A single cryptographic component in Indicates combination The collection of component elements contained therein Representation Component The weight or score is used to characterize the importance of the component in terms of security, performance, or adaptability; Indicates a function used to determine the component. Whether the preset constraints are met is evaluated; the value is 1 if the conditions are met, and 0 otherwise. The component combination with the highest score is selected by summing the weights of the components that meet the constraints. The optimal cryptographic scheme as the final output.

[0050] This embodiment successfully achieves intelligent and standardized cryptographic scheme design by constructing an automated pipeline that includes semantically driven formal modeling of requirements, knowledge-enhanced component constraint retrieval, controlled generation through multi-agent collaboration, and closed-loop verification throughout the entire lifecycle. The system leverages deep learning technology to bridge the semantic gap between natural language and cryptographic expertise. It effectively mitigates the illusionary risk of large models through a structured knowledge base and Retrieval Augmentation (RAG) technology. Furthermore, through the collaborative work of heterogeneous model pools and a closed-loop verification mechanism, it ensures that the final delivered cryptographic scheme is not only logically rigorous and self-consistent but also complies with national cryptographic standards and security best practices in engineering implementation. This provides an efficient, reliable, and low-barrier automated solution for high-security scenarios such as the Internet of Things, financial payments, and privacy computing.

Claims

1. A method for generating automatic cryptographic schemes based on a large language model, characterized by the following steps: include: S1. Obtain the password security requirements in natural language form input by the user, use natural language processing technology to perform semantic parsing, extract key elements including application scenario features, security goals and performance constraints, and construct a structured requirement representation; S2. Based on the structured requirement representation, using retrieval enhancement generation technology, retrieve and filter cryptographic components that meet the key elements from the pre-built structured cryptographic component library to form a candidate component set; S3. Input the structured requirement representation, the candidate component set, and the preset generation constraints as prompt information into the large language model to generate a candidate cryptographic scheme containing algorithm combination logic, parameter configuration, and implementation code; S4. Perform multi-dimensional verification processing on the candidate cryptographic schemes; If the verification fails, a backtracking correction mechanism is triggered based on the verification feedback information to adjust the structured requirement representation or regenerate candidate cryptographic schemes until all verifications are passed and the target cryptographic scheme is output.

2. The automatic cryptographic scheme generation method based on a large language model according to claim 1, characterized in that, Step S1 also includes the following requirement integrity verification process: Based on the preset cryptographic scheme generation rules, it is determined whether there are any missing key parameters in the structured requirement representation; if there are any missing parameters, targeted guidance prompts are generated, supplementary input from the user is obtained through interactive means, and the structured requirement representation is updated until the minimum parameter conditions for generating the cryptographic scheme are met.

3. The automatic cryptographic scheme generation method based on a large language model according to claim 1, characterized in that, Step S2 further includes: The structured requirements are represented and mapped to query vectors; Calculate the similarity between the query vector and the component vectors in the structured cryptographic component library, and select the components with similarity higher than a preset threshold as the initial set; Based on the performance constraints and compliance requirements in the structured requirements representation, the initial set is filtered to remove components that do not meet the constraints, thus obtaining the candidate component set. The components in the structured cryptographic component library are pre-associated with security attributes, parameter value ranges, and inter-component dependencies.

4. The automatic cryptographic scheme generation method based on a large language model according to claim 1, characterized in that, The multi-model collaborative generation mechanism adopted in step S3 specifically includes: The structured requirement representation is feature extracted using a requirement understanding model; The logical architecture of the cryptographic scheme is constructed using the scheme generation model based on the extracted features and the set of candidate components. The code generation model is used to generate standardized implementation code based on the logical architecture; A preliminary scan of the implementation code was performed using a security audit model; The models mentioned above are all large language models or intelligent agents configured for specific tasks.

5. The automatic cryptographic scheme generation method based on a large language model according to claim 1, characterized in that, The verification process in step S4 includes at least the following: Security verification: Check whether the candidate cryptographic schemes contain weak cryptographic algorithms, insecure random number generation methods, or known vulnerabilities; Performance verification: Evaluate whether the computational latency, throughput, or resource consumption of the candidate cryptographic schemes meet the performance constraints; Compatibility verification: Check whether there are any conflicts in the dependencies between components in the candidate cryptographic schemes.

6. The automatic cryptographic scheme generation method based on a large language model according to claim 1, characterized in that, The backtracking correction mechanism described in step S4 specifically includes: Locate conflicting constraints or incorrect parameters that caused the validation to fail; Based on the conflict constraint type, perform at least one of the following adjustment operations: Adjust the prompt words for the large input language model; Replace the candidate component in the set of candidate components; Provide feedback to the user regarding the conflict and request adjustments to the security requirements; After the adjustment is completed, return to step S3.

7. The automatic cryptographic scheme generation method based on a large language model according to claim 1, characterized in that, The structured requirement representation in step S1 includes at least: application scenario identifier, security target set, performance constraint parameter set, and compliance and security level parameter set; wherein, the performance constraint parameter set includes at least one of the following: computation latency threshold, memory usage limit, and throughput indicator.

8. The automatic cryptographic scheme generation method based on a large language model according to claim 1, characterized in that, The structured cryptographic component library in step S2 is built on a vector database. Its retrieval process uses an embedding model to convert textual requirements and component descriptions into high-dimensional vectors for matching.

9. The automatic cryptographic scheme generation method based on a large language model according to claim 1, characterized in that, The output target cryptographic scheme can take the form of: source code that can be directly called by a computer system; or a configuration file that includes component composition relationships, parameter descriptions, and verification reports.

10. An automatic cryptographic scheme generation system based on a large language model, characterized in that, It includes a processor and a memory for storing a computer program, wherein the processor, when running the computer program, performs the method as described in any one of claims 1 to 9.