Signing Command Line for Arduino Create Agent

I am trying to create a signature for the Arduino Create agent, but I keep getting an invalid signature returned.

Does anything look off in this JSON package, or with my command line?

curl -X POST -H "Content-Type: application/json" -d '{
    "board": "arduino:avr:uno",
    "port": "/dev/cu.usbserial-14610",
    "filename": "sketch_1742567898027.hex",
    "hex": "f0VMRgEBAQAAAAAAAAAAAAIAUwABAAAAAAAAADQAAAC4dQAABQAAADQAIAADACgAEQAOAAEAAACUAAAAAAAAAAAAAAB2DAAAdgwA...",
    "network": false,
    "commandline": "\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" -v -patmega328p -carduino -P/dev/cu.usbserial-14610 -b115200 -D \"-Uflash:w:sketch_1742567898027.hex:i\"",
    "signature": "317f7c638330c1e89560f0f3f3f696911e049ba8108bacc131d8e0bbe31087b89d6b154cac7acc7e9cf558658c539d41c76b3760494cb5a36c1fcfd13507ce412edd32ec0c39f409bd9a72078f12aa3516fb2e18d962e49f3b7abd0734fcb6a0503df7ec7c25641baf70c2d839224e3922ad1a81bd8e736a57541515797f19615f4864a2d7997a6683e7c5a8394c0077be6b4a86be54165356316340b22139f00093fcb86855bac887c8de321f216a59c044f16d666f92b3c0a1ac7fd23694c5dd8b4f013012421c32d3e470faa887e29551f509d6120807888097f26695a6566f2e0cfadda5299353bc480e1853cad32e4257f2cbd7231aff864e7fb5399dcd",
    "extra": {
        "auth": {
            "username": null,
            "password": null,
            "private_key": null,
            "port": null
        },
        "use_1200bps_touch": true,
        "wait_for_upload_port": true
    },
    "extrafiles": []
}' http://127.0.0.1:8991/upload

This is my cofig.ini file:

gc = std  # Type of garbage collection. std = Normal garbage collection allowing system to decide (this has been known to cause a stop the world in the middle of a CNC job which can cause lost responses from the CNC controller and thus stalled jobs. use max instead to solve.), off = let memory grow unbounded (you have to send in the gc command manually to garbage collect or you will run out of RAM eventually), max = Force garbage collection on each recv or send on a serial port (this minimizes stop the world events and thus lost serial responses, but increases CPU usage)
hostname = unknown-hostname  # Override the hostname we get from the OS
regex = usb|acm|com  # Regular expression to filter serial port list
v = true  # show debug logging
appName = CreateAgent/Stable
updateUrl = https://downloads.arduino.cc/
origins=https://local.arduino.cc:8000,http://localhost:8000,https://localhost:8000,http://127.0.0.1:8000,https://127.0.0.1:8000
# origins=https://local.arduino.cc:8000 http://localhost:8000 https://localhost:8000 http://127.0.0.1:8000,https://127.0.0.1:8000
#httpProxy = http://your.proxy:port # Proxy server for HTTP requests
crashreport = false # enable crashreport logging
signatureKey = "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAm4Ar5NT+yIIDwCtSaDMY\nnV/AlqFtZAiVXqX7M8Bv8BVpd1W83Y4AzTwfmhyTi+fbTe2sqUSXD+GSZMmV/2+H\n6BTIIFhN8n44FxIkeEGvl3ckWd00NwQluZnK4JTzedAyb+3VDvWN2t09pNuvQU8u\nbQD14mk6yKuiciDyYtFOLTTOosrDeWCG9Yb1OCuFqwG5OgiMZVe366Iq0Tslsq9F\nZVbcNc5xyNpecXPCFejJe4nymTuSb8+sjiqPaKdVkIJovQClo0QMWnFklU3WeUg+\nRNIwLueBXuZ8Zp9+N5chIala2XL1eVGB8jDSv4fSLrcv5xY7aXjFQIksjMXxFxkD\n0wIDAQAB\n-----END PUBLIC KEY-----\n"

I was looking at this config.ini example I found online (it's pretty old, maybe not correct anymore?) :

I referred to this post for the creating the keys:

And this post for adding the public key to the Arduino Create Agent config file:

I've been referencing this to understand how the signature will be verified by the create agent:

And many other posts as I try to figure this out :slight_smile:

If any one has some insight, it would be much appreciated!

Hi @programming_electronics_academy ,

you might consider to correct the thread topic:

  • Singing Command Line for Arduino Create Agent

I think it should read

  • Signing Command Line for Arduino Create Agent

as it seems not to be a musical challenge... :wink:

Oops, just done... :wink:

Ha! Thanks for updating that :slight_smile: !

Hi @programming_electronics_academy,

I’ve identified the issue and have prepared a PR to fix it.

If possible, could you download and test the release candidate available here? Arduino Create Agent 1.7.0-rc5

You could follow the steps in the PR description to test it.

Let me know how it goes. Thanks!

Best,

Davide

Thank you so much @dido_neri !

I have downloaded and tested the Arduino Create Agent 1.7.0-rc5 and tested per the PR and it is working with a status code: 202.

Thanks a ton for this help!

The agent 1.7.0 has been released with the fix.
We have also updated the wiki page with instructions on generating and using a custom public/private key.

This is great - thank you so much! That addition to the wiki is very helpful.