A method for running NX post-processing program in an encrypted manner

By encrypting NX post-processor files and creating dynamic link library files for decryption and operation, the problem of poor file security is solved and the security protection and normal operation of files are achieved.

CN118445773BActive Publication Date: 2024-09-27CHINA HANGFA GUIZHOU LIYANG AVIATION POWER CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410903368.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2024-04-24
Filing Date
2024-07-08
Publication Date
2024-09-27
Estimated Expiration
2044-07-08

AI Technical Summary

Technical Problem

Since the NX post-processing program file is written in TCL language and is displayed in plain text, it has poor security and is easily modified and stolen.

Method used

By encrypting the file with the file extension tcl and saving the encrypted file as a non-tcl file, create a dynamic link library file to decrypt and run the encrypted file, edit the original file to call the code of the dynamic link library file, overwrite the original content to achieve file security protection.

Benefits of technology

It effectively hides the plain text content of post-processed files to prevent them from being modified or stolen, ensuring the security of the files and ensuring normal operation when needed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118445773B_ABST
    Figure CN118445773B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for encrypting and running an NX post-processing program, which belongs to the technical field of computer data protection, and comprises the following steps: S1, selecting a file with a file extension of tcl, encrypting it and saving it as a new file with a file extension of not tcl; S2, creating a new dynamic link library file, which contains a code for decrypting the file with a file extension of not tcl in S1 after encryption and running the file; S3, writing a file path for obtaining a new file with a file extension of not tcl in S1 after encryption and a code for calling a dynamic link library file in S2 in the file, and overwriting all original contents in the file; S4, calling an NX software post-processing program to load the file with a file extension of tcl edited in S3 for post-processing operation. The present invention effectively guarantees the security of post-processing files, and avoids the problems of file modification, difficult on-site version management and easy theft.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of numerical control machining of mechanical parts and CAM software, and in particular relates to a method for encrypting and running a post-processing program of NX software. Background Art

[0002] NX is a digital product development system developed by Siemens that integrates CAD / CAE / CAM. The software is mainly used in the mechanical design and manufacturing fields of aviation, aerospace, automobile and other industries.

[0003] The CAM module of NX can generate machining tool paths for parts. Figure 1 However, the tool path file of the programming software cannot be directly input into the machine tool for use. It needs to be post-processed to be converted into a code (NC code) that can be recognized by the corresponding machine tool. Figure 2 As shown, the machine tool can execute the machining program correctly.

[0004] The NX post-processing program consists of three files, including *.def, *.pui, and *.tcl files. Figure 3 As shown. These files are scripts written in TCL language, among which *.tcl files contain all the functional codes of the post-processor and are the main files of the post-processor. The post-processor can read the tool path information in NX and convert it into readable code for CNC machine tools. However, due to the characteristics of TCL language, such as simplicity, convenience, and no need for compilation, the NX post-processor files are displayed in plain text, which has the disadvantages of poor security, easy modification, difficult on-site version management, and easy theft. Summary of the invention

[0005] The present invention aims to provide a method for encrypting and running an NX post-processing program, thereby enhancing the security of NX post-processing files, protecting the expensive NX post-processing program from being stolen or modified by others, and safeguarding the interests of the developers and owners of the NX post-processing program.

[0006] To achieve the above object, the present invention adopts the following technical solutions:

[0007] A method for encrypting and running an NX post-processing program, wherein the NX post-processing program includes a file with a file extension of tcl and text displayed as plain text, comprising the following processing steps:

[0008] S1, select a file with a file extension of tcl, determine whether its encoding type is utf-8, if yes, encrypt it to hide its plain text, and save the encrypted file as a new file with a file extension other than tcl, if no, convert the file encoding type to utf-8 first, and then encrypt it;

[0009] S2, creating a new dynamic link library file, wherein the dynamic link library file contains code for decrypting the file whose file extension is not tcl after being encrypted in S1 and running the file;

[0010] S3, edit the file with the file extension of tcl in S1, write the file path of the new file with the file extension of tcl after encryption in S1 and the code of calling the dynamic link library file in S2 in the file, and overwrite all the original contents in the file with the above code;

[0011] S4, calling the NX software post-processing program to load the file with the file extension tcl edited in S3 for post-processing operation.

[0012] As an option, in S1, if the encoding type of the file is not utf-8, the file is first saved as a temporary file, and then the temporary file is converted and encrypted in sequence.

[0013] As an option, in S1, any text file encryption algorithm is used to encrypt the file with the file extension tcl.

[0014] As an option, the new file whose file extension is not tcl after encryption in S1, the dynamic link library file created in S2 and the file whose file extension is tcl after editing in S3 are saved in the same path.

[0015] As an option, in the S1, an encryption program is created to encrypt files with a file extension of tcl.

[0016] Furthermore, the encryption program is written in C#.

