Featuer: added MAVLink 2.0 message signing and authentication support to provide secure communication between GCS and flight controller.
Summary
This PR adds MAVLink 2.0 message signing and authentication support to provide secure communication between the ground control station and flight controller.
Motivation
MAVLink signing is essential for:
- Security: Protect against unauthorized parameter changes and message injection
- Compliance: Required for commercial drone operations in many jurisdictions
- Safety: Prevent malicious actors from taking control of vehicles
Changes
New Files
-
ardupilot_methodic_configurator/backend_signing_keystore.py(450 lines)- Secure key storage using OS keyring with encrypted file fallback
- Key generation, storage, retrieval, deletion
- Password-protected import/export
-
ardupilot_methodic_configurator/data_model_signing_config.py(150 lines)- Configuration data model with validation
- Serialization/deserialization
-
tests/test_signing_keystore.py(15 test cases) -
tests/test_signing_config.py(15 test cases) -
docs/mavlink_signing/(complete documentation) -
install_signing_dependencies.sh- Installation script
Modified Files
-
ardupilot_methodic_configurator/backend_flightcontroller.py- Added
setup_signing()method - Added
_send_setup_signing_command()method - Added
_unsigned_callback()method - Added
get_signing_status()method
- Added
-
pyproject.toml- Added
cryptography>=41.0.0dependency - Added
keyring>=24.0.0dependency
- Added
Features
Security
- ✅ HMAC-SHA-256 message signing (authentication, not encryption)
- ✅ OS keyring integration (Windows/macOS/Linux)
- ✅ AES-256 encrypted file fallback
- ✅ Cryptographically secure key generation
- ✅ Password-protected key export/import
- ✅ Per-vehicle key isolation
- ✅ Timestamp-based replay protection
Key Management
- ✅ Generate cryptographically secure 32-byte keys
- ✅ Store keys securely per vehicle
- ✅ Retrieve keys for signing setup
- ✅ Delete keys when no longer needed
- ✅ List all vehicles with configured keys
- ✅ Export/import keys with password protection
Thanks, thiswill take a while to review. Have you tested this in multiple vehicles?
Yes, I’ve tested it with multiple vehicle entries using the test_multiple_vehicles and test_list_vehicles_with_keys unit tests. These tests cover storing, retrieving, and managing keys for different vehicle IDs to ensure proper isolation and persistence between them.
Hi @amilcarlucas, just wanted to check in if you’ve had a chance to review this PR. Please let me know if there’s anything I should update or clarify further.
Thanks for working on this
- It needs to be tested on real hardware. Real multiple flight controllers.
- The two git commits on this branch should be squashed and the commit message should start with "feat(mavlink signing):"
- The tests should follow BDD practices as defined in the
pytest_testing_instructions.mdfile. - The two new SW dependencies must be added to LICENSES.md and CREDITS.md
- The CI tests bellow need to all pass (ruff, mypy, pyright, pylint pytest, ... etc)
- Please do not work on Phase 2 until this PR is merged.
Okay @amilcarlucas, Thank you for your feedback on this PR. While Phase 2 is on hold until this PR is merged, I wanted to check if there are any other features or tasks I could work on in this repo. Additionally, if there are other repositories in the organization where I could contribute
Currently my priority is "refactoring for testability". I want to add more tests to the code, and in some parts of the code that is only possible by refactoring it first before the tests can be added. Doing it like this leads to better code and better tests. But there is no need to duplicate the efforts on that.
You could work on adding a new plugin, similar to the "motor test" plugin that does RC receiver calibration. Take a look at ARCHITECTURE_motor_test.md for inspiration. It should mimic the RC receiver calibration screen from mission planner. If you work on that we will not duplicate efforts.
Do try to finish this one first, so that you can learn more on the workflow of the project. Are you developing on Linux, or Windows?
@PritamP20 any progress on this? We now have automated SITL tests that can be used to test this feature realistically. An ArduCopter SITL instance runs in CI and your tests can communicate with it
yup working on it @amilcarlucas I will update the pr soon