Code signing...
Posted: Thu Sep 09, 2021 8:31 pm
The next 3.3.3 release will support code signing.
It supports signing with an RSA private key.
Once code signing is enabled the board will not load unsigned code.
(Jumper based Alt monitor recovery still works)
We made it about as simple as possible.
Once you have a Public key loaded on the system.
(I chose compiled public key in for the demo,
you could also be stored in flash, or file system))
So once you have the public key accessible (either PEM or DER format)
A single call:
RegisterAppSigningPublicKey(ptr_to_publickey_blob);
Turns on code signing.
Now if the signature is not correct or included then it gives a code authentication error and does not update.
This applies to code loaded via the webpage, serial loads from the 3.0 serial interface, or any user created function that uses streamupdate. (ftp or http post examples use streamupdate)
So how do you sign the code?
There is a new netburer utility nbsign its written in GO and source is provided.
nbsign usage is
nbsign -k <path to private key> -in <binaryapp iamge> -o <where to put the signed copy>
for the command line tool users:
set NB_SIGN_KEY to point to the private key...
IE:
NB_SIGN_KEY=c:\nburn\key\signkey.key
then you can do
make sign
and
make loadsign
Signing will not make it into this release of eclipse, but its coming.
If the private key is pass phrase protected nbsign will prompt for the pass phrase, or you can include it on the command line with a -p option.
I've looked at what it would take to do code signing under 2.9.x
and it would require a complete rewrite of the code saving stuff, not using autoupdate.
It could be done to the http file post update and the tcpupdate examples, but its not going to happen with autopdate.
It supports signing with an RSA private key.
Once code signing is enabled the board will not load unsigned code.
(Jumper based Alt monitor recovery still works)
We made it about as simple as possible.
Once you have a Public key loaded on the system.
(I chose compiled public key in for the demo,
you could also be stored in flash, or file system))
So once you have the public key accessible (either PEM or DER format)
A single call:
RegisterAppSigningPublicKey(ptr_to_publickey_blob);
Turns on code signing.
Now if the signature is not correct or included then it gives a code authentication error and does not update.
This applies to code loaded via the webpage, serial loads from the 3.0 serial interface, or any user created function that uses streamupdate. (ftp or http post examples use streamupdate)
So how do you sign the code?
There is a new netburer utility nbsign its written in GO and source is provided.
nbsign usage is
nbsign -k <path to private key> -in <binaryapp iamge> -o <where to put the signed copy>
for the command line tool users:
set NB_SIGN_KEY to point to the private key...
IE:
NB_SIGN_KEY=c:\nburn\key\signkey.key
then you can do
make sign
and
make loadsign
Signing will not make it into this release of eclipse, but its coming.
If the private key is pass phrase protected nbsign will prompt for the pass phrase, or you can include it on the command line with a -p option.
I've looked at what it would take to do code signing under 2.9.x
and it would require a complete rewrite of the code saving stuff, not using autoupdate.
It could be done to the http file post update and the tcpupdate examples, but its not going to happen with autopdate.