[0017] As an option, in S1, before encrypting the file with the file extension tcl, the file is backed up first.

[0018] As an option, in S2, the dynamic link library file is written using C language combined with TCL language.

[0019] As an option, in S2, the dynamic link library file also includes codes for obtaining the tcl file version in NX and running under different tcl file versions by calling the tcl placeholder function.

[0020] As an option, in S3, the code for obtaining the file path of the new file whose file extension is not tcl after encryption in S1 and calling the dynamic link library file in S2 is written in TCL language.

[0021] Compared with the prior art, the present invention designs a novel NX post-processing program encryption method, which makes it impossible to directly view and modify the post-processing file. When post-processing is required, the dynamic runtime library is used to decrypt the file in real time during program operation, effectively ensuring the security of the NX post-processing file. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Figure 1 This is a screenshot of the CAM module interface of NX software, in which a visual tool path has been generated based on the model;

[0023] Figure 2 Screenshot of the process of converting NX tool path files into NC programs for CNC machine tools after post-processing;

[0024] Figure 3 This is an example of the NX post-processing file structure;

[0025] Figure 4 The NX post-processing encryption program, decoding dynamic link library file and tcl script file are used in the embodiment;

[0026] Figure 5 This is a screenshot of the interface for running "NX Post-Processing TCL File Encryptor.exe";

[0027] Figure 6 Screenshot of the interface for selecting the *.tcl file to be encrypted;

[0028] Figure 7 Select the output path for the encrypted *.tclx file and take a screenshot of the encryption interface;

[0029] Figure 8 Take a screenshot of the new file content after encryption, the file extension is not tcl, the plain text has been encrypted;

[0030] Fig. 9 To ensure that the encrypted NX post-processing can generate NC code screenshots normally;

[0031] Fig.10 This is a screenshot of the encrypted NX post-processing program file structure in the embodiment;

[0032] Fig.11 The following is a flowchart of the NX post-processing procedure in non-encrypted and encrypted situations. DETAILED DESCRIPTION

[0033] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments, but it should not be understood that the scope of the subject matter described in the present invention is limited to the following embodiments. Without departing from the above-mentioned technical ideas of the present invention, various modifications, substitutions and changes made according to the common technical knowledge and customary means in the field are included in the scope of the present invention.

[0034] The purpose of the present invention is to achieve the following:

[0035] (1) Encrypt the *.tcl script file in the post-processing file, hide its plain text, and save the encrypted file. Since the tcl source code may have different encodings, which may cause the program to run abnormally, the encryption program needs to convert the tcl file to utf-8 encoding before encryption.

[0036] (2) Write the decryption algorithm into the dynamic link library file (*.dll) of the Windows system.

[0037] (3) Write a script program that calls the dynamic link library and the encrypted file into the *.tcl file, replacing all the plaintext codes in the original *.tcl.

[0038] (4) When using NX software for post-processing operations, the *.tcl script file will call the dynamic link library to process the encrypted file and execute the decrypted script file (after calling the dynamic link library to decrypt the ciphertext, the decrypted script file needs to be executed to enable it to realize the function of post-processing and converting the tool path file), so that the post-processing program can be used normally.

[0039] Step (1) implements the file encryption function by writing a computer executable program, and the executable program corresponds to the decryption algorithm in step (2). The encryption algorithm in the present invention is a common text encryption method, and any reliable text encryption algorithm can be applied in the present invention. For example, the XOR text encryption method is a simple and commonly used text encryption algorithm, and the encryption method can be applied to the encryption of the present invention.

[0040] Step (3) Use TCL language to write a script program to call other files.

[0041] like Fig.11 As shown in Figure 2, the NX post-processing process is compared between non-encrypted and encrypted cases.

[0042] The present invention is applicable to the encryption of NX post-processing files, and is described in conjunction with a set of NX post-processing encryption operation system in this embodiment.

[0043] The NX post-processing encryption operation system of the present invention is mainly composed of three files, including an encryption executable program file, a dynamic link library file, and a file with a file extension of tcl. Figure 4 ,in:

[0044] 1) "NX Post-processing TCL File Encryptor.exe" is an executable program that reads the *.tcl file in the NX post-processing program file and encrypts the output. It is written in C#. The encryption program reads the tcl file and determines whether it is utf-8 encoded. If it is, it encrypts it. If not, it runs the encoding conversion function to convert it into a temporary file encoded in utf-8, and then encrypts the temporary file.

[0045] 2) "Lxt.dll" is a dynamic link library file, which is written in C language and TCL language. It not only has the function of decoding the encrypted file output by "NX post-processing tcl file encryptor.exe" and running its code in the post-processing process (that is, decrypting and running the decrypted script file to realize the post-processing function), but also has the function of obtaining the tcl version in the current computer NX at runtime and calling the tcl placeholder function to realize the operation under different tcl versions.

