ArcGIS Pro ATBX Encryption
Use this skill to automate source-code encryption for embedded Script Tools in ArcGIS Pro .atbx toolboxes. The workflow is .atbx-only. Do not redirect the user to .pyt, arcpy.EncryptPYT, or GUI-by-GUI encryption unless they explicitly change scope.
Non-Negotiables
- Use ArcGIS Pro Python on Windows.
- Use ArcGIS Pro native
AfCore.dllencryption through the bundled script. - Preserve the
.atbxformat; do not convert to.pyt. - If the user provides a password in the request, use that exact password.
- If the user does not provide a password, use
--generate-password --no-password-promptso a high-entropy password is generated in memory, never printed, never stored, and not recoverable from skill outputs. - Never assume
1234except when reproducing the original research sample. - Do not remove or hand-edit
pw; ArcGIS Pro needs it to recognize encrypted script payloads. - Treat this as source protection for release packaging, not secret management.
Bundled Resources
scripts/batch_encrypt_atbx.py: batch encrypt embeddedtool.script.execute.py; optionally includetool.script.validate.py.scripts/inspect_atbx.py: inspect one.atbxor compare plain/encrypted archives.scripts/validate_atbx_runtime.py: import encrypted.atbxwith ArcPy, list tools, and optionally run a smoke test.scripts/doctor_atbx_environment.py: check ArcGIS Pro Python,arcpy,AfCore.dll, and required encryption exports.references/USAGE_PATTERNS.md: detailed command patterns for single files, folder releases, in-place backup, CI/CD, and dry-runs.references/PASSWORD_AND_SECURITY.md: password source precedence, custom password guidance, and release security boundaries.references/VALIDATION_AND_QA.md: structural checks, ArcPy runtime checks, acceptance criteria, and smoke-test examples.references/TROUBLESHOOTING.md: common failures and fixes.references/ATBX_ENCRYPTION_FINDINGS.md: observed GUI diff,pwbehavior, native entry points, and proof summary.
Load reference files only when the current task needs those details.
Standard Workflow
- Confirm inputs are
.atbxfiles or folders containing.atbxfiles. - If environment is unknown, run
scripts/doctor_atbx_environment.py. - If toolbox structure is unknown, inspect with
scripts/inspect_atbx.py. - Choose password behavior from the user's request:
- If the user says "password is xxxx" or otherwise provides a password, including equivalent Chinese wording, pass it with
--passwordor set a one-shot environment variable. - If the user provides a password file or environment variable instruction, honor it.
- If the user does not provide any password, pass
--generate-password --no-password-prompt; do not ask for a password unless the user explicitly wants to choose one.
- If the user says "password is xxxx" or otherwise provides a password, including equivalent Chinese wording, pass it with
- Encrypt with
scripts/batch_encrypt_atbx.py, normally to--output-diror default_encrypted.atbxcopies. - Validate output structurally with
scripts/inspect_atbx.py. - Validate runtime behavior with
scripts/validate_atbx_runtime.pyor direct ArcPy smoke tests. - Report encrypted output paths, password-source method, validation status, skipped tools, and any residual risk.
Quick Commands
Run the environment doctor:
& 'C:Program FilesArcGISProbinPythonenvsarcgispro-py3python.exe' `
'.scriptsdoctor_atbx_environment.py'
Encrypt a single toolbox with a custom password from an environment variable:
$env:ARC_ATBX_PASSWORD='<custom-password>'
& 'C:Program FilesArcGISProbinPythonenvsarcgispro-py3python.exe' `
'.scriptsbatch_encrypt_atbx.py' `
'E:GIS_ProjectsTest4CPPtestTools.atbx'
Encrypt with an explicit user-provided password:
& 'C:Program FilesArcGISProbinPythonenvsarcgispro-py3python.exe' `
'.scriptsbatch_encrypt_atbx.py' `
'E:GIS_ProjectsTest4CPPtestTools.atbx' `
--password '<user-provided-password>'
Encrypt without a disclosed password:
& 'C:Program FilesArcGISProbinPythonenvsarcgispro-py3python.exe' `
'.scriptsbatch_encrypt_atbx.py' `
'E:GIS_ProjectsTest4CPPtestTools.atbx' `
--generate-password `
--no-password-prompt
Batch encrypt a release folder:
$env:ARC_ATBX_PASSWORD='<custom-password>'
& 'C:Program FilesArcGISProbinPythonenvsarcgispro-py3python.exe' `
'.scriptsbatch_encrypt_atbx.py' `
--root 'E:GIS_ProjectsTest4CPPtoolboxes' `
--output-dir 'E:GIS_ProjectsTest4CPPrelease' `
--no-password-prompt
Inspect encrypted output:
& 'C:Program FilesArcGISProbinPythonenvsarcgispro-py3python.exe' `
'.scriptsinspect_atbx.py' `
'E:GIS_ProjectsTest4CPPreleasetestTools.atbx'
Validate ArcPy import and optionally run a tool:
& 'C:Program FilesArcGISProbinPythonenvsarcgispro-py3python.exe' `
'.scriptsvalidate_atbx_runtime.py' `
'E:GIS_ProjectsTest4CPPreleasetestTools.atbx' `
--alias enc `
--run-tool Script `
--params-json '[]'
Decision Rules
- If the tool links to an external
.pyand no embeddedtool.script.execute.pyexists, explain that the release pipeline must embed script code in the.atbxfirst. - If output exists, use
--overwriteonly when the user explicitly accepts replacing release outputs. - If source files must be replaced, use
--in-placewith backups unless the user explicitly disables backups. - If a toolbox already has
pw, skip by default; use--forceonly for intentional re-encryption. - If validation code must be hidden too, pass
--include-validationand validate parameter UI/runtime behavior afterward. - If ArcPy import succeeds but tool execution fails, treat it as a tool/runtime-parameter problem unless structural checks fail.
- If the report says
password_sourceisgenerated:undisclosed, do not claim that the password can be recovered. The encrypted tool can run, but source viewing/editing with a password is intentionally unavailable.
Success Criteria
- Each encrypted Script Tool has
pwintool.content. - Each encrypted execution script starts with ArcGIS-recognized encrypted text such as
00022e68. - Original Python source is no longer directly readable from the script entry.
- ArcPy can import the encrypted
.atbx. - Representative tools run with known-safe parameters.
- Unencrypted source and backups are excluded from release artifacts.




