Problem Overview: Unlocking a KNOW_HOW_PROTECT Block Without Source Files
A common service call in the field is an integrator receiving an S7-1200 or S7-1500 program from an OEM that contains blocks protected with KNOW_HOW_PROTECT. The integrator opens the project in TIA Portal, navigates to the source folders, performs a full-text search for the string know-how protection, finds nothing, and concludes the keyword is missing. In reality, the keyword only exists in the original text source file (SCL or STL). The block delivered to the integrator is the compiled object, and the compiler strips the KNOW_HOW_PROTECT keyword from the compiled code while keeping only the protection behavior.
This article documents the correct procedure for removing know-how protection in TIA Portal V20, the reason the keyword cannot be located in compiled blocks, the differences between protection types, and the legal path forward when no source file is available. The official Siemens procedure is published in the Removing Block Know-How Protection documentation entry.
Why the KNOW_HOW_PROTECT Keyword Is Not Visible in the Source View
Two distinct artifacts exist for any user block in a TIA Portal project, and the protection keyword lives in only one of them:
| Artifact | Location in Project Tree | File Type | Contains KNOW_HOW_PROTECT? |
|---|---|---|---|
| Text source | External Sources > [block name].scl/.stl | Plain-text source file | Yes (line at top of declaration or in code body) |
| Compiled block | Program Blocks > [block name] (FB/FC/DB/OB) | Compiled S7 object | No (only the resulting protection bit) |
When a programmer authors a block, the workflow is:
- Create or open the text source in External Sources.
- Insert the
KNOW_HOW_PROTECTkeyword in SCL or the// KNOW_HOW_PROTECTpragma in STL. - Right-click the source and choose Compile to generate the compiled block in Program Blocks.
- Distribute the compiled block (or the entire project archive) to the integrator.
Step 4 is where the trap lies. The integrator receives the compiled block but not the original text source. A search of the project for the literal string know-how protection in External Sources yields nothing because the source file is missing, not because the keyword was renamed.
Block Protection Types in TIA Portal
Siemens provides three distinct protection mechanisms on blocks. Operators often conflate them; the removal procedure differs.
| Protection Type | Where Set | Effect | Removable By Integrator? |
|---|---|---|---|
| Know-how protection |
KNOW_HOW_PROTECT keyword in source |
Block interface and code are hidden in compiled form | Only by recompiling the source after deleting the keyword |
| Read/write password | Block Properties > Protection tab | Block can be opened only with the password; source visible after entry | Yes, by entering the password in the Protection tab and clearing it |
| Copy protection | Block Properties > Protection > Bind to serial number | Block will only run on a CPU with a matching serial number | Source must be rebound and recompiled |
Know-how protection is the only one of the three that genuinely hides the code; the others can be unlocked by anyone with the password. When a source file is supplied but is read-protected by password, opening the block and clearing the Know-how protection checkbox in Edit > Know-how protection is sufficient.
Diagnostic Steps: Confirming That a Block Is Know-How Protected
Before attempting removal, verify the actual protection state of the block in the project. In TIA Portal V20:
- Open the project and expand Program Blocks in the project tree.
- Select the suspect FB, FC, DB, or OB.
- Open Properties > Protection.
- Read the Know-how protection checkbox state. If checked, the block is read-protected and the interface/code cannot be viewed.
A second visual indicator is the lock icon overlaid on the block icon in the project tree. In the online view of a connected CPU, the same icon appears next to the block in the online block list.
Prerequisites for Legal Removal
To remove know-how protection legally and without data loss, the following must be available:
- The original SCL or STL text source file with the
KNOW_HOW_PROTECTkeyword in place. The keyword line must be removed before recompilation. - OR an unprotected version of the block provided directly by the original author or OEM.
- A TIA Portal installation matching or newer than the version used to compile the original block (for example, TIA Portal V20 can read sources created in V18 onward).
- Write access to the TIA Portal project and the local file system where the project is stored.
If none of these are available, no legal path exists within Siemens tooling to recover the protected code. The recommended action is to contact the OEM and request a new project archive with know-how protection removed, or to recreate the block from functional specification and I/O documentation.
Step-by-Step Removal Procedure in TIA Portal V20
The official procedure documented by Siemens is as follows. Refer to the TIA Portal V20 - Removing Block Know-How Protection page for the source-of-truth reference.
Step 1: Place the Source File in External Sources
If the source file was supplied by the OEM:
- Open the TIA Portal project.
- Expand the device folder for the S7-1200 or S7-1500 CPU.
- Right-click External Sources and choose Add new external source.
- Import the supplied
.sclor.stlfile.
If the source is missing entirely, do not proceed with the unprotect procedure. Instead, escalate to the OEM or rights holder to obtain an unprotected source.
Step 2: Generate a Block From the Source (or Open and Edit)
- Double-click the imported source to open it in the SCL or STL editor.
- Verify the first lines of the file contain a line equivalent to
{SCL_SetBlockAttributes 'KNOW_HOW_PROTECT' := '1'}in SCL, or the pragma// KNOW_HOW_PROTECTin STL. - Delete the
KNOW_HOW_PROTECTline/pragma entirely. Do not comment it out; the keyword is processed at compile time and a commented line will still be ignored, but the safest and most portable change is full removal.
Step 3: Recompile the Source
- Right-click the modified source file in External Sources.
- Choose Compile > Software (All) to regenerate the compiled block. The destination folder is Program Blocks.
- Confirm that the generated block overwrites the protected version. A prompt appears asking whether to overwrite the existing block.
Step 4: Verify the Protection State
- Right-click the new block in Program Blocks.
- Open Properties > Protection.
- Confirm that Know-how protection is unchecked.
- Open the block body and confirm that the interface and code are now visible.
Alternative Path: Removing Protection Through the Edit Menu
If the source is already attached to the block (for example, an SCL block generated directly in TIA Portal rather than from an external source), the menu-driven shortcut applies. From the Removing Block Know-How Protection reference:
- Select one or more blocks in the project tree.
- Open the Edit menu.
- Choose the Know-how protection command. The command toggles the state of all selected blocks.
If the block was opened with a read/write password, the password prompt appears first. Enter the password, then the menu command clears the protection attribute. If the password is unknown, this path is closed; the user must still obtain an unprotected source from the author.
Classic STEP 7 V5.x Procedure for S7-300/S7-400
The same logic applies to S7-300 and S7-400 systems programmed in STEP 7 V5.x. The source file lives in the S7 Program > Sources folder. The keyword in the AWL source is:
// KNOW_HOW_PROTECT
FUNCTION FC 1 : INT
// ...body...
To remove protection:
- Open the source in the LAD/FBD/STL editor.
- Delete the
// KNOW_HOW_PROTECTline. - Save and compile via File > Compile.
The compiled block in the offline block container is regenerated without the protection attribute and is downloaded to the CPU on the next download.
When Source Files Are Unavailable: The Real Resolution Path
The diagnostic question is whether the integrator can locate the KNOW_HOW_PROTECT string in the project. If the project contains only compiled blocks and no text source under External Sources (TIA Portal) or Sources (STEP 7 V5.x), the compiled binary is all that exists. Removing protection is then impossible without cooperation from the original author. The recommended communication with the OEM is:
- Request a new project archive (.zap20 for TIA Portal V20, .s7p/.zip for STEP 7 V5.x) with know-how protection removed from the affected blocks.
- Specify the block names and block numbers so the OEM can locate them in their source control.
- Confirm that the archive is delivered with the original text sources, not only compiled blocks.
If the OEM is unreachable or unwilling, the only remaining option is to rewrite the block. Functional specifications, I/O lists, and the call hierarchy visible from unprotected blocks typically provide enough information to rebuild the protected routine. Allocate engineering time for this contingency in any service contract.
Verification and Functional Checks
After recompilation, perform the following checks before downloading to the live CPU:
- Static review: Open the regenerated block and confirm the interface (input, output, in/out, static, temp) is intact and matches the version that the rest of the program expects.
- Cross-reference check: Use Project tree > right-click CPU > Cross-references to confirm that no caller block is now broken by the recompilation.
- Compile clean compile: Compile the entire program (Compile > Software (All)) and verify zero warnings and zero errors. Any signature mismatch with the rest of the program will surface here.
- Online download to test CPU: Download to a test or backup CPU and exercise the function. Know-how protection does not change runtime behavior; the unprotected block is byte-equivalent to the protected one. Only the visibility at engineering time changes.
- Production download: Only after successful test on the bench, download to the operational CPU.
Project Re-integration and Block Number Conflicts
A common follow-on issue is that the recompiled source has the same block number as the existing protected block. TIA Portal handles this by asking whether to overwrite. Accept the overwrite, then perform a full project compile to update any block call dependencies. If the recompiled source has a different block number from what the rest of the program references, the program will fault with an Unknown block error. In that case, do not overwrite; instead, regenerate the block under the correct number or update the caller block to call the new number.
Troubleshooting Matrix
| Symptom | Likely Cause | Resolution |
|---|---|---|
| Know-how protection checkbox is greyed out in Properties | Block was compiled from a source where the keyword is set; properties read-only | Edit the source file, remove the keyword, recompile |
| External Sources folder is empty in the project | OEM delivered compiled blocks only | Request text source from OEM; do not attempt to decompile |
| Password prompt appears when opening block | Read/write password was set in addition to or instead of know-how protection | Obtain password from OEM; enter and clear protection |
| Compile fails after keyword removal | Source syntax error introduced during editing | Compare against an unedited backup; restore the line and retry |
| Block overwrites but protection still active online | Old protected block still loaded on CPU | Download the new block to the CPU and restart if required |
| Cross-reference shows broken call after recompile | Block number changed during recompile | Restore the original block number in the source declaration |
Preventive Controls for Multi-Party Projects
To avoid this deadlock on future projects, apply the following controls:
- Specify in the contract that the OEM delivers a TIA Portal project archive plus a separate Sources folder containing all
.scland.stltext files. Both must be covered by the same maintenance window. - Maintain a vendor-controlled Git or SVN repository of text sources, with the OEM committing each release. Use this repository as the engineering baseline, not the compiled archive.
- Document all block numbers, names, and protection state in the project Functional Design Specification. This gives service engineers a map of what is and is not editable.
- Reserve know-how protection for blocks containing genuinely proprietary algorithms. Use read/write passwords for routine commissioning logic; know-how protection on every block makes service work impossible.
Notes on Compiler Versions and Forward Compatibility
Text sources compiled in older TIA Portal versions (V13 through V17) are compatible with V18 and later for purposes of regeneration. The block number, interface signature, and code body are preserved across compiler upgrades. If the project was originally compiled in V20 and the integrator's installation is V17 or earlier, the source cannot be recompiled because the block container format is newer than the editor supports. The resolution is to install TIA Portal V20 or later, or to ask the OEM to provide a project archive in the older version.
Safety-Critical Considerations
Know-how protection is sometimes applied to safety blocks (F-FB, F-FC, F-DB) generated by the SIMATIC Safety package. The Safety Integrated lifecycle requires that the F-block signatures match between the offline project and the online CPU. Removing protection from a safety block is allowed only if the integrator has access to the safety source and is authorized to modify safety logic. Any modification requires a fresh safety acceptance test, documented in the safety logbook per IEC 61508 and IEC 62061 workflows. Do not modify safety blocks without involving the safety engineer of record.
Why can't I find the string "know-how protection" in the project source files?
The string KNOW_HOW_PROTECT only exists in the text source (.scl or .stl) under External Sources in TIA Portal or Sources in STEP 7 V5.x. If you only have compiled blocks in Program Blocks, the string is not present anywhere in the project; the protection behavior is encoded in the compiled block header. Search the External Sources folder, not Program Blocks.
Is there any legal way to unprotect a block when only the compiled binary is available?
No. Siemens provides no unprotect utility, and reverse engineering the compiled binary violates the TIA Portal license agreement and may violate copyright law. The supported path is to request an unprotected source file from the original author or OEM.
What is the exact menu path in TIA Portal V20 to remove know-how protection?
Select the block(s) in the project tree, open the Edit menu, and choose "Know-how protection". The command toggles the protection attribute for all selected blocks. A password prompt may appear if a read/write password is also set.
Does know-how protection affect runtime behavior on the CPU?
No. Know-how protection only restricts the visibility of the block interface and code at engineering time. The compiled machine code executed by the CPU is identical between a protected and an unprotected block. Functional safety is unaffected.
What happens if I delete the KNOW_HOW_PROTECT keyword and recompile?
The recompiled block overwrites the protected block in Program Blocks. The interface and code become visible in the editor. Download the new block to the CPU to apply the change online. Cross-references to the block remain intact as long as the block number does not change.
Can a TIA Portal V17 project open a V20 source file for unprotect purposes?
No. A source compiled by TIA Portal V20 uses the V20 block container format and cannot be opened or recompiled by V17 or earlier. Install TIA Portal V20 (or the matching version used by the OEM) before attempting regeneration.