[0046] 3) "Replacement script.tcl" is a script file written in TCL language. It only contains the code that can obtain the current encrypted file path and call the dynamic link library file "Lxt.dll". It does not contain other functional codes, thus avoiding the risk of post-processing code being modified and leaked.

[0047] Taking the Windows operating system as an example, the detailed steps for encrypting and running NX post-processing are as follows:

[0048] 1) Back up the NX post-processing files (*.tcl files) that need to be encrypted.

[0049] 2) Double-click the compiled executable program "NX Post-Processing TCL File Encryptor.exe" icon to open the program. Figure 5 The software interface in .

[0050] 3) Click the Select Encrypted File box and select the *.tcl file you want to encrypt in the pop-up file browser. The file browser is limited to only selecting files with the extension ".tcl". For details, see Figure 6 In this example, select the GS1000.tcl file in the "D:\TEST" path.

[0051] 4) Click the Start Encryption button, the software will read the *.tcl file for encryption and store the encrypted file in the *.tclx file in the same path. Figure 7 , use a text editor to open the *.tclx file, in this case the GS1000.tclx file, you can find that the encrypted file has garbled characters, indicating that the encryption is successful, see Figure 8 .

[0052] 5) Rename the "Replace script.tcl" file in the NX post-processing encryption running system to the post-processing name to be encrypted. For example, in this example, rename it to "GS1000.tcl". The function of this script is to call the dynamic link library and decrypt and run the encrypted file.

[0053] 6) Copy the renamed "GS1000.tcl" file and the dynamic link library "Lxt.dll" to the NX post-processing file path and replace the original files. In this embodiment, copy them to "D:\TEST", such as Fig.10 .

[0054] 7) Test the encrypted NX post-processing to check whether the program runs normally, such as Fig. 9 shown.

[0055] After the above steps, the NX post-processing file has been encrypted. The GS1000.tcl file and GS1000.tclx file no longer contain the plain text script program in the original NX post-processing file, so you can safely give it to others to use and manage it.

[0056] The contents not described in detail in the specification of the present invention belong to the prior art known to the professional and technical personnel in the field. Although the illustrative specific embodiments of the present invention are described above to facilitate the understanding of the present invention by the technical personnel in the field, it should be clear that the present invention is not limited to the scope of the specific embodiments. For ordinary technicians in the field of this technology, as long as various changes are within the spirit and scope of the present invention defined and determined by the attached claims, these changes are obvious, and all inventions and creations using the concept of the present invention are protected.

Claims

1. A method for encrypting and running an NX post-processing program, wherein the NX post-processing program includes a file with a file extension of tcl and text displayed as plain text, It is characterized in that The following processing steps are included: S1, select a file with a file extension of tcl, determine whether its encoding type is utf-8, if yes, encrypt it to hide its plain text, and save the encrypted file as a new file with a file extension other than tcl, if no, convert the file encoding type to utf-8 first, and then encrypt it; S2, creating a new dynamic link library file, wherein the dynamic link library file contains code for decrypting the file whose file extension is not tcl after being encrypted in S1 and running the file, and the dynamic link library file also contains code for obtaining the tcl file version in NX and running under different tcl file versions by calling the tcl placeholder function; S3, edit the file with the file extension of tcl in S1, write the file path of the new file with the file extension of tcl after encryption in S1 and the code of calling the dynamic link library file in S2 in the file, and overwrite all the original contents in the file with the above code; S4, calling the NX software post-processing program to load the file with the file extension tcl edited in S3 for post-processing operation.

2. A method for encrypting and running an NX post-processing program according to claim 1, Features: In S1, if the encoding type of the file is not utf-8, the file is first saved as a temporary file, and then the temporary file is converted and encrypted in sequence.

3. A method for encrypting and running a NX post-processing program according to claim 1, Features: In S1, any text file encryption algorithm is used to encrypt the file with the file extension tcl.

4. A method for encrypting and running a NX post-processing program according to claim 1, Features: The new file whose file extension is not tcl after being encrypted in S1, the dynamic link library file created in S2 and the file whose file extension is tcl after being edited in S3 are saved in the same path.

5. A method for encrypting and running a NX post-processing program according to claim 1, Features: In S1, an encryption program is created to encrypt files with a file extension of tcl.

6. A method for encrypting and running a NX post-processing program according to claim 5, Features: The encryption program is written in C#.

7. A method for encrypting and running a NX post-processing program according to claim 1, Features: In S1, before encrypting the file with the file extension tcl, the file is backed up first.

8. A method for encrypting and running a NX post-processing program according to claim 1, Features: In S2, the dynamic link library file is written by using C language combined with TCL language.

9. A method for encrypting and running a NX post-processing program according to claim 1, Features: In S3, the TCL language is used to write the code for obtaining the file path of the new file whose file extension is not tcl after encryption in S1 and calling the dynamic link library file in S2.