This invention discloses a method and
system for detecting cryptographic misuse in open-source
software based on a large
language model, belonging to the field of
computer data processing technology. First, the
source code of the program under test is parsed to generate a hierarchical function
call graph, and file-level components containing call points are selected. Then, a first cue word guides the large
language model to determine whether the component is related to cryptographic functions, and a second cue word identifies the user-defined key cryptographic function for the relevant component. Next,
parameter analysis and backward data flow tracing are performed on the function to generate function call path slices. Then, a third cue word guides the large
language model to analyze the slices, generating a preliminary set of cryptographic misuse reports. Finally, a fourth cue word guides the large language model to calibrate the preliminary reports in conjunction with the code slices, outputting the final misuse report. This invention integrates the advantages of
static analysis and a large language model, enabling more comprehensive detection of cryptographic misuse and effectively reducing the
false positive rate.