Method for encrypting a source text, method for decrypting a source text, and development system

EP4602487A1Pending Publication Date: 2025-08-20BECKHOFF AUTOMATION GMBH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
EP2023813322
Authority / Receiving Office
EP · EP
Patent Type
Applications
Current Assignee / Owner
Priority Date
2022-11-25
Filing Date
2023-11-22
Publication Date
2025-08-20

AI Technical Summary

Technical Problem

Version control systems in the automation sector face challenges in protecting source code from unauthorized access, particularly when multiple developers collaborate or when systems are publicly accessible, risking the disclosure of trade secrets.

Method used

A method for encrypting source code in version control systems that generates an encrypted source code version, which is then textualized to maintain the line structure, allowing changes to be tracked without exposing the actual code, using line-by-line encryption and textualization, and reversible decryption to restore the original code for authorized access.

Benefits of technology

This method ensures secure management and protection of source code within version control systems, preventing unauthorized access while allowing authorized developers to maintain and develop the code, thereby safeguarding trade secrets and simplifying the development process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 1.1
    Figure 1.1
Patent Text Reader

Abstract

The invention relates to a method (100) for encrypting a source text (301) for use in a version control system (315), comprising: providing the source text (301) in an unencrypted and textual form in a provision step (101); carrying out encryption of the source text (301) and generating an encrypted source text version (303) in an encryption step (103); and carrying out textualisation of the encrypted source text version (303) and generating a textualised representation (305) of the encrypted source text version (303) in a textualisation step (105). The invention further relates to a method (200) for decrypting an encrypted source text version (303) and to a development system (300) for carrying out the methods (100, 200).
Need to check novelty before this filing date? Find Prior Art

Description

[0001] Description

[0002] Method for encrypting a source text, method for decrypting a source text and development system

[0003] The invention relates to a method for encrypting a source text for use in a version control system, a method for decrypting a correspondingly encrypted source text and a development system which is configured to carry out the two methods.

[0004] Programmable logic controllers (PLCs) are predominantly used to control and regulate machines and systems, particularly in the automation sector. The control and regulation behavior is expressed by appropriately configured control programs that can be executed on the respective PLC. Such control programs are usually developed by a developer individually for the respective machine or system type.

[0005] Version control systems are known from the state of the art for the development of source code. Such version control systems make it possible to save and manage different versions of the source code being developed, thereby structuring the source code development process and allowing the developer(s) to access older versions of the source code during the development process.

[0006] In addition to managing the versions of the source code created during a development process, state-of-the-art version control systems enable the identification of changes made between different versions of the source code.

[0007] For this purpose, the different versions of the source code are stored in the memory area of ​​the version control system and must be available in textual representation so that changes made by the version control system can be detected and marked.

[0008] However, if source code is developed by a large number of developers, or if the version control systems are generally accessible to a large number of people, for example, because the version control systems are operated on a publicly or at least partially publicly accessible server system, there is a risk that unauthorized persons may gain access to the developed source code, thereby inadvertently revealing trade secrets. Especially in the automation sector, the source code of control programs used to manage automation systems must be protected from access by third parties.

[0009] It is therefore an object of the invention to provide an improved method for encrypting a source text for use in a version control system, an improved method for decrypting an encrypted source text and a development system for carrying out the methods.

[0010] This object is achieved by the method for encrypting a source text, the method for decrypting an encrypted source text, and the development system of the independent claims. Preferred embodiments are specified in the dependent claims.

[0011] According to one aspect of the invention, there is provided a method for encrypting a source text for use in a version control system, comprising: providing the source text in an unencrypted and textual form in a providing step;

[0012] Performing an encryption of the source code and generating an encrypted source code version in one encryption step; and

[0013] Performing a textualization of the encrypted source code version and generating a textualized representation of the encrypted source code version in a textualization step.

[0014] This can achieve the technical advantage of providing an improved method for encrypting source code for use in a version control system.

[0015] To do this, the developed source code is first encrypted, and an encrypted source code version is generated. The encrypted source code version can be encrypted using state-of-the-art encryption methods.

[0016] Subsequently, a textualized representation of the encrypted source code version is generated. For this purpose, the encrypted source code version is textualized. This can be achieved, for example, using textualization methods known from the state of the art.

[0017] The textualized representation of the encrypted source code version allows the encrypted source code version to be managed in the form of the textualized representation in a version control system.

[0018] State-of-the-art version control systems are designed to manage development processes during source code development. State-of-the-art version control systems are designed in such a way that, in addition to management, they can also register and, if necessary, display changes made between different versions of the developed source code. For this to happen, however, the source code uploaded to the version control system must be in a textualized format. State-of-the-art version control systems are only capable of working with textualized files and, due to the textualized format of the source code files, can register and, if necessary, display changes made between different versions of the uploaded source code.

[0019] By textualizing the encrypted source code version, the source code version can be managed in encrypted form by a state-of-the-art version control system. Changes in the various versions of the developed source code can be registered and displayed by the version control system thanks to the textual representation.

[0020] The prior encryption of the source code prevents unauthorized persons from gaining access to the developed source code during management of the developed source code versions, thereby potentially revealing trade secrets. According to the invention, the encryption of the source code is designed in such a way that different versions of the developed source code result in different encrypted source code versions.

[0021] The differences between the various source code versions can thus be viewed in the different encrypted source code versions. Textualization allows the version control system to register the different encrypted source code versions and, if applicable, the respective differences in the encrypted source code versions, without revealing the actual generated source code.

[0022] The version control system can therefore only register different encrypted source code versions in the form of different encryptions and, if necessary, display the different locations within the source code. However, due to the encryption, the actual source code is never exposed in the version control system.

[0023] This enables increased data security and prevents the unintentional disclosure of the generated source code. At the same time, the textualized representation of the encrypted source code versions ensures the management of the various source code versions during the development process in dedicated, state-of-the-art control systems. This can simplify and accelerate the development process.

[0024] In the context of automation applications, it may be necessary to protect programmed source code, especially for control programs for automation systems, from unauthorized access.

