Sign and Verify RPI PICO UF2 Firmware BinariesΒΆ

picosign is a Python boot tool for signing and verifying Raspberry Pi Pico UF2 firmware binaries.

Developed in python code.

The README is used to introduce the tool and provide instructions on how to install the tool, any machine dependencies it may have and any other information that should be provided before the tool is installed.

picosign python checker picosign python package picosign interface checker picosign isp checker picosign srp checker github issues documentation status github contributors

πŸš€ InstallationΒΆ

picosign python3 build

Navigate to release page download and extract release archive.

To install picosign type the following

tar xvzf picosign-x.y.z.tar.gz
cd picosign-x.y.z/
# python3
wget https://bootstrap.pypa.io/get-pip.py
python3 get-pip.py
python3 -m pip install --upgrade setuptools
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade build
pip3 install -r requirements.txt
python3 -m build --no-isolation --wheel
pip3 install ./dist/picosign-*-py3-none-any.whl
rm -f get-pip.py

You can use pip to install directly:

# python3
pip3 install picosign

πŸ“¦ DependenciesΒΆ

picosign requires next modules and libraries:

πŸ“ Tool structureΒΆ

picosign is based on OOP and Hexagonal Architecture (Ports & Adapters).

Tool structure:

picosign/
     β”œβ”€β”€ core/
     β”‚Β Β  β”œβ”€β”€ __init__.py
     β”‚Β Β  β”œβ”€β”€ model/
     β”‚Β Β  β”‚Β Β  β”œβ”€β”€ __init__.py
     β”‚Β Β  β”‚Β Β  └── signature_data.py
     β”‚Β Β  └── service/
     β”‚Β Β      β”œβ”€β”€ engine.py
     β”‚Β Β      β”œβ”€β”€ __init__.py
     β”‚Β Β      β”œβ”€β”€ iservice.py
     β”‚Β Β      └── isubprocessor.py
     β”œβ”€β”€ engine.py
     β”œβ”€β”€ infrastructure/
     β”‚Β Β  β”œβ”€β”€ cli/
     β”‚Β Β  β”‚Β Β  β”œβ”€β”€ engine.py
     β”‚Β Β  β”‚Β Β  β”œβ”€β”€ icli.py
     β”‚Β Β  β”‚Β Β  β”œβ”€β”€ __init__.py
     β”‚Β Β  β”‚Β Β  └── setup/
     β”‚Β Β  β”‚Β Β      β”œβ”€β”€ bundle.py
     β”‚Β Β  β”‚Β Β      β”œβ”€β”€ dep_validator.py
     β”‚Β Β  β”‚Β Β      β”œβ”€β”€ dependencies.py
     β”‚Β Β  β”‚Β Β      β”œβ”€β”€ factory.py
     β”‚Β Β  β”‚Β Β      β”œβ”€β”€ __init__.py
     β”‚Β Β  β”‚Β Β      β”œβ”€β”€ keys.py
     β”‚Β Β  β”‚Β Β      β”œβ”€β”€ opt_validator.py
     β”‚Β Β  β”‚Β Β      β”œβ”€β”€ options.py
     β”‚Β Β  β”‚Β Β      β”œβ”€β”€ registry.py
     β”‚Β Β  β”‚Β Β      └── validator.py
     β”‚Β Β  β”œβ”€β”€ command/
     β”‚Β Β  β”‚Β Β  β”œβ”€β”€ command.py
     β”‚Β Β  β”‚Β Β  β”œβ”€β”€ icommand_definition.py
     β”‚Β Β  β”‚Β Β  β”œβ”€β”€ icommand_executor.py
     β”‚Β Β  β”‚Β Β  β”œβ”€β”€ __init__.py
     β”‚Β Β  β”‚Β Β  β”œβ”€β”€ read_command_definition.py
     β”‚Β Β  β”‚Β Β  β”œβ”€β”€ read_command_executor.py
     β”‚Β Β  β”‚Β Β  β”œβ”€β”€ sign_command_definition.py
     β”‚Β Β  β”‚Β Β  └── sign_command_executor.py
     β”‚Β Β  β”œβ”€β”€ config/
     β”‚Β Β  β”‚Β Β  β”œβ”€β”€ picosign.cfg
     β”‚Β Β  β”‚Β Β  └── picosign.logo
     β”‚Β Β  β”œβ”€β”€ __init__.py
     β”‚Β Β  └── subprocessor.py
     β”œβ”€β”€ __init__.py
     β”œβ”€β”€ py.typed
     └── setup/
         β”œβ”€β”€ bundle.py
         β”œβ”€β”€ dep_validator.py
         β”œβ”€β”€ dependencies.py
         β”œβ”€β”€ factory.py
         β”œβ”€β”€ __init__.py
         β”œβ”€β”€ keys.py
         β”œβ”€β”€ opt_validator.py
         β”œβ”€β”€ options.py
         β”œβ”€β”€ registry.py
         └── validator.py

 10 directories, 45 files

