MKR wifi 1010 + ECCX08 build in

Hi Forum, I have a question about the MKR wifi 1010 and its cryptochip ECCX08 build in, do someone know how to set tls certs on that chip?.. I found how to auto create them in source code but I really want to do is load my own self signed certs to able connect to a Mosquitto MQTT TLS Broker over a local LAN.. I had tried a lot of ways with no results, on internet there's no enough information able to do that. Anyone knows how to do that?

I tried unluckly with “WiFi1010 / WiFiNINA Firmware/Certificates Updater”
WiFiNINA Firmware Updater

This is the command I wrote in console (Windows 10):

./arduino-fwuploader.exe certificates flash -b arduino:samd:mkrwifi1010 -a COM4 -f c:/certs/ca.crt -f c:/certs/client.crt -f c:/certs/client.key

This one starts and connect with MKR but switch to COM6 and throws an error due to device not found, then I change the command to COM6 and get the error because it switches to COM4..

What I'm doing wrong?

This is the powershell output I got:

PS C:\Users\user\apps\arduino-fwuploader_1.0.0_Windows_64bit> ./arduino-fwuploader.exe certificates flash -b arduino:samd:mkrwifi1010 -a COM4 -f C:\certs\ca.crt
No device found on COM4
Error during certificates flashing: exit status 1
PS C:\Users\user\apps\arduino-fwuploader_1.0.0_Windows_64bit> ./arduino-fwuploader.exe certificates flash -b arduino:samd:mkrwifi1010 -a COM6 -f C:\certs\ca.crt
Set binary mode
readWord(addr=0)=0x20007ffc
readWord(addr=0xe000ed00)=0x410cc601
readWord(addr=0x41002018)=0x10010305
version()=v2.0 [Arduino:XYZ] Mar 19 2018 09:45:14
chipId=0x10010005
Connected at 921600 baud
readWord(addr=0)=0x20007ffc
readWord(addr=0xe000ed00)=0x410cc601
readWord(addr=0x41002018)=0x10010305
Atmel SMART device 0x10010005 found
write(addr=0x20004000,size=0x34)
writeWord(addr=0x20004030,value=0x10)
writeWord(addr=0x20004020,value=0x20008000)
Device       : ATSAMD21G18A
readWord(addr=0)=0x20007ffc
readWord(addr=0xe000ed00)=0x410cc601
readWord(addr=0x41002018)=0x10010305
Chip ID      : 10010005
version()=v2.0 [Arduino:XYZ] Mar 19 2018 09:45:14
Version      : v2.0 [Arduino:XYZ] Mar 19 2018 09:45:14
Address      : 8192
Pages        : 3968
Page Size    : 64 bytes
Total Size   : 248KB
Planes       : 1
Lock Regions : 16
Locked       : readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
none
readWord(addr=0x41004018)=0
Security     : false
Boot Flash   : true
readWord(addr=0x40000834)=0x7000a
BOD          : true
readWord(addr=0x40000834)=0x7000a
BOR          : true
Arduino      : FAST_CHIP_ERASE
Arduino      : FAST_MULTI_PAGE_WRITE
Arduino      : CAN_CHECKSUM_MEMORY_BUFFER
Erase flash
chipErase(addr=0x2000)
done in 1.077 seconds

Write 13688 bytes to flash (214 pages)
write(addr=0x20005000,size=0x1000)
writeBuffer(scr_addr=0x20005000, dst_addr=0x2000, size=0x1000)
[========                      ] 29% (64/214 pages)write(addr=0x20005000,size=0x1000)
writeBuffer(scr_addr=0x20005000, dst_addr=0x3000, size=0x1000)
[=================             ] 59% (128/214 pages)write(addr=0x20005000,size=0x1000)
writeBuffer(scr_addr=0x20005000, dst_addr=0x4000, size=0x1000)
[==========================    ] 89% (192/214 pages)write(addr=0x20005000,size=0x580)
writeBuffer(scr_addr=0x20005000, dst_addr=0x5000, size=0x580)
[==============================] 100% (214/214 pages)
done in 0.223 seconds

Verify 13688 bytes of flash with checksum.
checksumBuffer(start_addr=0x2000, size=0x1000) = 828d
checksumBuffer(start_addr=0x3000, size=0x1000) = 746f
checksumBuffer(start_addr=0x4000, size=0x1000) = db2
checksumBuffer(start_addr=0x5000, size=0x578) = 1ec5
Verify successful
done in 0.079 seconds
CPU reset.
readWord(addr=0)=0x20007ffc
readWord(addr=0xe000ed00)=0x410cc601
readWord(addr=0x41002018)=0x10010305
writeWord(addr=0xe000ed0c,value=0x5fa0004)
Error during certificates flashing: Serial port not found

In order to make all relevant information available to all who are interested in this subject, I'll share my comment from your related report on GitHub:
https://github.com/arduino-libraries/WiFiNINA/issues/195#issuecomment-880890818