[0025] This may be relevant, for example, in the following potential use case. Source code, for example, for a control program for an automation system, is developed by a developer of one company, e.g., using a version control system, and stored on a control system of another company so that the developer can access the programmed source code at a later time, for example, for debugging.

[0026] The company that owns the source code may be motivated to protect the source code, which may contain a trade secret, from being viewed by unauthorized persons, for example by employees of another company that is a competitor to the first company.

[0027] The method according to the invention allows the owner company to protect the created source code and the trade secrets it contains by encrypting the source code. The encryption is performed in such a way that the encrypted source code can be managed in version control systems known from the state of the art, or that debugging processes can be executed based on the encrypted source code to verify the functionality of the source code.

[0028] In a further application of the method according to the invention, a developer of a company stores source code created, for example using a version control system, on a system, for example a server, of the company.

[0029] The method according to the invention can prevent access to the developed source code by another developer from another company. However, another developer from the other company should have access to at least a specific part of the source code, but possibly not to other parts of the source code, for example, because this part discloses trade secrets.

[0030] The method according to the invention allows individual parts of a source code to be encrypted so that individual persons can be granted partial access to the source code, while other parts of the source code can continue to be kept inaccessible.

[0031] After execution, the encryption and / or textualization is performed line by line, whereby a line order of the unencrypted source text is retained in the encrypted source text version and / or in the textualized representation of the encrypted source text version.

[0032] This can achieve the technical advantage that the line structure of the original source code is retained through line-by-line encryption and line-by-line textualization of the encrypted lines of the encrypted source code version. By maintaining the line structure, the version control system can display individual lines that have been changed between different source code versions based on the textualized representation of the encrypted source code version. This can further improve the development process because the line-by-line registration and display of the changes made between different source code versions makes the changes made between the different source code versions immediately apparent. The line order describes the arrangement of the individual lines within the source code, within the encrypted source code version orwithin the textualized representation of the encrypted source code version.

[0033] This means that an nth line within the unencrypted source code leads to an nth encrypted line within the encrypted source code version and to an nth textualized line representation of the nth encrypted line within the textualized representation. An encrypted line within the encrypted source code version with a specific line number thus corresponds to an encryption of the line within the unencrypted source code with the same line number. The same applies to the respective line within the textualized representation, which, with the same line number, is also based on the corresponding encrypted line of the encrypted source code version.

[0034] According to one embodiment, the method further comprises:

[0035] Performing a line separation of the source code and generating separated lines of the source code in a line separation step; wherein the encryption step is performed on the separated lines of the source code and comprises, for each separated line:

[0036] Performing a line encryption and generating an encrypted line of the encrypted source code version in a line encryption step.

[0037] This provides the technical advantage of uniquely encrypting each line of the unencrypted source code. By separating the individual lines of the unencrypted source code and generating a plurality of separated lines, applying the encryption line by line to the individual separated lines of the unencrypted source code and generating corresponding encrypted lines of the encrypted source code version line by line enables the creation of a plurality of individually encrypted lines. The encrypted source code version describes the majority of the encrypted lines generated in this way.

[0038] By separating the individual lines of the unencrypted source text, the line order of the unencrypted source text can be maintained. For example, the individual separated lines can be assigned corresponding line numbers that reflect the respective line numbers within the unencrypted source text. Alternatively, the correspondingly separated lines can be arranged in an order corresponding to the line order of the unencrypted source text in order to maintain the line order during the encryption process. The encrypted lines can also be assigned a corresponding line number or, after encryption, arranged in the corresponding order of the separated lines of the unencrypted source text. This, in turn, allows the line order within the majority of encrypted lines to be maintained.

[0039] After execution, the textualization step is performed on the encrypted lines of the encrypted source code version and comprises, for each encrypted line: performing a textualization of the encrypted line of the encrypted source code version and generating a textualized line representation of the encrypted line of the encrypted source code version in a line textualization step.

[0040] This provides the technical advantage of enabling a unique line-by-line textualization of the majority of encrypted lines of the encrypted source code version. The textualization is applied individually to each of the encrypted lines of the encrypted source code version. The respective line order, in the form of the line number of the individual encrypted lines or the respective arrangement of the plurality of encrypted lines, can also be maintained by applying the textualization line-by-line to the various encrypted lines.

[0041] The corresponding textualized line representations, which are each textualized representations of individual encrypted lines, can also be provided with corresponding line numbers or arranged according to the corresponding arrangement of the encrypted lines.

[0042] According to one embodiment, the textualization step further comprises: merging the plurality of textualized line representations of the encrypted lines of the encrypted source code version and generating the textual representation of the encrypted source code version as an entirety of the textualized line representation in a line merging step. This makes it possible to achieve the technical advantage of providing a coherent textualized representation of the encrypted source code version. For this purpose, the plurality of updated line representations previously generated by line-by-line textualization of the plurality of encrypted lines are combined into a corresponding textualized representation of the encrypted source code version via a merge.

[0043] The textualized representation of the encrypted source code version describes the corresponding summary of the plurality of textualized line representations, whereby the respective line order of the original unencrypted source code is retained in the summary or merging of the plurality of textualized line representations.

[0044] For this purpose, the nth textualized line representation, which is based on the nth encrypted line and thus on the nth line of the unencrypted source code, is placed at the nth position within the textualized representation of the encrypted source code version. The textualized representation of the encrypted source code version generated in this way corresponds to a textualized representation of the original source code, in which the respective line structure or line order of the original source code is retained, and in which each textualized line representation is a textualized representation of an encrypted line based on the respective original line of the unencrypted source code.

[0045] The textualized representation of the encrypted source code version thus appears to the version control system like a normal source code, consisting of n lines, each containing text elements. Despite the textualized representation, however, the content of the source code is encrypted and therefore cannot be read by unauthorized persons without executing the respective key.

[0046] According to one embodiment, the encryption is designed as a decryptable encryption, whereby by applying a corresponding key to the encrypted source code version, the encrypted source code version can be clearly traced back to the unencrypted source code version.