✨ Features¢

  • Adds and reads textual signatures from 220-byte padding in the first 512-byte block of UF2 binaries.

  • Validates UF2 block boundaries and magic header constants.

  • Provides a modular and extensible architecture based on OOP and SOLID principles.

  • Includes command line interface (CLI) support via a command/executor structure.

  • Robust validation of project bundles, dependencies, and options.

  • High code quality with full type checking and 100% unit test coverage.

πŸ“Š Code coverageΒΆ

Code coverageΒΆ

Name

Stmts

Miss

Cover

picosign/__init__.py

9

0

100%

picosign/core/__init__.py

9

0

100%

picosign/core/model/__init__.py

9

0

100%

picosign/core/model/signature_data.py

15

0

100%

picosign/core/service/__init__.py

9

0

100%

picosign/core/service/engine.py

29

0

100%

picosign/core/service/iservice.py

14

0

100%

picosign/core/service/isubprocessor.py

14

0

100%

picosign/engine.py

57

0

100%

picosign/infrastructure/__init__.py

9

0

100%

picosign/infrastructure/cli/__init__.py

9

0

100%

picosign/infrastructure/cli/engine.py

43

0

100%

picosign/infrastructure/cli/icli.py

15

0

100%

picosign/infrastructure/cli/setup/__init__.py

9

0

100%

picosign/infrastructure/cli/setup/bundle.py

22

0

100%

picosign/infrastructure/cli/setup/dep_validator.py

36

0

100%

picosign/infrastructure/cli/setup/dependencies.py

18

0

100%

picosign/infrastructure/cli/setup/factory.py

40

0

100%

picosign/infrastructure/cli/setup/keys.py

26

0

100%

picosign/infrastructure/cli/setup/opt_validator.py

34

0

100%

picosign/infrastructure/cli/setup/options.py

15

0

100%

picosign/infrastructure/cli/setup/registry.py

31

0

100%

picosign/infrastructure/cli/setup/validator.py

43

0

100%

picosign/infrastructure/command/__init__.py

9

0

100%

picosign/infrastructure/command/command.py

16

0

100%

picosign/infrastructure/command/icommand_definition.py

14

0

100%

picosign/infrastructure/command/icommand_executor.py

14

0

100%

picosign/infrastructure/command/read_command_definition.py

26

0

100%

picosign/infrastructure/command/read_command_executor.py

29

0

100%

picosign/infrastructure/command/sign_command_definition.py

26

0

100%

picosign/infrastructure/command/sign_command_executor.py

29

0

100%

picosign/infrastructure/subprocessor.py

101

0

100%

picosign/setup/__init__.py

9

0

100%

picosign/setup/bundle.py

23

0

100%

picosign/setup/dep_validator.py

36

0

100%

picosign/setup/dependencies.py

19

0

100%

picosign/setup/factory.py

43

0

100%

picosign/setup/keys.py

27

0

100%

picosign/setup/opt_validator.py

34

0

100%

picosign/setup/options.py

12

0

100%

picosign/setup/registry.py

32

0

100%

picosign/setup/validator.py

48

0

100%

Total

1062

0

100%

πŸ›  UsageΒΆ

Install package

pip3 install picosign

Embed signature into a UF2 firmware binary:

python3 main.py sign --file firmware.uf2 --signature "AUTHOR: Vladimir Roncevic | VERSION: 1.0.0"

Read signature from a UF2 firmware binary:

python3 main.py read --file firmware.uf2

πŸ“š DocsΒΆ

More documentation and info at:

πŸ‘₯ ContributingΒΆ

Contributing to picosign