Thanks for taking the time to submit an issue. I saw your report on the Arduino Forum earlier and reported the issue to the Arduino Firmware Uploader developers. They have already identified the issue and submitted a pull request for a fix. I was going to wait for it to be merged before notifying you, but I'll go ahead and share it now:
arduino/arduino-fwuploader#87

I tested it out and it fixes the problem for me. If you would like, you are welcome to give it a try and let us know your results. It does require building the Arduino Firmware Uploader from source because we don't have automated test builds available. If you don't feel like building it from source, you can wait for the next release of Arduino Firmware Uploader, which will have the bug fixed.

Thanks so much for bringing this issue to our attention!

Hi @kathemica. The issue in Arduino Firmware Updater has now been resolved and a new release is available with that fix. You can download the new version here:

Please let us know if you have any problems after updating to version 1.0.1.

Thanks again for your valuable report!
Regards, Per

Hi, I try again:
command:

./arduino-fwuploader.exe certificates flash -b arduino:samd:mkrwifi1010 -a COM4 -f C:\certs\ca.crt -f C:\certs\client.crt -f C:\certs\client.key

I didn't get the port error but I got this one:

Converting and flashing certificate C:\certs\ca.crt
Error during certificates flashing: asn1: structure error: 
tags don't match (16 vs {class:0 tag:13 length:45 isCompound:true}) 
{optional:false explicit:false application:false 
private:false defaultValue:<nil> tag:<nil> stringType:0 timeType:0 set:false omitEmpty:false} certificate @2

The certs I'm trying to upload were made with openssl and they are self signed, question: the certs must have a special structure o they must be emitted with a particular software for to be uploaded without problems? Do you have any generator code o bash script that you could share with me please?

The full output:

PS C:\Users\user\apps\arduino-fwuploader_1.0.1_Windows_64bit> ./arduino-fwuploader.exe certificates flash -b arduino:samd:mkrwifi1010 -a COM4 -f C:\certs\ca.crt -f C:\certs\client.crt -f C:\certs\client.key Set binary mode readWord(addr=0)=0x20007ffc readWord(addr=0xe000ed00)=0x410cc601 readWord(addr=0x41002018)=0x10010305 version()=v2.0 [Arduino:XYZ] Mar 19 2018 09:45:14 chipId=0x10010005 Connected at 921600 baud readWord(addr=0)=0x20007ffc readWord(addr=0xe000ed00)=0x410cc601 readWord(addr=0x41002018)=0x10010305 Atmel SMART device 0x10010005 found write(addr=0x20004000,size=0x34) writeWord(addr=0x20004030,value=0x10) writeWord(addr=0x20004020,value=0x20008000) Device : ATSAMD21G18A readWord(addr=0)=0x20007ffc readWord(addr=0xe000ed00)=0x410cc601 readWord(addr=0x41002018)=0x10010305 Chip ID : 10010005 version()=v2.0 [Arduino:XYZ] Mar 19 2018 09:45:14 Version : v2.0 [Arduino:XYZ] Mar 19 2018 09:45:14 Address : 8192 Pages : 3968 Page Size : 64 bytes Total Size : 248KB Planes : 1 Lock Regions : 16 Locked : readWord(addr=0x41004020)=0xffff readWord(addr=0x41004020)=0xffff readWord(addr=0x41004020)=0xffff readWord(addr=0x41004020)=0xffff readWord(addr=0x41004020)=0xffff readWord(addr=0x41004020)=0xffff readWord(addr=0x41004020)=0xffff readWord(addr=0x41004020)=0xffff readWord(addr=0x41004020)=0xffff readWord(addr=0x41004020)=0xffff readWord(addr=0x41004020)=0xffff readWord(addr=0x41004020)=0xffff readWord(addr=0x41004020)=0xffff readWord(addr=0x41004020)=0xffff readWord(addr=0x41004020)=0xffff readWord(addr=0x41004020)=0xffff none readWord(addr=0x41004018)=0 Security : false Boot Flash : true readWord(addr=0x40000834)=0x7000a BOD : true readWord(addr=0x40000834)=0x7000a BOR : true Arduino : FAST_CHIP_ERASE Arduino : FAST_MULTI_PAGE_WRITE Arduino : CAN_CHECKSUM_MEMORY_BUFFER Erase flash chipErase(addr=0x2000) done in 1.047 seconds Write 13688 bytes to flash (214 pages) write(addr=0x20005000,size=0x1000) writeBuffer(scr_addr=0x20005000, dst_addr=0x2000, size=0x1000) [======== ] 29% (64/214 pages)write(addr=0x20005000,size=0x1000) writeBuffer(scr_addr=0x20005000, dst_addr=0x3000, size=0x1000) [================= ] 59% (128/214 pages)write(addr=0x20005000,size=0x1000) writeBuffer(scr_addr=0x20005000, dst_addr=0x4000, size=0x1000) [========================== ] 89% (192/214 pages)write(addr=0x20005000,size=0x580) writeBuffer(scr_addr=0x20005000, dst_addr=0x5000, size=0x580) [==============================] 100% (214/214 pages) done in 0.200 seconds Verify 13688 bytes of flash with checksum. checksumBuffer(start_addr=0x2000, size=0x1000) = 828d checksumBuffer(start_addr=0x3000, size=0x1000) = 746f checksumBuffer(start_addr=0x4000, size=0x1000) = db2 checksumBuffer(start_addr=0x5000, size=0x578) = 1ec5 Verify successful done in 0.045 seconds CPU reset. readWord(addr=0)=0x20007ffc readWord(addr=0xe000ed00)=0x410cc601 readWord(addr=0x41002018)=0x10010305 writeWord(addr=0xe000ed0c,value=0x5fa0004) Converting and flashing certificate C:\certs\ca.crt Error during certificates flashing: asn1: structure error: tags don't match (16 vs {class:0 tag:13 length:45 isCompound:true}) {optional:false explicit:false application:false private:false defaultValue: tag: stringType:0 timeType:0 set:false omitEmpty:false} certificate @2