[0047] This can achieve the technical advantage that the encrypted source code version can be traced back to the original source code by performing a corresponding decryption, so that, for example, when downloading the textualized representation of the encrypted source code version from the version control system, the original source code can be restored by corresponding decryption, so that a corresponding user or developer can continue the development process based on the respective source code.

[0048] The primary purpose of encrypting the original source code is to protect it from unauthorized access when managed within the version control system. However, by decrypting the source code, authorized persons in possession of the key can restore it, allowing further editing of the original source code.

[0049] After one execution, the encryption is designed as a symmetric encryption.

[0050] This allows the technical advantage to be achieved that symmetric encryption can provide the simplest possible encryption.

[0051] After one execution, the encryption is designed as an asymmetric encryption.

[0052] This can achieve the technical advantage that asymmetric encryption can provide the most secure possible encryption of the source code.

[0053] According to one embodiment, the textualization is designed as a uniquely reversible textualization, whereby by reversing the textualization in the form of a detextualization, the textualized representation of the encrypted source text version can be uniquely converted into the encrypted source text version.

[0054] This allows for the technical advantage that, through reversible textualization, the textualization of the textualized representation of the encrypted source code version can be reversed, and the encrypted source code version can be restored from the textualized representation of the encrypted source code version. This also enables the decryption of the encrypted source code version by executing the corresponding key. To restore the original source code from the textualized representation of the encrypted source code version, the textualization of the textualized representation of the encrypted source code version is first reversed, and the encrypted source code version is restored from the textualized representation of the encrypted source code version.

[0055] Subsequently, the corresponding key is applied to the encrypted source code version, and the original source code is generated by decrypting the encrypted source code version. Since both the textualization and the encryption are uniquely reversible, the original source code can be uniquely restored using the decryption procedure described.

[0056] On the one hand, this enables secure management of source code within a version control system. On the other hand, the original source code, managed by the described decryption in the form of a textualized representation of the encrypted source code version in the version control system, can be restored for further processing if necessary.

[0057] According to one embodiment, the encryption is a unique encryption which leads to identical encrypted lines for lines of the source text with the same content and to different encrypted lines for lines of the source text with different content, and / or wherein the textualization is a unique textualization which leads to identical textual line representations for encrypted lines with the same encryption and to different textual line representations of the encrypted lines for encrypted lines with different encryption.

[0058] This allows for the technical advantage of unique encryption or unique textualization, where different lines of the original source code with the same content lead to identical encrypted lines of the encrypted source code version or identical textualized line representations, while lines of the original source code with different content lead to different encrypted lines and different textualized line representations. This allows for unambiguous decryption of the textualized representation of the encrypted source code version and unambiguous restoration of the original source code. This enables smooth further processing of the various source codes managed in the version control system as textualized representations of the encrypted source code versions.

[0059] After execution, the encryption is implemented as a binary encryption.

[0060] This provides the technical advantage of providing technically simple and secure encryption.

[0061] After execution, the encrypted source code version is textualized using the base64 textualization algorithm.

[0062] This provides the technical advantage of enabling a clear and precise textualization of the encrypted source code version.

[0063] After execution, the source code defines a control program for an automation system.

[0064] This makes it possible to achieve the technical advantage that the method according to the invention enables secure management of control programs in version control systems, in which viewing of the source code of the control programs by unauthorized persons and possibly unintentional disclosure of trade secrets contained in the control programs can be avoided.

[0065] According to a further aspect of the invention, a method for decrypting a source text encrypted according to the method for encrypting a source text according to one of the preceding embodiments is provided, comprising: performing a line separation of the textualized representation of the encrypted source text version and generating separated textualized line representations of the encrypted lines of the encrypted source text version in a further line separation step;

[0066] performing an entextualization of each textualized line representation of the encrypted lines of the encrypted source code version in an entextualization step;

[0067] Performing a decryption of the encrypted lines of the encrypted source code version and generating unencrypted lines of the source code in a decryption step; and merging the unencrypted lines of the source code and generating a visible representation of the source code in a further line merging step.

[0068] This makes it possible to achieve the technical advantage of providing an improved method for decrypting source texts encrypted according to the method for encrypting source texts according to one of the preceding embodiments. Decryption enables further processing of the encrypted source texts, for example, by a developer to further develop the source text. Due to the uniqueness of the encryption / decryption, the original unencrypted source text can be restored.

[0069] According to a further aspect of the invention, a development system for developing and / or editing a source text is provided, wherein the development system is configured to carry out the method for encrypting a source text for use in a version control system according to one of the preceding embodiments and / or the method for decrypting a source text.

[0070] This makes it possible to achieve the technical advantage that an improved development system can be provided which is configured to carry out the methods according to the invention for encrypting and / or decrypting source texts with the stated technical advantages.

[0071] The invention is explained in more detail with reference to the accompanying figures. Herein:

[0072] Fig. 1 is a graphical representation of a method for encrypting source code for use in a version control system according to one embodiment;

[0073] Fig. 2 is a graphical representation of a method for decrypting a source text according to one embodiment;

[0074] Fig. 3 is a flowchart of the method for encrypting a source text for use in a version control system according to one embodiment; Fig. 4 is another flowchart of the method for encrypting a source text for use in a version control system according to another embodiment; and

[0075] Fig. 5 is a flowchart of a method for decrypting a source text according to an embodiment.

[0076] Fig. 1 shows a graphical representation of a method 100 for encrypting a source text 301 for use in a version control system 315 according to one embodiment.

[0077] The graphical representation of Fig. 1 describes individual steps of the inventive method described in Fig. 3 for encrypting a source text 301 in a version control system 315.

[0078] Fig. 1 shows a development system 300 for developing source code 301 and a version control system 315 for storing and managing different versions of the developed source code 301. The development system 300 as well as the version control system 315 can be designed as development systems 300 or version control systems 315 known from the prior art.

[0079] In particular, the development system and the version control system can be identical and located on the same computing unit.

[0080] A development system 300, as defined in the application, is a development environment for developing source code. Such a development system 300 can, for example, be provided by an IDE (intelligent development engine).

