OTA update - Magic byte is wrong, not 0xE9

I’m trying in implement a firmware update OTA. I am storing the .bin in a firestore bucket. The file is made public for the moment and downloaded over HTTPS. So I am using bearSSL. Heres the download code:

bool downloadUpdate(String url)
{
  HTTPClient https;
  BearSSL::WiFiClientSecure secureClient;
  secureClient.setInsecure();
  https.begin(secureClient, STORAGE_BASE_URL, 443, url, true);

  // start connection and send HTTP header
  int httpCode = https.GET();

  if (httpCode > 0)
  {
    // HTTP header has been send and Server response header has been handled

    // file found at server
    if (httpCode == HTTP_CODE_OK)
    {

      size_t contentLength = https.getSize();

      if (contentLength > 0)
      {
        bool canBegin = Update.begin(contentLength, U_FLASH);
        if (canBegin)
        {
          WiFiClient stream = https.getStream();
          USE_SERIAL.println(stream);
          USE_SERIAL.println("Begin OTA. This may take 2 - 5 mins to complete. Things might be quiet for a while.. Patience!");
          size_t written = Update.writeStream(stream);
       }

The download always fails with:

ERROR[10]: Magic byte is wrong, not 0xE9

I have looked at the file in a hex editor downloaded from firestore and the first byte is 0xE9. If I print the first byte in the function it is 23 - which is 0xE9. So I’m not sure where the error is coming from.

Any ideas?

Thanks

Seems like a generic problems others have experienced too (ESPhttpUpdate.update Magic byte is wrong · Issue #1291 · esp8266/Arduino · GitHub).

The error is thrown here:

Which is the first thing that happens when you call Update.writeStream().

So it’s literally just doing data.peek() and comparing it against 0xE9

How about you hexdump the first 32 bytes and see what data is coming through the stream? (And then don’t call writeStream() because you’ve already consumed the data).

Something like this hexDump() function (here) and then

char readBuf[32] = {0};
stream.readBytes(readBuf, sizeof(readBuf));
hexDump("read buf", readBuf, sizeof(readBuf));

and tell us the output.

Power supply issues can sometimes be the culprit here also, as this one of the times the ESP is most power hungry - running both the WiFi radio continuously to download the file and writing to flash as well.

It may be worth turning on the HTTP_UPDATE core debugging also to see if that turns anything up… assuming I got the right flag, that is! :wink: i.e. add -DDEBUG_ESP_HTTP_UPDATE to build_flags in platformio.ini.

Ok so I ran the hexDump and I got…

0000 17 03 03 03 e7 89 f2 6a cc dd 73 1c 86 46 6b 4c …j…s…FkL
…X…

Which looks nothing like my .bin

0000 e9 01 02 40 9c f2 10 40 00 f0 10 40 68 05 00 00

Hmmm. This is the correct way to download a binary using GET from a HTTPS?

HTTPClient https; 
BearSSL::WiFiClientSecure secureClient; 
secureClient.setInsecure(); 
https.begin(secureClient, STORAGE_BASE_URL, 443, url, true);
int httpCode = https.GET();
WiFiClient stream = https.getStream();

I added the build flag but nothing was printed to serial?

Also I’m currently just running of usb power, could that still cause problems with the power supply?

Must also add -DDEBUG_ESP_PORT=Serial see other thread Debugging WiFiClient with an ESP8266 on PlatformIO - #3 by lbussy

Not good. Can you extend the buffer to like 4K by declaring static char readBuf[4 * 1024] = {0}; and tell us the output? Maybe there are some recognizable TLS headers or HTTP headers inside there, but that output looks undecodable to me oO

Is this dump maybe found in your binary at some other place? (On Linux you can do hexdump -C <bin file> to get the hexdump)

1 Like

Heres the 4K output… 0000 is different. This must be SSL isn’t?

0000  c3 7c 9e 25 1e e6 87 dd f4 ba 0e 37 34 33 1f fb  .|.%.......743..
  0010  91 8e 17 9c 37 1a 41 6b 8c d6 e3 61 1b a2 b8 8c  ....7.Ak...a....
  0020  15 46 15 ed 36 80 1a 8e c4 81 e9 b1 07 11 aa 9c  .F..6...........
  0030  47 e4 e6 58 50 3b b1 b6 dc 74 5f c0 aa 95 fd 84  G..XP;...t_.....
  0040  c9 0a ec b2 28 90 b6 1f 0f 4d 08 82 c6 71 50 bc  ....(....M...qP.
  0050  5a 13 17 03 03 03 e7 d8 21 81 1b bb eb 9e ce 2e  Z.......!.......
  0060  66 1d f4 cf 7e 7c e7 94 c8 d4 ba da 6a 9c 72 2e  f...~|......j.r.
  0070  82 bf bc 54 d3 cb ca ff 3f 52 2b 88 75 75 33 1f  ...T....?R+.uu3.
  0080  9e 90 a8 11 54 bf 1c 52 d2 66 ec 19 79 6a cd 24  ....T..R.f..yj.$
  0090  f8 72 c7 60 08 ff 3a 95 a1 c5 42 fc 6c 06 5a fc  .r.`..:...B.l.Z.
  00a0  12 50 06 1d 01 bb 80 05 85 d3 8f 58 0d 92 53 10  .P.........X..S.
  00b0  37 b2 31 aa 49 9f b2 a5 48 68 0b fc 12 98 ef 10  7.1.I...Hh......
  00c0  ba 2f 6c 8a c4 76 7d 8a a7 44 98 a2 29 58 74 7f  ./l..v}..D..)Xt.
  00d0  09 3c fc 16 da 47 56 82 dd 38 19 c7 40 9d dc 49  .<...GV..8..@..I
  00e0  c6 48 5e cb 06 6e b9 48 1f 63 fb 39 1c d9 0a 7e  .H^..n.H.c.9...~
  00f0  ef 96 52 1d 0a 20 17 5b 67 2a c9 ac 4d b8 2c d9  ..R.. .[g*..M.,.
  0100  77 59 df 27 94 45 6f 07 13 d2 f5 4d 4c 2b ee 2b  wY.'.Eo....ML+.+
  0110  3a 88 a8 6c 81 d9 e5 c7 ae 6b 86 6e 18 63 7b d0  :..l.....k.n.c{.
  0120  36 b0 f4 e6 91 13 dd 41 f0 60 1e d8 f3 bf 8a 93  6......A.`......
  0130  4f 3f ca 5b 11 c4 67 60 87 9e 3b b4 23 22 0c 97  O?.[..g`..;.#"..
  0140  6c e6 75 e1 16 78 29 a7 f0 f8 a6 54 2c 9a 00 98  l.u..x)....T,...
  0150  f5 4a d5 21 f1 41 df 19 89 3a 15 e7 f3 0c 4f d4  .J.!.A...:....O.
  0160  00 05 5b 0e 52 de 0e 1a 15 0a 48 f4 16 b9 07 92  ..[.R.....H.....
  0170  92 a4 58 06 12 10 80 91 ac c4 3a 6a 2b 75 f2 5c  ..X.......:j+u.\
  0180  9f f9 e2 e3 37 7e e5 bc 0a 49 23 c0 da 31 65 ab  ....7~...I#..1e.
  0190  49 8d f7 06 65 b2 01 15 99 9d c0 19 ab d0 2f 72  I...e........./r
  01a0  8d 46 84 1d 3d d8 b9 5a 35 93 38 d3 c7 c6 44 ae  .F..=..Z5.8...D.
  01b0  df ee f5 75 21 e7 a7 bd 19 fd c3 e7 68 31 1c bf  ...u!.......h1..
  01c0  70 10 a7 76 bf d1 e1 6b c9 d4 73 a9 7f 21 b6 ef  p..v...k..s..!..
  01d0  a1 17 99 69 49 1e c2 26 db 9f 9f 6b f7 00 21 b1  ...iI..&...k..!.
  01e0  4e 97 c3 d1 15 7f ba 05 5e 43 f8 34 05 d9 72 6b  N.......^C.4..rk
  01f0  c5 81 43 88 34 b5 71 87 30 81 ce 57 22 56 0b f2  ..C.4.q.0..W"V..
  0200  11 3a 13 cf 4b 5a 5b 1c 5a fd 7d 6f b1 9d 89 35  .:..KZ[.Z.}o...5
  0210  3e 86 d9 55 03 88 9c 63 f1 6f a8 fd 99 d2 4c 45  >..U...c.o....LE
  0220  cb 78 c0 27 df c0 f9 91 fc 2e 12 24 f4 ff 35 92  .x.'.......$..5.
  0230  a5 e5 c4 06 2d 09 84 f8 1e 54 b0 88 ae 58 0e 37  ....-....T...X.7
  0240  94 85 ea 29 2e 59 77 f1 60 72 13 bd 01 d8 0f 50  ...).Yw.`r.....P
  0250  68 7e 63 4a 0b cd 00 cd 34 dd 42 af 5e 9d a2 fa  h~cJ....4.B.^...
  0260  38 5e 04 d9 6b 35 3e e8 2c ca 25 c2 3a ab 88 69  8^..k5>.,.%.:..i
  0270  7a 15 c8 f0 ce 47 54 00 78 72 e7 dd 6c 3d c0 7d  z....GT.xr..l=.}
  0280  d8 9e 0d 0f 63 e1 b0 d1 f9 4b af a0 ba 44 0a 28  ....c....K...D.(
  0290  11 52 f6 6e bd 3e ce 6d 3c df 55 20 fb 43 e3 c1  .R.n.>.m<.U .C..
  02a0  3b f3 c9 38 bd fd c5 c9 63 44 96 f9 5e e4 bf c6  ;..8....cD..^...
  02b0  d9 22 7d 36 5b c9 75 44 ef ef f0 c1 35 55 e7 52  ."}6[.uD....5U.R
  02c0  25 8d 88 b6 a5 88 ce ad 44 9c 07 d6 04 f4 40 a1  %.......D.....@.
  02d0  67 be 77 02 8d 3b a4 06 77 a1 46 9a a4 e8 1a 94  g.w..;..w.F.....
  02e0  39 83 52 65 a7 50 91 98 ec ef 6f d4 f9 30 5c c1  9.Re.P....o..0\.
  02f0  d3 ed ec ee 7e c6 7b c2 9f 72 a6 2f 4f c2 6b 78  ....~.{..r./O.kx
  0300  9b 54 51 55 31 f9 61 cd 9e c0 77 8f f7 8c c6 08  .TQU1.a...w.....
  0310  bb e3 c3 f0 69 dd 0f 12 f4 2e ca 03 13 5d 34 cb  ....i........]4.
  0320  8a 2e 45 50 a1 fe 81 e5 02 09 b8 4e 9e 60 b2 6d  ..EP.......N.`.m
  0330  f6 18 4d 58 70 9c 0c 07 98 91 8c 38 34 88 d2 05  ..MXp......84...
  0340  b0 ee 54 49 8b 09 cc 5a 46 fc c4 14 4e d8 3a 5b  ..TI...ZF...N.:[
  0350  1e f3 66 86 cf 1e a0 1d 30 d1 47 0c 4c dd 63 12  ..f.....0.G.L.c.
  0360  9f 9c 92 5f 89 0a f0 3f 75 33 25 27 6c 8e b0 7c  ..._...?u3%'l..|
  0370  94 fb a4 71 e4 3d b3 fb e6 70 a1 8d 3b 1a 96 10  ...q.=...p..;...
  0380  d8 3d ba ee 4b cd 4d dc b2 f9 8f 78 71 6a 7d be  .=..K.M....xqj}.
  0390  a5 3f 3c 66 63 5b 98 b5 3b ad 89 6b ad 8f 2f f7  .?<fc[..;..k../.
  03a0  3a 60 f4 f8 de 9e f5 ff 17 30 9f bd 52 c1 80 13  :`.......0..R...
  03b0  86 28 9f 46 e1 b5 ef 63 96 ff c6 a2 28 c4 fd 41  .(.F...c....(..A
  03c0  bd 81 9e bc e5 a8 5d 97 9d 9c ab b8 e6 82 65 26  ......].......e&
  03d0  d1 c4 42 a1 dc 67 50 83 31 f6 c7 5a 10 bf 9f 5d  ..B..gP.1..Z...]
  03e0  59 c5 e1 83 9b 00 c5 eb 5f 6f ec b0 43 e5 55 13  Y......._o..C.U.
  03f0  05 38 db a1 26 80 bf 4d 37 2b 75 dd 1d b7 b6 c1  .8..&..M7+u.....
  0400  dc 62 49 20 d0 57 25 fc b8 f4 e9 3e d3 af cb 5a  .bI .W%....>...Z
  0410  e0 a5 26 cb e7 ab be 96 74 50 b9 9f 12 12 c7 cd  ..&.....tP......
  0420  05 bf a1 d0 e4 8d 04 a8 8c dd b7 2b 54 ee 3c 70  ...........+T.<p
  0430  9c 02 8d 78 36 df d6 9d 00 03 9d bc 38 a6 17 03  ...x6.......8...
  0440  03 03 e7 7f 92 01 11 ea 33 81 42 22 19 4f 29 18  ........3.B".O).
  0450  2b 7f 97 db 59 04 a3 d4 c9 9b 6c 57 ee 23 4a b9  +...Y.....lW.#J.
  0460  4b 73 68 ed e1 f5 d9 cf 8c 76 5a d1 c2 0c 41 e7  Ksh......vZ...A.
  0470  bf 57 e2 a7 74 47 06 56 78 57 9b f0 a2 c8 3a 81  .W..tG.VxW....:.
  0480  3b 58 c0 3f cf 51 5f 32 64 c3 0c 83 e1 6f 9f e7  ;X.?.Q_2d....o..
  0490  85 18 77 06 35 a3 34 57 9d fd 67 be bc f7 e7 78  ..w.5.4W..g....x
  04a0  65 df 36 40 7b c4 1e 90 92 ee bf ab 1b e1 65 a1  e.6@{.........e.
  04b0  25 01 d0 6f de ba 31 d3 ea 04 26 3e 64 8f 0a 6e  %..o..1...&>d..n
  04c0  62 51 f7 bf e9 90 7c 4a de 79 73 e4 3c ea f0 de  bQ....|J.ys.<...
  04d0  ce 88 59 3e 53 35 bf ea fb c9 2f 5f 4a 18 47 a0  ..Y>S5..../_J.G.
  04e0  45 65 f7 05 f6 77 1a f9 b8 de a9 ab 93 ef 1a 0e  Ee...w..........
  04f0  9e 4d 71 43 92 38 1c c8 95 d0 67 c1 79 5a e3 88  .MqC.8....g.yZ..
  0500  da 64 9a 13 46 28 8e c0 77 b6 12 b2 15 c1 f0 30  .d..F(..w......0
  0510  49 ae bf 19 15 c9 e6 58 70 6a 68 e8 48 0e 7d c3  I......Xpjh.H.}.
  0520  a5 62 f9 ec a8 65 b3 6a 48 fe ae 9d 0a 53 b1 fa  .b...e.jH....S..
  0530  e3 b5 fd 2b 3d 3f f7 ac 30 43 9f be 64 d3 fe 44  ...+=?..0C..d..D
  0540  0b dc 08 51 ba fb 3b 0a fa f7 64 f0 74 b3 89 c5  ...Q..;...d.t...
  0550  7e bc 1d 9d 4b 75 25 f0 bb 25 35 2a 35 88 74 65  ~...Ku%..%5*5.te
  0560  9f 97 ef d4 a2 af 56 b4 98 51 70 1d 1d 8f c4 cc  ......V..Qp.....
  0570  51 33 74 d9 80 85 5d 3d dc 8a 0f ce d1 8d 5e ac  Q3t...]=......^.
  0580  e4 d7 df 1f b4 14 97 47 45 31 ec 99 36 46 9d e6  .......GE1..6F..
  0590  7e 11 cb 13 ee d8 fa 9f 16 2c 9e 51 82 9b 21 06  ~........,.Q..!.
  05a0  25 74 48 44 be ae 0b 14 39 ea 2f 52 b2 3f 17 0e  %tHD....9./R.?..
  05b0  94 fa 51 e1 9e d8 5d 69 88 be bc 62 7a 96 54 bf  ..Q...]i...bz.T.
  05c0  2f 31 41 d7 d4 7f 11 95 14 f6 3b 11 4f e3 d4 af  /1A.......;.O...
  05d0  8a ea 35 10 81 9b eb 5b 75 74 0e c1 a6 03 02 3d  ..5....[ut.....=
  05e0  25 22 95 fd aa ae 19 db 88 8c a1 8d 56 b1 96 57  %"..........V..W
  05f0  65 77 22 98 ad 42 84 e2 a0 14 62 11 57 4a cc 45  ew"..B....b.WJ.E
  0600  45 ee 2c d2 d1 fc ac 03 23 5d 71 19 c9 fd 22 09  E.,.....#]q...".
  0610  a4 f1 59 c1 f5 31 bc ed 12 f8 69 6c 38 05 ec 0e  ..Y..1....il8...
  0620  5d 27 08 a8 4e 99 75 87 27 a5 06 e5 02 9f 79 c2  ]'..N.u.'.....y.
  0630  36 d0 b1 16 94 44 de 9b 0b 92 78 4a 39 d0 1e f7  6....D....xJ9...
  0640  be 49 13 ac fe 3b d8 20 74 7b 20 d4 11 fb 97 a7  .I...;. t{ .....
  0650  1b 9d 47 2b d1 08 4d b1 8b b8 06 74 64 1a 4f 89  ..G+..M....td.O.
  0660  bc c5 c3 28 ce 8b 0b d9 67 15 1e 63 c6 fb 9a 5d  ...(....g..c...]
  0670  58 19 f0 0d e8 ab 0a dd 23 fb 2b e6 3c cf 89 68  X.......#.+.<..h
  0680  ea 61 50 5c 05 7e 01 0d ad 51 b0 f8 37 1f ae df  .aP\.~...Q..7...
  0690  02 90 39 75 f1 67 11 31 7f ba 6d b0 72 ef ed 95  ..9u.g.1..m.r...
  06a0  11 51 61 0d 10 ad e3 50 d1 5f dd 5b 54 5a 7e 83  .Qa....P._.[TZ~.
  06b0  6b 4d 41 21 ba 0b e6 d4 68 10 ef 78 25 1d 34 8e  kMA!....h..x%.4.
  06c0  6c 44 75 ee de 2a 24 b7 9c 61 3b 5d 14 21 99 be  lDu..*$..a;].!..
  06d0  aa 96 c1 b0 8e 77 57 6b c7 c4 14 71 97 12 7d 9d  .....wWk...q..}.
  06e0  04 01 d7 4b 75 a6 3b aa b5 0c bc 8f bd 4e 64 54  ...Ku.;......NdT
  06f0  d5 87 18 cf 91 33 fa fd 7b a7 51 68 ec 5e 06 d8  .....3..{.Qh.^..
  0700  6c 2e 16 9d 19 10 30 19 9f b0 01 a7 e5 11 3c d9  l.....0.......<.
  0710  57 cd 59 a1 56 b4 1a 88 b5 f9 1a 60 a2 83 a2 43  W.Y.V......`...C
  0720  e8 7f 48 6d 7a f6 33 46 2f 03 b0 f7 0a 80 c7 84  ..Hmz.3F/.......
  0730  50 3e 53 cc d3 6e be 75 38 9c 3f 46 e2 9b e7 94  P>S..n.u8.?F....
  0740  2e 36 a5 15 c4 9b a1 02 e5 d1 05 4a 9f a3 c8 47  .6.........J...G
  0750  89 09 ed 6d 47 37 cc 2d c8 15 f3 e5 27 ab 90 45  ...mG7.-....'..E
  0760  b1 31 61 b1 74 1a 6f bd f1 f4 c8 30 2d 17 bf ac  .1a.t.o....0-...
  0770  ea d5 5e bf dd 9a 27 3c 72 fd e3 00 46 13 70 df  ..^...'<r...F.p.
  0780  0e a0 3f e2 91 d7 d9 10 de 47 9c be da fb e6 3f  ..?......G.....?
  0790  17 50 8e 55 00 f6 f5 56 9b 4f 69 e5 f2 e3 e9 66  .P.U...V.Oi....f
  07a0  2d a1 5c 12 12 d6 e4 00 08 16 29 97 25 1e 5f ef  -.\.......).%._.
  07b0  bd 28 40 4b 68 4f 12 72 9e 69 4e 46 f0 29 e4 e0  .(@KhO.r.iNF.)..
  07c0  79 6d 4a 77 12 79 76 b0 97 e3 2a 15 66 fa b5 35  ymJw.yv...*.f..5
  07d0  03 7b 83 98 67 d5 a1 1d 25 b3 49 98 74 8f 48 9d  .{..g...%.I.t.H.
  07e0  df f2 cf b3 30 1e 53 98 e3 08 2e 33 e5 88 d5 23  ....0.S....3...#
  07f0  c8 3d 1d 18 eb 4a f6 05 08 b9 8d 48 84 02 f9 d3  .=...J.....H....
  0800  5d 7d ac 01 7f 15 84 4f 26 f7 33 1a 11 1f 0c 21  ]}.....O&.3....!
  0810  30 94 87 79 0c 8a 6f 1a ca ff e4 7b 74 7e 2e 05  0..y..o....{t~..
  0820  ee 98 f9 ba 37 ad 3e 3c 65 73 17 03 03 03 e7 6d  ....7.><es.....m
  0830  75 a4 54 64 ab 29 5f 23 1a 05 f8 f5 ad 05 e7 48  u.Td.)_#.......H
  0840  30 dd 1b 2b 8c 52 f3 40 fd 78 c6 79 46 9e 32 e9  0..+.R.@.x.yF.2.
  0850  ee 14 60 b4 7b f9 5f 77 e0 6d 41 c2 00 00 22 5d  ..`.{._w.mA..."]
  0860  2b 0d 68 6b f7 98 fd 33 6f 89 f1 12 6b 40 a9 1b  +.hk...3o...k@..
  0870  e2 4d 82 81 c9 a3 4f f4 13 e3 bb 4d 12 f9 ed 20  .M....O....M... 
  0880  0a f8 a1 bf 4b 73 20 f8 f7 d0 3e 07 b7 51 e8 14  ....Ks ...>..Q..
  0890  a8 18 9f e0 ab 81 f7 d3 26 61 50 03 3c 4f 6c 9b  ........&aP.<Ol.
  08a0  45 f1 f9 26 b6 46 0a d1 1a 8e e9 dc 46 14 f4 4b  E..&.F......F..K
  08b0  79 84 01 fe a9 02 0f eb c0 df a3 4b 2d 66 ae 13  y..........K-f..
  08c0  1d 9b 0f ee 9b c5 92 e7 e1 5b 8a 25 0d ba 3b 14  .........[.%..;.
  08d0  e6 30 cf c8 4e 26 29 e5 78 db 45 b5 d1 53 cd 15  .0..N&).x.E..S..
  08e0  54 53 b8 a1 42 de 1b 85 c0 c4 1f af 1b 39 7e 74  TS..B........9~t
  08f0  2c 77 ed 3e 62 78 d8 ca ec e9 97 77 88 3f 06 d8  ,w.>bx.....w.?..
  0900  7c cc 3b 77 d4 74 c9 2c de 64 21 43 3a fc e8 81  |.;w.t.,.d!C:...
  0910  93 33 a3 df 8b 7b 19 fb e9 aa ca f5 c9 32 d9 a5  .3...{.......2..
  0920  4e 64 cc ff bb 89 ca 4f 8c 7c 07 79 ce ef e5 09  Nd.....O.|.y....
  0930  87 ff a3 c5 98 fb f3 87 78 45 7d 4d 39 2c 38 f6  ........xE}M9,8.
  0940  65 f2 7b 32 2e 27 09 19 d0 aa ec e7 97 39 bf 68  e.{2.'.......9.h
  0950  10 8f 52 93 df 9c 51 52 1f 6e 03 f3 f0 74 56 27  ..R...QR.n...tV'
  0960  d4 b7 b2 b5 f6 5b e0 bc 67 64 9f a7 70 ee 68 ed  .....[..gd..p.h.
  0970  36 6f ff fb c7 d2 15 30 1b 8c d1 e0 8a 21 3b 02  6o.....0.....!;.
  0980  f1 77 69 a7 2a 0b bf 7f 45 d6 d7 69 4f 83 4c d3  .wi.*...E..iO.L.
  0990  2b c8 06 7c c4 44 90 fb 5d d1 98 2e 0f f7 8d a6  +..|.D..].......
  09a0  87 ae 81 cc 55 fc e6 c2 e6 15 36 85 fd 82 68 6c  ....U.....6...hl
  09b0  bf ad 7a 09 a6 a1 c5 59 4f 4e fe 35 15 25 cc 06  ..z....YON.5.%..
  09c0  5e 6e 0a f0 82 80 c5 75 64 a8 3a b6 f8 73 e1 fc  ^n.....ud.:..s..
  09d0  b1 f4 bb a3 e7 f4 fd 56 9f f8 3b c0 62 7d 6b be  .......V..;.b}k.
  09e0  a7 f6 54 c9 11 d2 97 42 e6 c3 f8 48 16 21 f6 e4  ..T....B...H.!..
  09f0  4d f7 93 a0 af 5a d0 82 6e f9 90 fb 3c a5 2c ea  M....Z..n...<.,.
  0a00  d3 e7 ed b2 a2 f0 08 76 5b a6 ad 24 27 ab 55 cf  .......v[..$'.U.
  0a10  d7 69 00 fc 47 68 2c 41 17 91 b7 43 80 b1 6f f4  .i..Gh,A...C..o.
  0a20  b4 ee 94 ef bb 69 82 24 49 3d 83 88 9f c9 7d d5  .....i.$I=....}.
  0a30  3c e6 ef 42 c5 ac 72 de 3e 44 ac a0 be 21 ec 36  <..B..r.>D...!.6
  0a40  78 0f df b2 8f ff 38 f1 6d d6 e8 5f 05 16 36 a5  x.....8.m.._..6.
  0a50  d3 63 69 a3 06 83 2d 85 6e 1e ca b7 7e fa ce 73  .ci...-.n...~..s
  0a60  16 3f 93 49 1c 6d 45 37 e8 f3 23 07 f7 62 8f 11  .?.I.mE7..#..b..
  0a70  11 5e af 65 40 7d 58 eb c4 b1 94 96 25 18 b3 15  .^.e@}X.....%...
  0a80  42 05 3f c6 a7 4d 6b 85 40 04 a6 b0 88 d9 1f 4b  B.?..Mk.@......K
  0a90  d2 de 7f 75 2a 2c 8f 17 4f cf 5f 6a 6c f5 50 13  ...u*,..O._jl.P.
  0aa0  48 7b 4a ca e3 9b 42 39 1d d9 f5 4f 53 5e 49 a6  H{J...B9...OS^I.
  0ab0  74 e3 2e b3 fa 05 8a 16 8b 2a 72 45 a4 db 38 05  t........*rE..8.
  0ac0  bc 69 ae ab 00 76 ef 1e 19 92 5c 50 e8 db c7 76  .i...v....\P...v
  0ad0  f4 b9 3f 7c db 5a 54 54 dd 1b fd c0 d0 f3 a3 12  ..?|.ZTT........
  0ae0  3d 6a 69 26 66 d9 96 65 47 94 58 9d 1d a9 df d1  =ji&f..eG.X.....
  0af0  f3 60 3c 51 ae ba 37 b7 94 53 ca 0a fb 72 74 ec  .`<Q..7..S...rt.
  0b00  f8 1d 42 1d 5d 09 5a ed bc 94 b6 92 ea 3d fc dd  ..B.].Z......=..
  0b10  27 be 74 b2 85 26 52 df 02 71 06 fc 54 1e af a1  '.t..&R..q..T...
  0b20  70 17 12 93 f0 f9 c0 c9 02 e4 99 41 9c 84 96 0b  p..........A....
  0b30  8e c2 af c8 ae b8 3a 29 ef b3 0c 40 d7 a5 5a 0e  ......:)...@..Z.
  0b40  78 f6 12 6f a3 2f f7 02 95 f4 f5 45 4d 21 de 72  x..o./.....EM!.r
  0b50  f9 fa 77 87 e1 c4 1b 37 d4 1e 01 3f 37 80 38 d4  ..w....7...?7.8.
  0b60  81 63 3e ec 34 4e 0b fb 3d 62 af c8 d1 ef 47 5f  .c>.4N..=b....G_
  0b70  34 e2 d7 99 2c 5d 32 41 66 d2 26 88 14 1a ec 71  4...,]2Af.&....q
  0b80  95 db 49 32 da 15 98 88 b7 f8 12 2a 59 d8 24 d5  ..I2.......*Y.$.
  0b90  1c c3 bc 70 0f 23 5d 5b 19 89 3d 38 b5 46 93 d5  ...p.#][..=8.F..
  0ba0  60 26 4d 38 a8 9d 26 15 78 11 93 a9 07 fb db 83  `&M8..&.x.......
  0bb0  ac b0 35 71 f4 9c 90 57 1b dd 06 a8 ba 97 3d 64  ..5q...W......=d
  0bc0  2d b0 a3 46 2c 7f 18 fb 0a 58 21 a1 4d e8 38 2d  -..F,....X!.M.8-
  0bd0  68 a6 b3 6d 97 61 a0 b5 ba 45 0f 55 fc 21 4b 0f  h..m.a...E.U.!K.
  0be0  d2 3e fc 29 d0 3f 71 cf 59 62 32 e2 c0 3c 34 7d  .>.).?q.Yb2..<4}
  0bf0  68 cb e3 71 45 c1 fe e2 02 53 75 e3 e3 28 26 3c  h..qE....Su..(&<
  0c00  4a 09 71 02 8a 92 f1 a9 6a 2d ea 86 8b a0 28 bb  J.q.....j-....(.
  0c10  19 cc 6e 29 a5 af 17 03 03 03 e7 83 03 b3 e6 24  ..n)...........$
  0c20  55 a3 61 e1 52 60 82 f3 41 3e 2d 75 9d 67 39 5f  U.a.R`..A>-u.g9_
  0c30  a7 fa 17 37 27 b8 da d4 f2 e9 17 a4 50 11 14 5f  ...7'.......P.._
  0c40  c9 c0 3c 02 eb fb f3 d5 29 a0 50 0f 1f 78 3f e1  ..<.....).P..x?.
  0c50  3e aa 8b 9a 72 8f 83 b5 0f 12 d5 05 64 8a 90 a2  >...r.......d...
  0c60  92 74 30 46 51 55 ef aa 51 fc 13 78 f8 83 20 02  .t0FQU..Q..x.. .
  0c70  9f 36 94 b6 c6 4f 50 83 54 7b 80 c8 e7 d2 a8 1f  .6...OP.T{......
  0c80  39 5f 40 72 b1 72 69 db f6 64 fe b5 bf 30 4b 72  9_@r.ri..d...0Kr
  0c90  38 c7 e7 5a 4c 19 1a 56 5d ab f9 5b e6 15 ed bd  8..ZL..V]..[....
  0ca0  ef b5 d4 bf 51 3b 97 8b 39 25 20 63 c5 54 64 e5  ....Q;..9% c.Td.
  0cb0  3c 2b a8 20 1f 62 f8 14 75 d8 a6 95 20 a6 6f c8  <+. .b..u... .o.
  0cc0  10 00 df 54 b8 09 75 d9 fa a6 37 ee 76 bc 2c c7  ...T..u...7.v.,.
  0cd0  fd b7 33 5c c1 7c 2a a5 6f 03 cf 8d d4 1d ca 2c  ..3\.|*.o......,
  0ce0  be ce da 35 31 c4 ff 67 76 8c d8 43 c0 cb bf 3e  ...51..gv..C...>
  0cf0  17 c7 a7 84 6d a2 94 87 86 2b 32 7b e4 4f be 62  ....m....+2{.O.b
  0d00  24 e3 bd b2 1d b7 11 39 3b b7 1c ff 69 d6 c3 fe  $......9;...i...
  0d10  4a 87 75 c6 37 d0 ce 73 95 c4 bc f2 3e 72 35 f1  J.u.7..s....>r5.
  0d20  50 08 8d 2b ed e5 f6 4c 91 9f 99 f1 cf 2c fb 95  P..+...L.....,..
  0d30  29 66 a9 38 84 96 74 e6 24 cd 83 4f 92 bc 32 52  )f.8..t.$..O..2R
  0d40  28 b3 34 45 73 aa 3b 80 b5 39 a7 81 5e 86 99 4c  (.4Es.;..9..^..L
  0d50  29 5a df 9a b6 0e b0 2d 31 3c 56 38 dd 8b 8a e3  )Z.....-1<V8....
  0d60  a0 16 f9 9e 28 ff d3 c2 b2 d2 ad d3 30 e8 1b c6  ....(.......0...
  0d70  0d 7e 86 db 6e 3c 20 96 ec 45 d5 27 57 6e 31 30  .~..n< ..E.'Wn10
  0d80  c6 e5 78 a5 de 45 ff da b9 21 f1 15 36 e3 97 ca  ..x..E...!..6...
  0d90  8b 83 05 a3 2e cd 43 a7 f0 dd c6 e7 a5 64 03 33  ......C......d.3
  0da0  55 81 67 8d 11 29 5d 00 83 47 cd 25 a6 20 bf 6a  U.g..)]..G.%. .j
  0db0  29 1b 3d a0 c1 36 53 c3 3b e0 61 cc ef 14 b8 c9  ).=..6S.;.a.....
  0dc0  27 27 45 e1 26 56 ab d9 21 b4 d8 be bd cc b0 a8  ''E.&V..!.......
  0dd0  e2 97 43 24 87 0b 99 d3 5d 85 8c 0e 0e 71 97 6c  ..C$....]....q.l
  0de0  96 93 64 60 13 ec b9 e5 13 65 c2 7e a0 54 0a 2f  ..d`.....e.~.T./
  0df0  f9 e0 c6 96 fb 36 c2 25 a0 42 8f 3b 90 70 5f 0b  .....6.%.B.;.p_.
  0e00  21 81 d1 24 02 aa 67 f5 f9 55 1a 70 54 d8 86 0a  !..$..g..U.pT...
  0e10  87 28 8e d6 49 44 96 0e 58 5e 96 90 13 de 15 e5  .(..ID..X^......
  0e20  36 96 95 fb 28 78 da 64 ff 8c fb a4 e0 0f ca c2  6...(x.d........
  0e30  9a d3 06 f8 a2 c4 e3 af b1 89 32 6f c4 ae 77 79  ..........2o..wy
  0e40  f6 dd 04 71 39 c7 e0 ca bb 27 1c 9d af 9b c5 3a  ...q9....'.....:
  0e50  cf 94 81 f5 4a 93 e5 e1 04 95 cc 53 60 65 aa 83  ....J......S`e..
  0e60  ff e5 3f ab 2f dd 11 23 68 e5 99 9e 4c c1 7d 74  ..?./..#h...L.}t
  0e70  87 41 1b d4 9b 55 e5 da 1b db 0b 44 95 dc 01 22  .A...U.....D..."
  0e80  92 5b 40 a0 3e 1c 75 10 38 9b 6f 52 be b4 8a 0e  .[@.>.u.8.oR....
  0e90  2e b7 ff 68 3e d2 58 d4 d7 1a ed 3f 4b df 99 2b  ...h>.X....?K..+
  0ea0  af 2f df 45 fd 67 e7 30 cc 52 21 73 0d 4b cc 64  ./.E.g.0.R!s.K.d
  0eb0  1e a3 08 ed 2c 46 09 17 45 8b 20 af 2c c2 58 0f  ....,F..E. .,.X.
  0ec0  08 70 89 32 11 63 b8 48 8f 5f f1 e8 b9 33 62 80  .p.2.c.H._...3b.
  0ed0  80 8b 7f 0f 8c 34 dc ac f3 1f 6c 77 da 43 f6 14  .....4....lw.C..
  0ee0  c9 e9 43 3b 7f 40 61 18 49 e6 58 1c ca 16 86 21  ..C;.@a.I.X....!
  0ef0  c4 2c 45 2f 9f 4b 79 65 b8 c1 38 15 50 1c 7f 44  .,E/.Kye..8.P..D
  0f00  4b 33 c4 8f e8 92 6a 41 09 01 1b 4f 2f f8 c0 3e  K3....jA...O/..>
  0f10  df 0e 0c c3 07 21 92 17 3b 57 4b e1 dc d1 3f fa  .....!..;WK...?.
  0f20  86 6d 8c 0f d8 03 53 fc 52 8f 5a 39 80 19 e6 60  .m....S.R.Z9...`
  0f30  fb 03 f0 eb 9d fa 6e 9c ea 52 1c 40 8f f7 5a 3a  ......n..R.@..Z:
  0f40  af 83 0c 79 d7 9e 91 2d 02 f8 b3 a6 b1 e4 e0 6f  ...y...-.......o
  0f50  18 bd 71 0a 14 c4 2b 53 a3 1e d7 54 9b 94 44 bf  ..q...+S...T..D.
  0f60  7b dc 76 27 04 1a 9f a4 b4 74 3c 78 a8 1e 2c 71  {.v'.....t<x..,q
  0f70  42 42 fb 5e f0 0c 89 bf 1b 84 e2 16 b6 9d f1 55  BB.^...........U
  0f80  69 fa 3c a5 d6 1a 2b 34 c4 17 2c fd 13 d9 17 f7  i.<...+4..,.....
  0f90  8b a5 fd b2 fc 8c 54 8f 9a f0 1b 6c 55 10 0e 55  ......T....lU..U
  0fa0  65 da 58 c0 a8 76 51 bf c9 16 56 cc 05 ad 8a 8c  e.X..vQ...V.....
  0fb0  5b b3 ac 17 4b ed ba cc c3 ba 33 00 3a 4d ad a4  [...K.....3.:M..
  0fc0  85 0b ec ca b6 69 af c5 76 68 1d 33 f6 3e e4 49  .....i..vh.3.>.I
  0fd0  3e e2 6a cb cd 91 3f 86 9f 33 6c df 03 43 4a b6  >.j...?..3l..CJ.
  0fe0  ce dd 84 e9 90 4c a1 42 0c 64 3d 4b a2 80 ee 8d  .....L.B.d=K....
  ........h..$.qU.

Ahhh! However! If I read directly from https.getStream() the bytes are correct…

Did you ever figure this out? I am having the same issue.

WelI I think every project code and thus possible error source can be different. The post above you says that it was solved by using another function to retrieve the bytes, so I can only speculate that it had something to do with reading the encrypted bytes and not the decryped bytes in the stream (after TLS). Please post a new topic with the exact code you’re running, platformio.ini, and what kind of debugging you have done already to understand it better.

1 Like

I actually just encountered a similar issue when migrating a SPIFFS project to LittleFS… it looks like Upload Filesystem Image OTA does something ArduinoOTA doesn’t like… but Upload Filesystem Image did… even though it was OTA still due to how the environment was configured (upload_protocol = espota). I plugged in the USB thinking I’d use the other (non OTA) Upload option, but it still did an OTA upload, and just worked.

2 Likes

I think in my case it was something to do with bear SSL and trying to use a file that was still encrypted…

Can’t remember how I fixed it, but remembering thinking it was a bit of a rookie mistake lol

1 Like

I’ll just post a new question mines probably a rookie mistake too lol