Just as a quick test, are you able to flash one of the standard certificates provided by Arduino here?
https://github.com/arduino/arduino-fwuploader/tree/main/certs

I just gave it a try with Digicert_Root.cer and the flashing to my MKR WiFi 1010 was successful.

I tried with Digicert_Root.cer and got sucess :thinking:

./arduino-fwuploader.exe certificates flash -b arduino:samd:mkrwifi1010 -a COM4 -f C:\certs\Digicert_Root.cer
Set binary mode
readWord(addr=0)=0x20007ffc
readWord(addr=0xe000ed00)=0x410cc601
readWord(addr=0x41002018)=0x10010305
version()=v2.0 [Arduino:XYZ] Mar 19 2018 09:45:14
chipId=0x10010005
Connected at 921600 baud
readWord(addr=0)=0x20007ffc
readWord(addr=0xe000ed00)=0x410cc601
readWord(addr=0x41002018)=0x10010305
Atmel SMART device 0x10010005 found
write(addr=0x20004000,size=0x34)
writeWord(addr=0x20004030,value=0x10)
writeWord(addr=0x20004020,value=0x20008000)
Device       : ATSAMD21G18A
readWord(addr=0)=0x20007ffc
readWord(addr=0xe000ed00)=0x410cc601
readWord(addr=0x41002018)=0x10010305
Chip ID      : 10010005
version()=v2.0 [Arduino:XYZ] Mar 19 2018 09:45:14
Version      : v2.0 [Arduino:XYZ] Mar 19 2018 09:45:14
Address      : 8192
Pages        : 3968
Page Size    : 64 bytes
Total Size   : 248KB
Planes       : 1
Lock Regions : 16
Locked       : readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
none
readWord(addr=0x41004018)=0
Security     : false
Boot Flash   : true
readWord(addr=0x40000834)=0x7000a
BOD          : true
readWord(addr=0x40000834)=0x7000a
BOR          : true
Arduino      : FAST_CHIP_ERASE
Arduino      : FAST_MULTI_PAGE_WRITE
Arduino      : CAN_CHECKSUM_MEMORY_BUFFER
Erase flash
chipErase(addr=0x2000)
done in 1.048 seconds

Write 13688 bytes to flash (214 pages)
write(addr=0x20005000,size=0x1000)
writeBuffer(scr_addr=0x20005000, dst_addr=0x2000, size=0x1000)
[========                      ] 29% (64/214 pages)write(addr=0x20005000,size=0x1000)
writeBuffer(scr_addr=0x20005000, dst_addr=0x3000, size=0x1000)
[=================             ] 59% (128/214 pages)write(addr=0x20005000,size=0x1000)
writeBuffer(scr_addr=0x20005000, dst_addr=0x4000, size=0x1000)
[==========================    ] 89% (192/214 pages)write(addr=0x20005000,size=0x580)
writeBuffer(scr_addr=0x20005000, dst_addr=0x5000, size=0x580)
[==============================] 100% (214/214 pages)
done in 0.335 seconds

Verify 13688 bytes of flash with checksum.
checksumBuffer(start_addr=0x2000, size=0x1000) = 828d
checksumBuffer(start_addr=0x3000, size=0x1000) = 746f
checksumBuffer(start_addr=0x4000, size=0x1000) = db2
checksumBuffer(start_addr=0x5000, size=0x578) = 1ec5
Verify successful
done in 0.134 seconds
CPU reset.
readWord(addr=0)=0x20007ffc
readWord(addr=0xe000ed00)=0x410cc601
readWord(addr=0x41002018)=0x10010305
writeWord(addr=0xe000ed0c,value=0x5fa0004)
Converting and flashing certificate C:\certs\Digicert_Root.cer
Flashed all the things

I think this definitely points to a problem with your certificate files. Unfortunately, I don't know anything about the subject of preparing such files for this particular usage. I have only ever used the URL approach to installing certificates on my Arduino boards.

Maybe one of the other forum members will be able to provide instructions.

Of course, I thought could be an issue with certs .crt, .key or .csr generated with openssl, I've been doing another tests with openssl but generating .pem, .der and .cer trying to figure out what could be happen.. I wonder what could be the WiFi1010-WiFiNINA Firmware-Certificates Updater's cert extensions support?, Do you have any idea?