[0081] A development system 300, such as those used in automation technology, provides a developer of automation software with various functions for programming such software. For text-based programming languages ​​from DIN 61131, these include, for example, auto-completion of frequently used programming expressions or similar functions. For graphical programming languages ​​from DIN 61131, the development system provides a graphical representation of this programming. A development system can thus be used by developers of software products to develop control programs for machines, automation systems, and other technical systems.

[0082] Developers can use a variety of programming languages ​​for this purpose. In the automation sector, programming languages ​​from DIN 61131 are primarily used. These can also include graphical programming languages.

[0083] Development systems can also be used by developers to observe and understand the behavior of programmed control programs during execution, for example, to analyze errors or optimize behavior. This is achieved in debugging processes.

[0084] Development systems can also be used by technicians to commission a system, such as an automation system. This can include transferring a control program to a corresponding controller, such as a PLC (programmable logic controller), and setting system parameters or observing system behavior as described above in order to rule out or detect installation errors.

[0085] Development systems can also be used by operators of a technical system, for example an automation system, to control the system, operate it manually, override behavior or set simple parameters.

[0086] In automation, a control program is usually written in one or more of the languages ​​of the IEC 61131-3 standard.

[0087] The standard covers five languages: "structured text," "instruction list," "sequential function chart," "ladder diagram," and "function block diagram." "Structured text" and "instruction list" are textual languages. "Ladder diagram" and "function block diagram" are graphical languages. "Ladder diagram" encompasses both textual and graphical aspects.

[0088] Entering source code during programming can be supported by auto-completion mechanisms within the development system used. For example, auto-completion can complete the input of a keyword, correct it, and / or insert another related keyword. Input can also be facilitated by displaying information. For example, expected parameters of a function call can be displayed.

[0089] If program code is detected as faulty (during input), the corresponding location within the source code can be marked and an optional explanation can be displayed, which can facilitate immediate error correction.

[0090] A version control system 315 may be implemented as a public version control system, for example the commercially available GitHub service, which uses the open source version control system software GIT.

[0091] Alternatively, the version control system 315 may be implemented as a private version control system running on a company-internal server architecture.

[0092] A version control system provides a management tool for the development process of software products. During the development process of a software product, for example, a control program for an automation system, newly created versions of the written source code can be stored in the version control system and managed by it. This allows the user to track the development process, and in particular its progress, during the development process, in which new versions of the source code are continuously created, by managing the versions of the source code stored in the version control system. To this end, the version control system offers the user numerous different functions. For example, the user can be provided with a line-by-line structured change log in which the changes made between the various versions of the source code are displayed line by line.This allows a comparison of different versions of a source code created at different times or by different developers.

[0093] The change log can, for example, include information about which lines were changed and how between different versions. For example, it can indicate newly added lines, deleted lines, and changed lines.

[0094] Typically, users of a version control system can store the versions of the source code as a set of files, usually in the form of text files containing program code, in a directory structure of the version control system.

[0095] The version control system then allows the user access not just to one state of this data, but to a multitude of such states. The version control system associates additional information with a state, which can include, for example, the creation date, the creator, an informal description, a unique number, and a reference to a previous state.

[0096] Version control systems are typically configured to store not a complete state, but only the most recent changes to a current version relative to a version of the source code that describes a previous state of the source code. This saves resources, as successive versions build on each other and usually differ only slightly.

[0097] Based on this information, the version control system can provide the user with the data of any version of the source code (checkout). This allows the user to consider any older versions and, if necessary, incorporate them into the development process.

[0098] The version control system can also show the user which files differ between two versions or are only available in one version.

[0099] If these are text files, the version control system can also show which lines are different or only exist in one version (diff).

[0100] The version control system can also show the user, for each line of a text file, in which (previous) version this line was last modified or inserted. For example, the date, author, and part of the description can be displayed next to each line (blame).

[0101] The version control system can also merge independently created versions, for example, those developed by different developers. The version control system can also revert changes between two consecutive versions, even partially.

[0102] The version control system can also reorganize and modify version sequences as change sequences (re-base).

[0103] The version control system can also apply changes as a difference between two versions of the source code to another version of the source code (cherry-pick).

[0104] To perform the encryption of a source code 301, the development system 300 first provides a source code 301 with a plurality of lines 313 in a provisioning process 302. The provisioning can be provided by a development process in which the source code 301 was created by a developer within the development system 300 by executing a corresponding programming process.

[0105] Alternatively or additionally, the provisioning process 302 may include reading in an already created source code 301 by the development system 300.

[0106] In a line separation process 304, the development system 300 generates a plurality of separated lines 307 from the provided source code 301. The individual separated lines 307 correspond in content to the respective lines 313 of the provided source code 301. The separated lines 307 thus differ from the lines 313 of the original source code 301 only in that they are provided as independent lines, or as independent objects, and are not combined into an entire document in the form of the original source code 301.

[0107] The separated lines 307 can be saved as separate files.

[0108] The line separation process 304 preferably maintains the line order of lines 313 of the original source code 301. An nth line 313 thus becomes an nth separated line 307. The nth separated line 307 is thus arranged at the nth position within the entirety of the plurality of n-separated lines 307. For this purpose, the individual separated lines 307 can be assigned a corresponding line number that corresponds to the line number of the respective line 313 within the original source code 301. The character combinations within the separated lines 307 are intended to represent the source code programmed within each line.

[0109] Alternatively or additionally, the respective separated line 307 can be arranged at the n-th position within the plurality of separated lines 307, wherein the respective arrangement position of the respective separated line 307 reflects the line number of the corresponding line 313 of the original source text 301 from which the separated line 307 originated.

[0110] In an encryption process 306, the individual separated lines 307 are subsequently encrypted line by line, and corresponding encrypted lines 309 are generated. The separated lines 307 are each considered as individual encryption objects, and the corresponding encryption is applied line by line, i.e., separately, to the individual separated lines 307.

[0111] The encryption process 306 is used to encrypt the separated lines 307 using a first key 323.

[0112] Two separated lines 307 with the same content therefore result in encrypted lines 309 with the same content.

[0113] Through the line-by-line encryption in the encryption process 306 and the corresponding line-by-line generation of the encrypted lines 309, the line order of the separated lines 307, which reflects the line order of the original lines 313 of the unencrypted source text 301, is maintained. For this purpose, corresponding line numbers can be added to the encrypted lines 309, which correspond to the respective line numbers of the original lines 313 within the source text 301.

[0114] Alternatively, the corresponding encrypted lines 309 can be arranged according to the line order of the lines 313 of the original source text 301, so that the nth encrypted line 309 representing the nth line 313 of the original source text 301 is arranged at the nth position within the plurality of encrypted lines 309. The plurality of encrypted lines 309 defines the encrypted source text version 303, which represents the entirety of the encryption of the original source text 301. The encrypted lines 309 can be cached individually as individual objects.

[0115] Alternatively or additionally, the encrypted lines 309 can be cached as partial objects in the encrypted source code version 303 as a complete object.

[0116] The encryption can, for example, be implemented as a binary encryption. In the illustration shown, the corresponding encrypted lines 309 are represented as binary elements, which is intended to illustrate a corresponding binary encryption.

[0117] Examples of binary encryption are RSA encryption (Rivest-Shamir-Adleman) and AES encryption (Advanced Encrypted Standard). Both encryption methods convert data using a key into a form that allows the original data to be deduced only if the key is known. Symmetric encryption uses the same key for both encryption and decryption. Asymmetric encryption uses separate and different keys for encryption and decryption.

[0118] Both methods consider a sequence of bytes as input and return an (encrypted / decrypted) sequence of bytes, where a byte contains an integer in the interval [0..255].

[0119] Every text is interpreted as a sequence of bytes and can therefore be encrypted immediately. However, the result is a sequence of bytes that usually does not correspond to a valid line of text.

[0120] Alternatively, any other encryption can be used.

[0121] Preferably, the encryption is provided as a unique or injective encryption, in which separated lines 307 with the same content lead to encrypted lines 309 with the same encrypted representation, and separated lines 307 with different content lead to encrypted lines 309 with different encrypted representations. The encrypted representation is represented in Fig. 1 by the corresponding binary number sequence. In a textualization process 308, a textualization is subsequently performed line by line based on the encrypted lines 309, and corresponding textualized line representations 311 of the encrypted lines 309 are generated.

[0122] The textualization is preferably a unique or injective textualization, in which encrypted lines 309 with different encrypted representations lead to different textual line representations 311, while encrypted lines 309 with the same encrypted representation lead to the same textualized line representations 311.

[0123] This is illustrated by the letter combinations of the illustrated textual line representations 311. The textualized line representations 311 have identical letter combinations for encrypted lines 309, which describe identical sections of the source code.

[0124] Separated lines 307 with the same content result in the same encrypted lines 309 after encryption.

[0125] The textualized line representations 311, however, have different letter combinations for encrypted lines 309 with different encryption representations. The letter combinations of the textualized line representations 311 are intended merely to illustrate the text form of the textualized line representation 311. However, the letter combinations shown do not describe real textualized line representations 311 but are to be understood merely symbolically.

[0126] By executing the textualization process 308, the line order of the encrypted lines 309, which corresponds to the line order of the separated lines 307, which in turn corresponds to the line order of the lines 313 of the original source text 301, is maintained. For this purpose, the textualized line representations 311 can be labeled with corresponding line numbers that correspond to the respective line number of the original line 313 of the source text 301. Alternatively, the textualized line representations 311 can be arranged or stored in a corresponding order that corresponds to the line order of the original source text 301. For this purpose, the textualized line representations 311 can be temporarily stored as independent objects or files. The textualization process 308 can be effected, for example, by executing a base64 algorithm.

[0127] The Base64 algorithm is a method for encoding 8-bit binary data (e.g., executable programs, ZIP files, or images) into a string consisting only of human-readable, code-page-independent ASCII characters. In the Base64 algorithm, 24 bits of three consecutive bytes are divided into four six-bit parts. Each 6-bit part can represent 64 different values, which can be represented by 64 common textual characters (az, AZ, 0-9, +, and / ).

[0128] In a line merging process 310, the development system 300 subsequently combines the textualized line representations 311 according to the respective line order in the textualized representation 305 of the encrypted source code version 303. The textualized representation 305 of the encrypted source code version 303 describes a coherent document in text format in which the textualized line representations 311 are summarized as individual lines arranged according to the respective order.

[0129] The textualized representation 305 thus describes an encrypted representation of the original source text 301 in text format, wherein the respective content of the original source text 301 is present in encrypted form in the textualized representation 305. The individual lines of the textualized representation 305 thus represent individual lines 313 of the original source text 301, wherein the respective contents of the lines 313 are encrypted within the textual representation 305, but still exist in textual form.

[0130] The content of an nth line of source code 301 is reflected exclusively in the corresponding nth line of the textualized representation 305. Consequently, a change to the nth line of source code only results in a change to the nth line of the textualized representation 305. This is an essential condition for the encryption to be usable in version control systems.

[0131] In a storage process 312, the textual representation 305 of the encrypted source code version 303 is stored in the previously mentioned version control system 315. The version control system 315 can thus manage the textual representation 305 and, based on its textual form, read it in and compare it with other textual representations 305 of other source code versions, and register and, if necessary, display corresponding matches or changes. Due to the encryption, the actual content of the source code 301 cannot be viewed without performing a corresponding decryption, despite the textual form of the textual representation 305.

[0132] Alternatively, the textual representation can of course also be saved on a hard disk or other storage medium.

[0133] The processes described above, including the line separation process 304, encryption process 306, textualization process 308, line merging process 310 and storage process 312, can be performed for the entire source text 301 or only for individual parts of the source text 301.

[0134] In particular, the operations can only be performed for the lines of source code 301 newly created or modified in a programming operation. In extreme cases, the operation can be performed for only one newly created line.

[0135] This ensures that only newly created lines of source code are encrypted and uploaded to a version control system, for example. The entire source code does not have to be completely re-encrypted with every change.

[0136] Since, according to the invention, an encrypted line 309 of the encrypted source code version 303 corresponds exactly to an unencrypted line of the unencrypted source code 301, typical statements of a version control system, such as the scope of changes or the determination of a line origin for the encrypted lines 309 of the encrypted source code version 303, remain valid. The version control system also fully supports merging different states (merge / rebase).

[0137] Fig. 2 shows a graphical representation of a method 200 for decrypting an encrypted source text 305 according to one embodiment.

[0138] Fig. 2 graphically illustrates individual steps of the method described in Fig. 5 for decrypting an encrypted source code. Fig. 2 again shows a development system 300 and a version control system 315. These can be configured accordingly as described in Fig. 1. In Fig. 2, the textual representation 305 is shown identically to the textual representation 305 from Fig. 1. Accordingly, the textualized line representations 311 are identical to the textual line representations 311 in Fig. 1. This is merely exemplary in nature and is not intended to limit the method according to the invention.

[0139] In the version control system 315, a textual representation 305 of an encrypted source code version 303 of a corresponding source code 301, generated according to the steps described in Fig. 1, is stored.

[0140] In a loading process 314, the textual representation 305 of the encrypted source code version 303 stored and managed in the version control system 315 is loaded into the development system 300.

[0141] In a further line separation process 316, the individual lines of the textual representation 305 of the encrypted source code version 303 are separated and separated textualized line representations 311 corresponding to the description of Fig. 1 are generated.

[0142] As already described for Fig. 1, the row separation maintains the row order of the individual rows within the textual representation 305 within the textualized row representations 311. For this purpose, the textualized row representations 311 can include corresponding row numbers that describe the respective arrangement of the respective row within the textual representation 305. Alternatively or additionally, the textualized row representations 311 can be arranged in a corresponding order that describes the row order of the textual representation 305.

[0143] In an entextualization process 318, the individual textualized line representations 311 are entextualized line by line, and corresponding encrypted lines 309 are generated. The encrypted lines 309 correspond to the encrypted lines 309 on the basis of which the textualized line representations 311 were originally generated by textualization.

[0144] The entextualization in the entextualization process 318 thus describes an inverse function to the textualization function that was originally used to generate the textualized line representations 311 based on the encrypted lines 309 of the encrypted source text version 303. The textualization is thus preferably designed as a unique injective textualization function that uniquely converts encrypted lines 309 into corresponding textualized line representations 311, wherein identical textualized line representations 311 are generated for encrypted lines 309 with the same encryption representation, while different textualized line representations 311 are generated for encrypted lines 309 with different encryption representations, and wherein the entextualization uniquely generates uniquely corresponding encrypted lines 309 from textualized line representations 311.where for textualized line representations 311 with the same textual content, encrypted lines 309 with the same encryption representation are generated, while for textualized line representations 311 with different textual content, differently encrypted lines 309 are generated.

[0145] The encryption representation describes the encrypted form of the content of each encrypted line. In the embodiment shown, the encryption representation of an encrypted line 309 is given by the binary representation shown. The binary representation describes the binary-encrypted content of the respective line 313.

[0146] Through the entextualization in the entextualization process 318, the original line order of the lines within the textualized representation 305 is preserved. For this purpose, the correspondingly generated or restored encrypted lines 309 can be provided with corresponding line numbers.

[0147] Alternatively, the arrangement of the individual encrypted lines 309 can be made according to the line order of the lines within the textual representation 305. The encrypted lines 309 can be saved or cached as individual objects or files.

[0148] Alternatively or additionally, a file of the encrypted source code version 303 can be saved or cached, which includes the entirety of the individual encrypted lines 309.

[0149] In a decryption process 320, the individual encrypted lines 309 are decrypted, and corresponding separated lines 307 are generated. The encryption is thus preferably a unique and injective encryption, which allows for a unique decryption of the encrypted lines 309. Due to the line-by-line decryption in the decryption process 320, the line order of the encrypted lines 309 is maintained, and the separated lines 307 can be arranged according to the maintained line order.

[0150] The decryption process 320 is carried out taking into account a second key 325 for decrypting the encrypted lines 309.

[0151] The first key 323 for encryption and the second key 325 for decryption can be configured as different keys, for example, as a private key and a public key. Alternatively, the same key can be used for the first and second keys 323, 325.

[0152] For this purpose, the individual separated lines 307 can be assigned corresponding line numbers or arranged according to the line order. The decrypted separated lines 307 represent the respective lines 313 of the original source code 301 in separated form. The separated lines 307 can be cached as independent objects or files.

[0153] In a further line merging process 322, the individual separated lines 307 are merged into the original source text 301. The line order is maintained such that the separated lines 307 are merged according to their line order in the source text 301.

[0154] The source text 301 restored in this way can be further processed in the development system 300 in exactly the same way as the original source text 301 that already existed before the encryption or decryption.

[0155] The encryption method shown in Fig. 1 or the decryption method shown in Fig. 2 can be executed or continued as often as desired during the development process of a source code 301, for example, for describing a control program of an automation system. Each time a new version of the source code 301 is created, for example, after completion of a development sub-process, a corresponding textual representation 305 can be generated according to the encryption method described above and loaded into a corresponding version control system 315 and managed there. For further continuation of the development process, the textual representation 305 of the previous version of the source code 301, or of any older version of the source code 301, managed in the version control system 315, can be replaced by the method shown in Fig.2 described decryption method and the source text 301 underlying the textual representation 305 can be restored.

[0156] As described above, only individual parts of a generated source text 301, for example individual sections or individual lines, can be encrypted according to the method described in Fig. 1, and corresponding textual representations 305 can be generated and managed in a version control system 315. Analogously, individual parts or individual lines can also be decrypted and restored to their original source text form using the decryption method described in Fig. 2.

[0157] This means that the version control system used does not have to manage the entire source code with every change; instead, it is sufficient to primarily manage the newly modified parts of the source code. In particular, developers can retrieve only the parts of the encrypted source code that are of interest to them from the version control system for further editing.

[0158] By encrypting the source code 301 line by line, the source code 301 or the encrypted source code version 303 can be divided into arbitrarily small parts, down to individual lines, in order to facilitate handling.

[0159] Fig. 2 further shows the case where the source text 301 restored by decryption was further developed and completed in the development system 300.

[0160] It is further shown that the completed source code 301, which represents, for example, a control program of an automation system 317, is installed on a control unit 319 of an automation system 317 in an installation process 324. For this purpose, Fig. 2 shows a corresponding automation system 317 with a control unit 319 and a plurality of sensor / actuator units 321.

[0161] In addition to control programs for automation systems 317, the methods for encrypting and decrypting source code 301 described in Figures 1 and 2 can be applied to any source code. The described methods for encryption and decryption can also be applied to any programming language. The methods according to the invention are preferably applied to programming languages ​​according to the DIN 61131 standard.

[0162] The method according to the invention can be applied in particular to source code 301 written in a graphical programming language. For this purpose, the graphical source code of the graphical programming language is stored in a text representation. The encryption method or decryption method can be applied to this text representation according to the processes described above for Figures 1 and 2.

[0163] Fig. 3 shows a flowchart of the method 100 for encrypting a source text 301 for use in a version control system 315 according to one embodiment.

[0164] In the embodiment shown, to encrypt a source code 301 for use in a version control system 315, a source code 301 is first provided in an unencrypted and textual form in a provisioning step 101. This can be accomplished, for example, by a development or programming process or by an installation or loading process of an already programmed source code 301 into a corresponding development system 300.

[0165] In an encryption step 103, the source code 301 is encrypted, and an encrypted source code version 303 is generated. The encryption can be implemented, for example, as a binary encryption, and the encrypted source code version 303 can represent the unencrypted source code 301 in a binary encryption representation. The encryption can be implemented symmetrically or asymmetrically.

[0166] In an asymmetric method, a key pair can be formed according to the encryption method, with each key being able to reverse the transformation of the other key. Thus, encryption can be performed using one key, while the other key is used for decryption.

[0167] The keys are designed in such a way that the other key cannot be derived from one of them. The two keys are usually referred to as the "public" and "private" keys. The public key is available to any communication partner who wishes to create an encrypted message. The private key, on the other hand, is private and is used to decrypt the encrypted message.

[0168] In particular, the encryption can be implemented in a unique and injective form, in which lines 313 of the source code 301 with the same content are encrypted to form the same encrypted lines 309, while lines 313 of the source code 301 with different content are encrypted to form different encrypted lines 309.

[0169] According to one embodiment, the encryption is performed line by line, in which each line 313 of the source code 301 is encrypted as a separate object, and a separate encrypted line 309 of the encrypted source code version 303 is generated accordingly. The encrypted source code version 303 describes the entirety of the individual encrypted lines 309.

[0170] In a textualization step 105, a textualization of the encrypted source code version 303 is performed, and a textualized representation 305 of the encrypted source code version 303 is generated. The textualized representation 305 describes the encrypted source code version 303 in a textual form. The content of the textual representation 305 remains the encrypted content of the encrypted source code version 303.

[0171] According to one embodiment, the textualization is carried out line by line analogously to the encryption, and each encrypted line 309 is individually converted into a textualized line representation 311 by the executed textualization.

[0172] According to one embodiment, the textualization is designed as a unique and injective function that generates identical textualized line representations 311 for encrypted lines 309 with the same encryption representation and generates different textualized line representations 311 for encrypted lines 309 with different encryption representation.

[0173] According to one embodiment, the textualization can be effected, for example, using a base64 algorithm. The line order of the original source text 301 is retained by the encryption and textualization in the textualized representation 305. The textualized line representations 311 of the textualized representation 305 of the encrypted source text version 303 are therefore arranged in the same order or sequence as the original lines 313 of the originally unencrypted source text 301.

[0174] An nth line 313 of the source code 301 thus results in a textualized line representation 311 of the textualized representation 305 of the encrypted source code version 303, which is positioned at the nth position in the textualized representation 305. The textualized representation 305 thus describes the entirety of the textualized line representations 311.

[0175] Fig. 4 shows another flowchart of the method 100 for encrypting a source text 301 for use in a version control system 315 according to another embodiment.

[0176] The embodiment in Fig. 4 is based on the embodiment in Fig. 3 and includes all method steps described there.

[0177] In contrast, in the embodiment shown, a division of the individual lines 313 of the original source code 301 is performed in a line separation step 107. This generates separated lines 307 that correspond to the respective lines 313 of the original source code 301 and are considered as individual objects.

[0178] In the embodiment shown, in encryption step 103, the encryption is performed line by line.

[0179] For this purpose, in a line encryption step 109, each separated line 307 is encrypted, and a corresponding encrypted line 309 is generated for each separated line 307. The encrypted lines 309 are in turn considered as independent objects.

[0180] In the embodiment shown, the textualization step 105 is also performed line by line. For this purpose, in a line textualization step 111, a textualization of each encrypted line 309 is performed, and a corresponding textualized line representation 311 is generated for each encrypted line 309.

[0181] In a line merging step 113, the individual textualized line representations 311 are merged and summarized in the textualized representation 305 of the encrypted source code version 303.

[0182] As already described above, the line order of the original source text 301 is preserved, so that the textualized representation 305 represents an encryption of the original source text 301 in textual form, whereby the original structure of the original source text 301 is retained.

[0183] Fig. 5 shows a flowchart of the method 200 for decrypting a source text 301 according to one embodiment.

[0184] To decrypt a source text encrypted according to the method 100 for encrypting a source text 301, a separation of the textualized line representations 311 of the textualized representation 305 of the encrypted source text version 303 is first carried out in a further line separation step 201.

[0185] In an entextualization step 203, the individually separated textualized line representations 311 are entextualized separately, and corresponding encrypted lines 309, on the basis of which the textualized line representations 311 were originally generated by line-by-line textualization, are restored.

[0186] In a decryption step 205, the individual encrypted lines 309 are decrypted line by line and the original separated lines 307, on the basis of which the encrypted lines 309 were generated by performing the line-by-line encryption, are restored.

[0187] Analogous to the encrypted textualization in method 100, the line orders of the individual representations or versions are retained during entextualization and decryption.

[0188] In a further line merging step 207, the recovered separated lines 307 are merged and combined into the recovered original source text 301. This restores the original source text 301, on the basis of which the corresponding textualized representation 305 of the encrypted source text version 303 was generated by executing the encryption method 100 according to the invention.

[0189] Due to the uniqueness of the encryption and textualization, the restored source text 301 corresponds without exception to the original source text 301.

[0190] List of reference symbols

[0191] 100 procedures

[0192] 101 Deployment Step

[0193] 103 Encryption step

[0194] 105 Textualization step

[0195] 107 Line separation step

[0196] 109 Line encryption step

[0197] 111 Line textualization step

[0198] 113 Row merge step

[0199] 200 procedures

[0200] 201 further line separation step

[0201] 203 Enttextualization step

[0202] 205 Decryption step

[0203] 207 further row merging step

[0204] 300 development system

[0205] 301 Source code

[0206] 302 Deployment process

[0207] 303 encrypted source code version

[0208] 304 Line separation operation

[0209] 305 textual representation

[0210] 306 Encryption process

[0211] 307 separated line

[0212] 308 Textualization process

[0213] 309 encrypted line

[0214] 310 Row merge operation

[0215] 311 textualized line display

[0216] 312 Save process

[0217] 313 lines

[0218] 314 Charging process

[0219] 315 Version control system

[0220] 316 further line separation process

[0221] 317 Automation system

[0222] 318 Enttextualization process

[0223] 319 Control unit 320 Decryption process

[0224] 321 Sensor / actuator unit

[0225] 322 further row merge operation

[0226] 323 first key 324 installation process

[0227] 325 second key

Claims

Claims 1 . A method (100) for encrypting a source text (301) for use in a version control system (315), comprising: Providing the source text (301) in an unencrypted and textual form in a provision step (101); Carrying out an encryption of the source text (301) and generating an encrypted source text version (303) in an encryption step (103); and carrying out a textualization of the encrypted source text version (303) and generating a textualized representation (305) of the encrypted source text version (303) in a textualization step (105).

2. Method (100) according to claim 1, wherein the encryption and / or the textualization is carried out line by line, and wherein a line order of the unencrypted source text (301) is retained in the encrypted source text version (303) and / or in the textualized representation (305) of the encrypted source text version (303).

3. The method (100) of claim 1 or 2, further comprising: Performing a line separation of the source text (301) and generating separated lines (307) of the source text (301) in a line separation step (107); wherein the encryption step (103) is performed on the separated lines (307) of the source text (301) and comprises for each separated line (307): Performing an encryption of the separated line (307) and generating an encrypted line (309) of the encrypted source code version (303) in a line encryption step (109).

4. The method (100) according to claim 3, wherein the textualization step (105) is performed on the encrypted lines (309) of the encrypted source code version (303) and comprises for each encrypted line (309): Performing a textualization of the encrypted line (309) of the encrypted source text version (303) and generating a textualized line representation (311) of the encrypted line (309) of the encrypted source text version (303) in a line textualization step (111). The method (100) of claim 4, wherein the textualization step (105) further comprises: Merging the plurality of textualized line representations (311) of the encrypted lines (309) of the encrypted source text version (303) and generating the textual representation (305) of the encrypted source text version (303) as an entirety of the textualized line representation (311) in a line merging step (113). Method (100) according to one of the preceding claims, wherein the encryption is designed as a decryptable encryption, and wherein by applying a corresponding key to the encrypted source text version (303), the encrypted source text version (303) can be unambiguously traced back to the unencrypted source text (301). Method (100) according to one of the preceding claims, wherein the encryption is designed as a symmetric encryption. Method (100) according to one of the preceding claims, wherein the encryption is designed as an asymmetric encryption.Method (100) according to one of the preceding claims, wherein the textualization is designed as a uniquely reversible textualization, and wherein by reversing the textualization in the form of an entextualization, the textualized representation (305) of the encrypted source text version (303) can be uniquely converted into the encrypted source text version (303).Method (100) according to one of the preceding claims, wherein the encryption is a unique encryption which leads to identical encrypted lines (309) for lines (313) of the source text (301) with the same content and to different encrypted lines (309) for lines (313) of the source text (301) with different content, and / or wherein the textualization is a unique textualization which leads to identical textual line representations (311) for encrypted lines (309) with the same encryption and to different textual line representations (311) of the encrypted lines (309) for encrypted lines (309) with different encryption. Method (100) according to one of the preceding claims, wherein the encryption is implemented as a binary encryption. Method (100) according to one of the preceding claims, wherein the textualization of the encrypted source text version (303) is effected by a base64 textualization algorithm. Method (100) according to one of the preceding claims, wherein the source text (301) defines a control program for an automation system. Method (200) for decrypting a source text (301) encrypted according to the method (100) for encrypting a source text (301) according to one of the preceding claims 1 to 13, comprising: Carrying out a line separation of the textualized representation (305) of the encrypted source text version (303) and generating separated textualized line representations (311) of the encrypted lines (309) of the encrypted source text version (303) in a further line separation step (201); performing an entextualization of each textualized line representation (311) of the encrypted lines (309) of the encrypted source text version (303) in an entextualization step (203); Performing a decryption of the encrypted lines (309) of the encrypted source text version (303) and generating unencrypted lines (313) of the source text (301) in a decryption step (205); and Merging the unencrypted lines (313) of the source text (301) and generating a visible representation of the source text (301) in a further line merging step (207). A development system (300) for developing and / or editing a source text (301), wherein the development system (300) is configured to execute the method (100) for encrypting a source text (301) for use in a version control system (315) according to one of the preceding claims 1 to 13 and / or the method (200) for decrypting a source text (301) according to claim 14.