#382

  Переглядів 54,812

Andreas Spiess

Andreas Spiess

2 роки тому

Using remote controls to switch something on or open your garage is a piece of cake. Doing this automatically without touching anything is a little bit cooler. And doing it like James Bond, with an ESP32 Watch and completely encrypted? Let’s have a closer look at how this can be done and how we can build secure transmissions for other projects.
I am a proud Patreon of @GreatScott!, @ElectroBOOM , @Electronoobs , @EEVblog , and others. No Docker, No Microsoft Teams, Zoom
Links:
ESP32 Dev. Board: s.click.aliexpress.com/e/_ANHrBc
ESP-01: s.click.aliexpress.com/e/_9iQa15
T-Watch V3: s.click.aliexpress.com/e/_A4VDDh
Sketches: github.com/SensorsIot/Encrypt...
T-Watch playlist: • TTGO T-Watch 2020 ESP3...
T-Watch Smartwatch library: github.com/sharandac/My-TTGO-...
AES128 library: github.com/suculent/thinx-aes...
Approximate Library: github.com/davidchatting/Appr...
The links above usually are affiliate links that support the channel (no additional cost for you).
Supporting Material and Blog Page: www.sensorsiot.org
Github: www.github.com/sensorsiot
My Patreon Page: / andreasspiess
Discord: / discord
If you want to support the channel, please use the links below to start your shopping. No additional charges for you, but I get a commission of your purchases to buy new stuff for the channel
My Amazon.com shop: www.amazon.com/shop/andreassp...
For Banggood bit.ly/2jAQEf4
For AliExpress: bit.ly/2B0yTLL
For Amazon.de: amzn.to/2r0ZCYI
For Amazon UK: amzn.to/2mxBaJf
For ebay.com: ebay.to/2DuYXBp
profile.php?...
/ spiessa
www.instructables.com/member/...
Please do not try to email me. This communication channel is reserved for my primary job
As an Amazon Associate, I earn from qualifying purchases
#no#midroll#ads

КОМЕНТАРІ: 454
@Hessijames79
@Hessijames79 2 роки тому
Another approach would be a challenge-response one: S-„open“->R, R-„please encrypt N=rand()->S, S-AES(key, N)->R
@AndreasSpiess
@AndreasSpiess 2 роки тому
This would use the reverse channel, I assume. Definitively, this would add a lot of security. And no synchronization would be needed.
@peterdever4826
@peterdever4826 2 роки тому
@@AndreasSpiess , thank you for very interesting and great content. You are my electronic mentor!! I was wondering if it would be possible to use ones mobile device instead of a smartwatch with esp32? Will the mobile phone's wi-fi not be sufficient?
@Conservator.
@Conservator. 2 роки тому
@@peterdever4826 Hi Peter, I think one could use ones phone. The wifi would be more than sufficient. It would require you to run an app of course and your phone would need to make a direct connection to the receiver. The SonOff app does something similar to add a new SonOff to your home network so I don’t see why this couldn’t be done.
@soulrobotics
@soulrobotics 2 роки тому
can you explain a little more please. I am so interested on this. I am building my own encryption protocol based on Keeloq but since it was defeated by russian hackers I want to build something more robust. My idea is "known command"->encryption+new password for decryption of the next msg-->base64--- transmission ---; Response "ACK" Since the NEXT msg has to be decoded with the password sent in the last msg, a replay attack will fail. the sender always send the password to decode the next encrypted msg. in case on a playback or milk attack, based on the "ack" signals, the sender can hold the last successful msg and send the proper msg to restart. yes is complicated to explain but i swear i will do explain better after my breakfast.
@zeero4ever
@zeero4ever 2 роки тому
@@soulrobotics One single lost message will desync your devices forever, wouldn't it?
@ei23de
@ei23de 2 роки тому
One of your best videos in terms of information density. ESP-NOW is far too unknown, it has such a great potential and you can do so much cool stuff with it! So thank you for this one, Andreas!
@AndreasSpiess
@AndreasSpiess 2 роки тому
You are welcome! I hope this video inspires some people to do something...
@LordHog
@LordHog 2 роки тому
Thumbs up for the fur ball. Very adorable
@AndreasSpiess
@AndreasSpiess 2 роки тому
Thank you!
@AlunJones
@AlunJones 2 роки тому
Since you're padding the packet with zeros, I suggest you validate that they decode to zeros at the receiving end. This protects you against an attacker sending random data in the hope it decrypts to a high value.
@ernestassimutis6239
@ernestassimutis6239 2 роки тому
yeah that greater comparison doesn't seem robust to random data too
@martinger327
@martinger327 2 роки тому
You should definitely use a checksum in the packet to prevent random data being accepted. You might consider using libnacl for the crypto-stuff. If is available on ESP8266 and ESP32 (here even included in the esp-idf), includes well accepted crypto algoritms, and its "cryptoboxes" do encryption and integrity checking for you.
@AndreasSpiess
@AndreasSpiess 2 роки тому
As many others proposed we could add a simple window of maybe 50 or 100 numbers... Would not be too complicated.
@mfx1
@mfx1 2 роки тому
Or pad with a known key phrase, just relying on the number being bigger to be valid is fairly naive approach. There's other ways as well like sending the counter value twice, or send it forward and reversed or adding one to the second copy of the counter value all of which act as very simple checksums that don't require complex maths or libraries.
@jochen_schueller
@jochen_schueller 2 роки тому
@@AndreasSpiess Even with protection against random data attacks there's still a vulnerability left - what you mentioned in the video - an attacker that is able to capture a transmission (a transmission that doesn't make it to the receiver endpoint for some reason) can replay it later (until the next successful transmission in range invalidates the captured one). At one hand, this sounds like an unrealistic scenario and can easily prevented by not pressing the button randomly (but only to open the door). At the other hand, an attacker could block the receiver with a jammer/sending random data at the same channel near the receiver and place a second device (to capture an attempt to open the door/has to be placed close to the position of the remote control when transmitting). If the remote control does not work, the owner of the garage will likely open the door using the traditional method (mechanical key...). If he doesn't immediately debug the system and find the cause of the malfunction (maybe decides to look at it next weekend) the attacker now can use the captured transmission to open the garage anytime he wants. So I think the only proper way of implementing a secure protocol is by using a challenge-response algorithm.
@DaveGee2010
@DaveGee2010 2 роки тому
Love the pur-monster! ;-)
@AndreasSpiess
@AndreasSpiess 2 роки тому
Me too :-) And she likes to cover half of my screen...
@PATRIK67KALLBACK
@PATRIK67KALLBACK 2 роки тому
You are a lucky guy Andreas, my cat always sleep on the keyboard.
@AndreasSpiess
@AndreasSpiess 2 роки тому
It is all about education ;-)
@dicktonyboy
@dicktonyboy 2 роки тому
How lovely now to be able to point back to you huge body of 1st Class work. Well done!
@AndreasSpiess
@AndreasSpiess 2 роки тому
Yes, an astonishing number of videos came to existence during the last few years...
@JungleJake1664
@JungleJake1664 2 роки тому
Compliments to you Andreas, well explained in simple and clear terms, great channel. 👌
@AndreasSpiess
@AndreasSpiess 2 роки тому
Thank you!
@AnotherMaker
@AnotherMaker 2 роки тому
Very cool use for the watch. I love the creativity. I may need to dust mine off and mess with it again. I made a few little silly projects, but it's been sitting ever since.
@AndreasSpiess
@AndreasSpiess 2 роки тому
There are many gadgets around these days (I remember the ESP32 cam, for example). We have way more technology then ideas ;-)
@samvoelkel2046
@samvoelkel2046 2 роки тому
Several good ideas here. Also, nice ending. Thanks.
@AndreasSpiess
@AndreasSpiess 2 роки тому
Glad you enjoyed it
@Average_Geo
@Average_Geo 3 роки тому
Fun project with fair enough security. It's probably easier to pick a door lock to gain entry ;)
@AndreasSpiess
@AndreasSpiess 2 роки тому
You are right. Or a hammer for a window... Anyway, I never knew how to use encryption and I thought like that I can motivate people to use it for their projects. A little is better than nothing...
@no1slisteninganyway
@no1slisteninganyway 2 роки тому
Some interesting project ideas. I've been wanting to create a secure garage door opener for my motorcycles and trigger it by flashing my high-beams when I get home. Toggling the high-beams can both power the units on and transmit the codes.
@AndreasSpiess
@AndreasSpiess 2 роки тому
My transmitter under the saddle runs all the time. It is so low-power that it does not disturb anybody (range 2 meters or so). But a morse signal with your headlight would be a cool solution ;-)
@miscellaneousHandle
@miscellaneousHandle 2 роки тому
Nice job Andreas
@AndreasSpiess
@AndreasSpiess 2 роки тому
Thank you!
@klassichd10
@klassichd10 2 роки тому
Thanks for your effort and your ideas. These remote control activities are really extremely useful and worthwhile each penny. For many years, I am opening (and close) my garage door via 20 EUR Homematic components (AES encrypted) and open (and lock) the entrance doors of the house using Keymatic together with a smart phone "App" written in "Tasker". Works very well and is very convenient. I also use RFID to trigger these tasker apps. When my mother increased dementia and forgot her keys, I used additional RFID technology to give her access to her house. So, she could stay many months longer in her own house as without this technology. Very helpful and worthwhile each penny.
@AndreasSpiess
@AndreasSpiess 2 роки тому
Thank you for sharing your experience. Indeed we have many such remotes around us and I wanted to make them a little safer... RFID are also a very useful thing as long as they use the newer ones with some encryption. I think they do not need to be extremely safe because we build one-off devices and if the effort is high, nobody will try it (or smash a window which is easier).
@PhG1961
@PhG1961 2 роки тому
Excellent ! This video might become very usefull for me !
@AndreasSpiess
@AndreasSpiess 2 роки тому
Very good!
@insanemainstream3633
@insanemainstream3633 2 роки тому
Just need a garage now lol great video Andreas!
@AndreasSpiess
@AndreasSpiess 2 роки тому
Good point. Mine is also only rented...
@peter.stimpel
@peter.stimpel 3 роки тому
Nice content. The field of encryption is a tough one with many security traps and risks if not properly implemented. So guys, be careful how much you trust your own implementation or libraries.
@AndreasSpiess
@AndreasSpiess 2 роки тому
I completely agree and I am not very good at it. Still I think the reach of a system is a big protection factor. If the reach is only a few meters, the effort increases compared with a device connected to the internet. ESP_Now in this respect is probably a good compromise.
@grindel80
@grindel80 2 роки тому
After the really exciting contend, the snorring cat outro relaxed me again
@AndreasSpiess
@AndreasSpiess 2 роки тому
Thank you! This time she was so tired I had to film her :-)
@CTCTraining1
@CTCTraining1 2 роки тому
Great project, only thing I’d add would be a status update on the garage door using another comms path entirely (eg text, or email) to let me know about any openings (or more usefully) failed closings.
@AndreasSpiess
@AndreasSpiess 2 роки тому
Good point. Two way authentication is simple and safe. Unfortunately also an additional effort not everybody likes.
@johnpipe362
@johnpipe362 2 роки тому
Interesting. Something to put on my To Do list.
@AndreasSpiess
@AndreasSpiess 2 роки тому
Glad you liked it!
@3rd_Millennium_Engineering
@3rd_Millennium_Engineering 3 роки тому
Andreas, you're unstoppable! 😃 Hey! And there is Dishka! Hi little buddy!!!
@AndreasSpiess
@AndreasSpiess 2 роки тому
Thank you. This time Dishka was especially lazy and no big help in the lab...
@cycnus
@cycnus 2 роки тому
@@AndreasSpiess Seeing her in your video is such a sweet pleasure. I lost my last cat to old age about a year ago and miss him a lot. Give her a scratch for me, she's a real treasure.
@AndreasSpiess
@AndreasSpiess 2 роки тому
I will!
@3rd_Millennium_Engineering
@3rd_Millennium_Engineering 2 роки тому
@@cycnus I know how you feel. We lost our Jamie the Fur Monster (Maine Coon Cat) last October after his blessing our lives for 16+ years. AGh, we digressed from sensors!!!
@GAETANOIERA
@GAETANOIERA 2 роки тому
Stupendo, un video pieno di contenuti molto dettagliato, grazie anche per la traduzione in Italiano mi ha permesso di apprezzare a pieno il tuo video, seguirò il tuo canale con molto interesse. Grazie
@AndreasSpiess
@AndreasSpiess 2 роки тому
Italian subtitles were an automatic translation done by Google. It was a test and maybe I will continue. Thank you for your feedback that the translation was helpful.
@PemboPemberton
@PemboPemberton 2 роки тому
Use a similar principle to a keyless car fob. (1) - The fob sends a command ID "request to unlock" - plus an incrementing value. (2) - The car checks the ID and that the incrementing value is higher than the previous value and stores it if it is - then replies with an "understood unlock request" command plus a random number for the fob to perform some maths formula on. (3) - The fob performs the needed maths formula on the value recieved, then sends the value back. (4) The car checks that the value is a match for the result of the formula and unlocks if it is. Just one of many methods. Enjoying the channel from here in the UK. 😉👌🏾
@AndreasSpiess
@AndreasSpiess 2 роки тому
You are right. If we would add a backchannel we would get a lot of additional possibilities.
@JanJeronimus
@JanJeronimus 2 роки тому
As always a great video. You also could trigger an MQTT message when an attack is detected.
@AndreasSpiess
@AndreasSpiess 2 роки тому
Good point!
@JoseBerruezo
@JoseBerruezo 2 роки тому
Very nice video!
@AndreasSpiess
@AndreasSpiess 2 роки тому
Thank you!
@prof1811
@prof1811 2 роки тому
To improve securety as others have pointed out a challange response would be great. Also you might want to consider asymetric encryption. Have the transmittes public key register in the reciever.
@AndreasSpiess
@AndreasSpiess 2 роки тому
You are right. As soon as we establish two-way communication we get much more possibilities.
@FulcanelliRosetta
@FulcanelliRosetta 2 роки тому
Dawww love the kitty at the end. Their snurring was funny.
@AndreasSpiess
@AndreasSpiess 2 роки тому
:-)
@kevinlassure6214
@kevinlassure6214 2 роки тому
Perfect video. I hope since your video, the AES implémentation now integrates "salt"
@AndreasSpiess
@AndreasSpiess 2 роки тому
I do not understand :-(
@kevinlassure6214
@kevinlassure6214 2 роки тому
@@AndreasSpiess Salt in cryptography act as a randomizer. It would encrypt "Hello World" but appear ciphered in many different ways. It prevents to find patterns in ciphered text.
@bizmythy
@bizmythy 2 роки тому
Maybe you could use the RTC to include the current time in the encrypted message so that if the code is milked and replayed later the time from the code will not match the RTC of the receiver. Would maybe need to update the transmitter's time occasionally to keep it accurate.
@AndreasSpiess
@AndreasSpiess 2 роки тому
Including time is always a very good idea. But then both times have to be synchronized. This could be done during pairing.
@LimBo3500
@LimBo3500 2 роки тому
@@AndreasSpiess synchronisation is not reallu required, the receiver needs to keep track of the 'latest' message, anything older can be ignored
@zeero4ever
@zeero4ever 2 роки тому
@@LimBo3500 That leads to a security hole, if your codes get milked and used before you get home and use the genuine remote. Actually without clock sync it's exactly the same approach as with the incrementing numbers. Time IS a steadily incrementing number for PCs and MCUs :-) A synced clock would be a very nice security measure, but you would need to think of the additional energy consumption in the remote as well as clock drift between sender(s) and receiver.
@avamander.
@avamander. 2 роки тому
@@zeero4ever Time would allow to set expiricy and you can also sync it during any communication. This would avoid replay attacks outside of the token's validity period.
@zeero4ever
@zeero4ever 2 роки тому
@@avamander. Thats what I said. Time is useless without sync. Yes you could resync everytime, but it's a pain. If you start implementing two way comms anyway, challenge response would be way easier. You HAVE to know the key and you HAVE to know the logic to calculate the response. No milking or replaying possible, if the challenge uses nonces or some other technique to never have a bitwise duplicate challenge. Otherwise long term eavesdropping COULD make replays possible.
@electricwhirl5175
@electricwhirl5175 2 роки тому
It would be awesome if you also included links to your videos of other mentioned previous projects, it's quite cumbersome to write them down and then search for them, not always find the correct one... :) but thanks for your efforts making all this!
@AndreasSpiess
@AndreasSpiess 2 роки тому
Good idea!
@vincentnonnenmacher9352
@vincentnonnenmacher9352 2 роки тому
Even your cat is equipped with a low power watch dog (sorry you are the dog here) and goes back to very low energy state immediately upon verifying your are in it’s allowed list. Nice !
@AndreasSpiess
@AndreasSpiess 2 роки тому
True! She opens one eye a little to check the situation...
@jacquesderiban557
@jacquesderiban557 2 роки тому
Lovely cat !
@AndreasSpiess
@AndreasSpiess 2 роки тому
Thank you!
@TheChemicalWorkshop
@TheChemicalWorkshop 2 роки тому
WHAT i never knew a watch like this existed ! gotta pick one up next time i have spare cash
@AndreasSpiess
@AndreasSpiess 2 роки тому
Yes, it is already in its third release...
@sikedipuuhja7376
@sikedipuuhja7376 2 роки тому
if you have access to an RTC, just include a timestamp - unixtime format - into the message. this way you can also verify whether the message was prerecorded. keeping a +/-10 second window can solve problems related to small inaccuracies
@AndreasSpiess
@AndreasSpiess 2 роки тому
Agreed. But you would need two long-time stable clocks... (No problem for a Swiss, of course, but not cheap ;-)
@FOTsugi
@FOTsugi 2 роки тому
Dischka *-* at the end
@AndreasSpiess
@AndreasSpiess 2 роки тому
I know, I know. The content is not important ;-) Just the cat.
@peterdever4826
@peterdever4826 2 роки тому
I have done a similar projects using SHA256
@AndreasSpiess
@AndreasSpiess 2 роки тому
Also a good idea. It seems even safer...
@anvz6
@anvz6 2 роки тому
I think a better alternative is a challenge/answer. The lock sends a challenge like a random big number. The key encrypts this number and sends back to the lock. The lock decrypts it and check if it's the previously sent number. This way, it's useless to replay previous messages because the challenge changes every time. But it requires two way communication. By the way when I say "encrypt" it can be something as simple as add a secret string to the challenge and calculate md5 or sha1. No need for a real encryption.
@AndreasSpiess
@AndreasSpiess 2 роки тому
You are right. Adding a reverse channel definitively would add a lot of security.
@anvz6
@anvz6 2 роки тому
@@AndreasSpiess and it does not require synchronization...
@bluekeybo
@bluekeybo 2 роки тому
A flaw I see here: the receiver is simply creating an unsigned long number from the decrypted string, and checking if the number is higher than before. In theory, I could send the receiver junk data and the receiver will decrypt it, and convert the junk counter string into a number (if it happens to be an integer). Since you only check if the counter is simply larger than before, it's likely you'll get an unsigned long that indeed is larger, and open the gate. Maybe limit the check to the incoming counter being within 10 numbers of the previous value or something like that. Also, in the sendData function, in itoa, "cleartext" needs to be large enough to hold a 32 bit long int as a string with the last one being the null termination (11 character long for base 10 which is what you're using), so idk why you've made it 256 chars long. You can initialize it to all zeros and make it 16 bytes long and you won't need to pad it later, just zero it all before each use (still need to replace the null termination char with a 0 after itoa). The way you're doing the padding with zeros doesn't seem right either, since you're indexing from messLen + 1, but you should start at messLen instead, that's why starting with a zero initialized cleartext is easier. Furthermore, you're passing messLen to the encryption function that may be smaller than the 16 byte block of your padded cleartext. I think you should pass a 16 instead since the message you're encrypting is always 16 bytes. Also why is your ciphertext in the decryption 50 characters long?
@MayankJoneja
@MayankJoneja 2 роки тому
Yeah at the very least wouldn't you want some small window like you mentioned for conventional rolling code RCs? So it should only accept values at MAX 250 values ahead of the rx counter?
@AndreasSpiess
@AndreasSpiess 2 роки тому
A window is a good idea and easily done...
@nikethunner2732
@nikethunner2732 2 роки тому
GER: Durch deinen Kanal bin ich wirklich auf den Geschmack von ESP32s gekommen, danke dafür. Mit Hilfe deiner bisherigen Sammlung an Videos zu dem Thema habe ich dual Core Programme geschrieben, mich endlich mit den BL/Wifi Features beschäftigt und so weiter. Mittlerweile benutze ich die Arduino IDE fast nur noch für ESPs. Probiere gerade weniger bekannte und weniger gut dokumentierte Boards aus, wie das TTGO T8 v1.7 oder das S2-Soala. Das TTGO habe ich jetzt erfolgreich zu einem potenten A2DP sink für Bluetooth boxen hinbekommen, dank viel Flash und IPEX Antenne mit sehr guter Reichweite und extrem störungsfreiem Betrieb. Das Soala Board habe ich mir noch nicht richtig angeschaut. ENG: Because of your channel i really got interested in ESP32 boards, thanks for that. With the help of your neat collection of videos i have written dual core sketches and finally really discovered the BL/wifi features. At the moment, all I use the Arduino IDE for is basically ESPs. I am investigating some of the lesser known and less well documented boards at the moment, like the TTGO T8 v1.7 or the S2-Soala. I succsessfully made the TTGO into a very potent A2DP sink for Bluetooth speakers, thanks to its big flash and its IPEX antenna with absolutely trouble-free performance and long range. I am looking at the Soala board next.
@AndreasSpiess
@AndreasSpiess 2 роки тому
Ja, die ESPs bieten schon viele Möglichkeiten mit Wi-Fi und BLE. Du hast ja schon schöne Projekte gemacht. BTW: Für das S2 board musst du die Experimentelle Version des Arduino Frameworks auswählen.
@nikethunner2732
@nikethunner2732 2 роки тому
@@AndreasSpiess Ja danke für den Hinweis, das habe ich schon gesehen. Werde wohl eine zweite IDE aufsetzen, um mir die stabile Version nicht zu zerschießen. Danke für deine Videos!
@AndreasSpiess
@AndreasSpiess 2 роки тому
Ich konnte ohne Weiteres zurück zur normalen Alle Files sind in einem Directory und wenn du sicher sein willst kannst du das jeweils löschen...
@AjinkyaMahajan
@AjinkyaMahajan 2 роки тому
It and also adopt a software-generated PN Sequence generator that will encrypt the packet generated by MCU. Adds an extra layer of security. Cheers ✨✨
@AndreasSpiess
@AndreasSpiess 2 роки тому
Good idea!
@mcconkeyb
@mcconkeyb 2 роки тому
Interesting project! My add on would be to include the Date/Time with the counter value, then encrypt the whole thing. On the receive side, you have 2 variables to compare; 1 - is the counter incremented, 2 - is the time within the right range (the Date/Time range can be set by the user, depending on security level desired). The draw back here is that the system has to have a moderately accurate real time clock (RTC). If you are using a smart wrist watch that should be no problem for the transmitter. Since the receiver is likely hard mounted to some fixed infrastructure (like a garage, etc) there should be a power source that is adequate to run a RTC in the receiver. With this addition in place, a bad guy will have a very limited amount of time to find the encryption key, decode the counter value and then increment it and send the new encrypted message back to your receiver to open you door. Still not impossible to do, but considerable harder. After posting this I scrolled down to see this idea had already been posted. Oh well, better late than never. :-)
@AndreasSpiess
@AndreasSpiess 2 роки тому
You are right: Adding time would tremendously increase security. But it means that we need synchronized clocks on both sides. Not easy to solve, because they have to work for years (assuming the key has no internet access).
@mcconkeyb
@mcconkeyb 2 роки тому
@@AndreasSpiess Allowing for a time range (window) to match, should solve the problem of synchronization. Assuming an accuracy of 1 minute/year. A matching range of 10 minutes would allow for 10 years before re-sync would be needed. A range (window) of an hour would allow for 60 years before it failed. If the accuracy was as bad as 6 minutes/year, then you would still get 10 years before failure. If you only send the code once per day then you could even make the time window equal to the usage rate and thus even with very bad clocks, a time window of 24 hours should provide many decades of use before synchronization becomes a problem. The time window just needs to be short enough so that cracking you crypto keys takes longer than the matching time window you allow. I don't think anyone is going to be able to break your AES 128 crypto in 24 hours. :-)
@richards7909
@richards7909 2 роки тому
We all know that it's not really about garage doors. It's all about the catflap and the constant battle against cat hackers... :-) Quite enjoyed this video as it was nice to see some decent examples/explainations without ending up with a sore head trying to make sense of it!
@AndreasSpiess
@AndreasSpiess 2 роки тому
You are right. Many solutions are on the search for a problem ;-)
@paulfontaine7819
@paulfontaine7819 2 роки тому
A challenge response security seems more apropriate here. The advantage is that once both sides share the same secret (key), there is no risk of desynchronisation of the counter value, e.g. when the transmitter battery fails or when the transmitter software is reloaded or when an other transmitter is added, ... In a challenge response, the receiver would ask the sender that he knows the same secret, by responding with the challenge a) encrypted with a shared key or b) hashed after combining it with a shared secret.
@AndreasSpiess
@AndreasSpiess 2 роки тому
You are right. if we add a back channel we get many more possibilities.
@circadianrebel
@circadianrebel 2 роки тому
Earlier this year I was experimenting with ESP-NOW for my RIoT home automation project, including some remote switches. I dug in to two way communication and robust challenge-response / IV exchange, and it was easily an order of magnitude more complicated than using a rolling code. In particular it becomes a mess if you want more than the small number of devices normally supported. ESP-NOW only allows a limited number of receiver devices a single device can transmit to, so you need your hub to dynamically re-allocate entries. Definitely not worth the effort for simple remote buttons IMO. I did push forward on it though, as I use the two way communication to notify the devices if there is a firmware update available, which causes them to automatically connect to WiFi and update themselves.
@AndreasSpiess
@AndreasSpiess 2 роки тому
Very interesting project! I am glad you finally got it working.
@maxpenfold8699
@maxpenfold8699 2 роки тому
I love the Cat 😻
@AndreasSpiess
@AndreasSpiess 2 роки тому
:-)
@craigs5212
@craigs5212 2 роки тому
I think one needs an upper bounds on the decrypted counter, without that there is likely chance that a random generated encryption string decode may be larger than the counter and open the door. Depending in the current counter value it's the probability of the decrypted random numbers being below the counter value vs it being above is the counter. If the counter value was at 1 all numbers but 0 or 1 would open the door. Very significant probability any random encrypted string would resolve to > than 0 or 1.
@AndreasSpiess
@AndreasSpiess 2 роки тому
You are right. Adding an uppr limit would be a simple way to increase security. But it is not easy to create even a number without knowing the key...
@transientaardvark6231
@transientaardvark6231 2 роки тому
I think I'm correct in saying that having "predictable" (ie "fixed" or "repeats" or "math-op-of") bits in the payload makes brute force attacks much easier. So having a chunk of the payload set to all-0 is probably a bad idea. You could fill it with random data, or random-data-plus-some-sort-of-"checksum" (allows a secondary check). Even some sort of checksum-of-the-counter would be better than all 0s. As is commented many times here, there are many pit falls to be had with "security" and encryption topics. Of course it all depends on how much effort it is worth an attacker investing. But as always, an interesting topic covered with clarity and brevity - thanks for sharing your work. (And one of the most beautiful cats on the web)
@AndreasSpiess
@AndreasSpiess 2 роки тому
I agree. It probably would shorten the time for the brute force attack. Maybe a random skipping of numbers could already help enough? But keep in mind: There is always a possibility to bang a window ;-)
@Nico-Thiry
@Nico-Thiry 2 роки тому
Thumbs up for the adorable furball
@AndreasSpiess
@AndreasSpiess 2 роки тому
:-)
@gilbertorossi3666
@gilbertorossi3666 2 роки тому
simple approach without risk of desynchronization: Just use a similar system to one-time passwords: use the current timestamp as the "rolling code" before encryption
@TecSanento
@TecSanento 2 роки тому
But the esp looses time tracking without network connection realy quickly... And am rtc clock makes it more difficult
@AndreasSpiess
@AndreasSpiess 2 роки тому
You are right. If you have a good clock inside both devices you can add more randomness to the numbers when you use time stamps. But I am not sure if it is worth the effort in addition to ASE128 encryption. Desynchronization also can happen here (battery dead for example).
@realbss1
@realbss1 2 роки тому
Hi Andreas, understanding it's for demonstration purpose it's just a reminder : As you know EEPROM/Flash memory cells do have a wear by writing to them. As you write any change to the EEPROM it wearing out quite fast in a real world. Beside that excellent idea. As mentioned in a real world scenario I would suggest do overcome the write limitation of the flash by using a random challenge response authentication system . Something like having a fixed set of keys ( 16 or so ) that are chosen by random (or derived from the minute of daytime) on the master device while the slave has to try any of it's known keys to decode and properly respond either using the found key or any other based on a rule (maybe just next one). That way an attacker would have to know all keys and it's order. So along with AES 128 I would call it somehow safe ... Much like the "shed's" in the swiss mountains - I guess you know what I mean. Edit : A replay attack can be prevented by the send (changing) challenge message where the slave has to know the proper answer.
@AndreasSpiess
@AndreasSpiess 2 роки тому
You are right with the EEPROMs. Recently they seem to be better and we could rotate the storage of the values to reduce the problem. And I agree, adding two-way communication would open the door for many more concepts.
@peterdever4826
@peterdever4826 2 роки тому
@Andreas Spiess , thank you for very interesting and great content. You are my electronic mentor!! I was wondering if it would be possible to use ones mobile device instead of a smartwatch with esp32? Will the mobile phone's wi-fi not be sufficient?
@AndreasSpiess
@AndreasSpiess 2 роки тому
The Smartphone does not know the ESP-Now protocol. So we would need another way of establishing a connection. Here I am at the end of my knowledge (how to program Smartphones)
@Hfil66
@Hfil66 2 роки тому
Milking keys can be mitigated against by sending a timestamp so that the key becomes invalid if reused at a later time (depending on how good you can maintain the synchronisation between clocks on your transmitter and receiver).
@KelvinWKiger
@KelvinWKiger 2 роки тому
Exactly what I thought. I'm a simple web-developper just passing by, this is not my field; so I wonder what Andreas thinks about this solution. 🤔
@AndreasSpiess
@AndreasSpiess 2 роки тому
I agree, using time would increase security a lot. But .If you want to use timestamps you need two synchronized clocks on both sides. Maybe not an easy task over years with battery change etc.
@Hfil66
@Hfil66 2 роки тому
@@AndreasSpiess but does your use case require remote situations where there is not the opportunity to resynchronise time over many years (whether the two devices synchronise with each other or synchronise with a common remote NTP server)? Ofcourse, simply maintaining a running clock on the transmitter will increase battery drain as the battery will have to keep powering the clock even when not having anything else to do. Again, this is down to use case, as to whether this is an unacceptable penalty to pay for that use case.
@AndreasSpiess
@AndreasSpiess 2 роки тому
@Hfil66 I decided not to use Wi-Fi for the project. With Wi-Fi, you have many other possibilities, you are right. A simple HTTPS call would have been enough, I think. I also wanted to keep the possibility open to exchange ESP-Now with another communication like 433MHz.
@wuftymerguftyguff
@wuftymerguftyguff 2 роки тому
AvE will be proud
@AndreasSpiess
@AndreasSpiess 2 роки тому
He sometimes also watches or watched my videos...
@Dialbist
@Dialbist 2 роки тому
It would be nice if there were more videos about the T-Watch. energy saving of a watch, editing the firmware, and most importantly, how to write your application for this firmware
@AnotherMaker
@AnotherMaker 2 роки тому
The watch is just an ESP32 and a screen. It takes a lot of time to make cool uis even with the libraries, which is why no one does (I didn't). Volos on YT is the man when it comes to cool graphical uses for this watch. He shares all his sketches.
@AndreasSpiess
@AndreasSpiess 2 роки тому
I also posted a link to a project. I agree, it is not easy to create all the interaction and graphics.
@MartinPDanz
@MartinPDanz 2 роки тому
All three approaches are interesting ... but go for the 007 one 😉
@AndreasSpiess
@AndreasSpiess 2 роки тому
Maybe we will even get the new film in the next time when cinemas will open again...
@MartinPDanz
@MartinPDanz 2 роки тому
@@AndreasSpiess ...maybe they have to make a new one because in winter time it will be already too old
@777swampie
@777swampie 2 роки тому
The best security system is one your enemy knows nothing about. You have to come up with parts of your encryption system that are not published or guessable by anyone else.
@BinderTronics
@BinderTronics 2 роки тому
Might want to have a look at mbedtls library. Basically the industry trusted standard as far as I'm aware. Think it is included in the Arduino install for the ESP32. It is in the IDF. Had a proximity lighting project a year or 2 ago with BLE. Project was caned because it made the employees feel unsafe. Basically made the place look like a horror movie with the lights turning on and off as people moved though the hallways.
@AndreasSpiess
@AndreasSpiess 2 роки тому
Thank you for the tip. It seems the mbedtls can also be used in the Arduino framework. Concerning BLE for light switching: I like this idea. Very strange people were scared. It seems not too hard to understand what happens....
@BinderTronics
@BinderTronics 2 роки тому
@@AndreasSpiess It's the reason the bean counters gave me. It was in semi rural Africa. Very superstitious.
@Mr.Leeroy
@Mr.Leeroy 2 роки тому
7:19 no, MITM jams receiver when you push the button, and retransmits second code it gets from your remote. All happens in a blink of an eye, so you may think that it was a glitch the first time, door still opens, but attacker still gains unused key for himself.
@AndreasSpiess
@AndreasSpiess 2 роки тому
Maybe this is possible. Usually, all receivers are jammed at the same time if they are close to each-other. Which is the case if I am in front of my garage and press the button.
@Mr.Leeroy
@Mr.Leeroy 2 роки тому
@@AndreasSpiess Don't recall the details, but it was documented by some pentest specialist. The most secure way I can think of doing this with amateur MCU project is TOTP, given that you can maintain accurate time source and it won't render your door unusable in case it looses sync.
@mrtnsnp
@mrtnsnp 2 роки тому
I would probably limit the jump-ahead. Not just (counter > stored_value), but (counter > stored_value && counter < stored_value + 256).
@AndreasSpiess
@AndreasSpiess 2 роки тому
You are right. A simple and valuable addition.
@abc321meins
@abc321meins 2 роки тому
Hey Andreas, great video as always! Maybe have a look at UWB (Ultra Wide Band)? It looks like it could be a perfect solution for a save "James Bond" door opener?
@AndreasSpiess
@AndreasSpiess 2 роки тому
Did you already find cheap modules? Last time when I researched the topic a module was still a few hundred dollars :-(
@abc321meins
@abc321meins 2 роки тому
@@AndreasSpiess Yes, as UWB is still a pretty new technology and there are not many manufactures out there producing UBW chips the prices of them are indeed not that cheap at the moment. In my opinion the most interesting chips for makers are the ones from Decawave. Especially the Dev-Board “dwm1001-DEV” looks like it’s a good starting point. Its 21 bugs on mouser atm. www.decawave.com/product/dwm1001-development-board/
@AndreasSpiess
@AndreasSpiess 2 роки тому
My link says more than 200$: www.mouser.ch/ProductDetail/Qorvo/MDEK1001?qs=TiOZkKH1s2TlRZBi6MtMNg%3D%3D This is what I had saw when I searched last time.
@michaels3003
@michaels3003 2 роки тому
"Billion years to crack it" -- this was in 2012; we are in 2021 now.
@AndreasSpiess
@AndreasSpiess 2 роки тому
So it is nine years less, you are right ;-)
@michaels3003
@michaels3003 2 роки тому
@@AndreasSpiess , no. I was implying that the computational power must have increased significantly over that time period. Some people built large stacks of video cards for digital currency computations. They can also be used for other purposes.
@AndreasSpiess
@AndreasSpiess 2 роки тому
I agree. (It should have been a bad joke). I anticipated this movement when I only said million years instead of billion years. But, predictions are difficult especially about the future as Niels Bohr once said.
@Flying0Dismount
@Flying0Dismount 2 роки тому
Just encrypting an incrementing counter value as your payload makes your system subject to cryptanalysis attacks and simple bit twiddling to possibly get a decrypted result in an acceptable range. Ideally, you should use AES in GCM mode (a mode that ensures that the data is both encrypted and authenticated and has an inherent counter separate from your rolling code to prevent bit twiddling and complicates any cryptanalysis) and would be recommended to have a more complex, less predictable message content than just the counter value. Challenge-response would also allow implementation of much stronger mechanisms, but if you had to stick with a simple one-way transmission, choice of AES mode is very important.. Variations could include manipulations of the IV (e.g., current date and time encoded as IV, assuming you can maintain reasonable sync between remote and door)..
@AndreasSpiess
@AndreasSpiess 2 роки тому
Thank you for your additional ideas! I did not know that an internal counter is possible. This algorythm does not have one. The code for a particular message was always the same if I remember right.
@w-mwijnja8919
@w-mwijnja8919 2 роки тому
Great video! Non-encrypted garages remote systems are really bad. For instance, see Samy Kamkar's 'Open Sesame' project for a DIY tool that can open any of those garage doors in mere _seconds_ by cycling through through all possible values using De Bruijn codes.
@AndreasSpiess
@AndreasSpiess 2 роки тому
I assume it would be hard with this door. Maybe we also could implement a waiting time after a few wrong tries...
@paullacatus8975
@paullacatus8975 2 роки тому
AES128 encrypted purr by the end! Nice furry encryption device ! Or random key generator.
@AndreasSpiess
@AndreasSpiess 2 роки тому
You are right. I never understand what she is telling me ;-)
@paullacatus8975
@paullacatus8975 2 роки тому
@@AndreasSpiess I had once the same issue. I had a very intelligent tomcat that understood most what we said to him. But we did not understand quite nothing of what he is saying. And he understood that also Which is the intelligent species between us ?
@ClearwaterKB
@ClearwaterKB 2 роки тому
I know this is a little bit older video, but I have a question for the big brain people 😜. What development board do you suggest for me to start with? My 9 & 11 year old son's want to get into IoT and automate our motorHOME. Since we live in it full time, we want to have fun AND protect ourselves with gas detection, water detection, and fun stuff. I have an Arduino and a raspberry pi, but it seems like it will get WAY too expensive to use those for every project. I know very little knowledge, will be learning with my kids and using a LOT of tutorials. Thanks!
@mikeydk
@mikeydk 2 роки тому
Two way, as you mentioned would be cool, just because. Remote sends a ping to the receiver, the receiver sends a random number to the remote, the remote does some kind of math with that number and returns it to the receiver, which then compares the received number to the one it expected to get back, using the same math.
@AndreasSpiess
@AndreasSpiess 2 роки тому
With two way communication we would get a lot of possibilities, I agree. And it should not be too complicated.
@w-mwijnja8919
@w-mwijnja8919 2 роки тому
In your current sketch you accept 'any' value that is larger than the current counter, and the cyphertext you send is very small (an unsigned long, albeit padded to 16 bytes). This will make a brute-force attack much easier because stumbling across any cyphertext for any larger value would open the door. There also does not seem to be any check which sees whether the decrypted text 'makes sense'. I might be mistaken, but I don't think it is part of most sync.block cyphers to check this by themselves. If I am correct, essentially any cyphertext would probably be decrypted to a 'garbage' non-zero long, and then be accepted by the receiver.
@AndreasSpiess
@AndreasSpiess 2 роки тому
You are right. I think it would not be too complicated to add a „window“ as many viewers suggested.
@mfx1
@mfx1 2 роки тому
A basic clock at both ends can avoid the milking problem, the clock doesn't really need to be very accurate as any milked codes are likely to be used well outside of any sort of timeframe requiring high accuracy and each time the receiver gets a valid unlock it resyncs it's clock to the transmitter clock at the same time to correct for drift, you could actually use the time from an off the shelf RTC as your counter seed for the encryption, just set the starting time and date to something fictional and random, I assume the watch has an RTC built in? So you can use that time and apply a secret offset/salt it with other data.
@AndreasSpiess
@AndreasSpiess 2 роки тому
Interesting concept. It also should work with one-way communication.
@geluidsbox9195
@geluidsbox9195 2 роки тому
Hey Andreas! I always like to watch your video's because they contain so much useful information! I'm learning a lot about the ESP32 and other electronics on your channel. Have you heard about the ESP32 Lyrat module? It's an official development board made by Espressif for audio development. They have created the ESP-ADF (audio development framework) for it and it looks pretty powerful and cool. Maybe in the future you can make a video on this topic? I haven't found really any useful video on it so far! Reason why I found this interesting is because I noticed there isn't any microcontroller or module capable of playing multiple MP3 files at the same time (that's within certain price ranges), it seems to be an issue for some people and this cheap board seems like a solution.
@AndreasSpiess
@AndreasSpiess 2 роки тому
This seems to be a very special application and also the board is very specialized. So the chance it will appear on this channel is not too big. Unless I find an interesting project for it...
@geluidsbox9195
@geluidsbox9195 2 роки тому
@@AndreasSpiess I see! I agree with that too so I totally understand it :)
@ericblenner-hassett3945
@ericblenner-hassett3945 2 роки тому
As it is in Arduino, you could force hackers/spies to run into both buffer over-run and under-run issues by having it set both encryption and set and include non standard packet lengths while using fake ' standard ' packet markers.
@AndreasSpiess
@AndreasSpiess 2 роки тому
Unfortunately I am no encryption specialist and cannot follow your idea :-(
@ericblenner-hassett3945
@ericblenner-hassett3945 2 роки тому
@@AndreasSpiess ok, so variable packet length sent, bytes order is length, packet, hash code ( verify data) all encrypted with the same 16+bit length code so the reciever can check it then use the packet command.
@viniciusvbf22
@viniciusvbf22 2 роки тому
This is very clever and this is a very nice video!! Nonetheless, I wouldn't seriously consider using Wi-Fi devices for this kind of application. The IEEE 802.11 standard is mainly concerned about bandwidth and range, not about power consumption. There are other PAN technologies that can fit better this kind of need (proximity detection) like Bluetooth LE (beacons), UWB (Ultra-Wideband), Z-Wave and ZigBee. These devices can be powered by simple batteries and stay operational for many months or even years.
@AndreasSpiess
@AndreasSpiess 2 роки тому
You are right: Wi-Fi is power hungry! My device switches the ESP with a mechanical switch and the CPU switches itself off when done. So the maximum time used is a few seconds per opening. A battery lasts quite long with this method.
@petelynch9468
@petelynch9468 2 роки тому
Interesting ideas. I have something similar with an RPi that switches on outside lights when my phone approaches. I use Bluetooth for this, what are the advantages of using WiFi rather than BT?
@AndreasSpiess
@AndreasSpiess 2 роки тому
If a BLE device is coupled it sops advertising and is not easily detectable. At least this was the case in my last video.
@jbbotha
@jbbotha 2 роки тому
When you write the number to the transmitter's EEPROM every time, how long will the ESP's EEPROM last? I've heard about problems with ESP EEPROMs in this regard. It cannot handle many read/write operations if you're writing to the same memory space all the time.
@AndreasSpiess
@AndreasSpiess 2 роки тому
You are right. EEPROMs in the past died quite fast. Newer EEPROMS seem to work longer. But definitively a limitation. You could also every time store the value at a different place in EEPROM.
@jstro-hobbytech
@jstro-hobbytech 2 роки тому
Very useful, thank you. I'm just getting into the esp.
@AndreasSpiess
@AndreasSpiess 2 роки тому
I hope you will enjoy it as we do...
@davechatting
@davechatting 2 роки тому
Another super interesting video - many thanks for the shout out to my Approximate Library (could you add a link please?) - Did you run the code on the Sonoff itself? In my Sonoff example it's the other way round - the ESP is acting as the remote control and uses the library's ability to find proximate IP addresses and then send them HTTP requests. All the ESP does is find the identity of the closest device and so the vulnerabilities in the system there are with the Sonoff's REST interface, rather than in spoofing a MAC address. However, in my scenario that means you have to take an extra device with you - rather than the convenience of it being your phone.
@AndreasSpiess
@AndreasSpiess 2 роки тому
I thought the library is in the Arduino libraries directory? So people do not need a link. But I will add it if you desire. Concerning a device other than the Smartphone: Then I prefer something like my second example with a button. Having a device transmitting all the time will not have a long battery live, I assume.
@davechatting
@davechatting 2 роки тому
@@AndreasSpiess thanks for the link - yes, my Sonoff example uses a button too
@josephchamness9915
@josephchamness9915 2 роки тому
Just using a one time pad(array of random numbers) might be easier. The the sender just sends the random number and an array position. once the array position has been used it would be marked as used by the controller so it can't be used again. As long as the random numbers are good you would not have to worry about bugs in the code or the encryption being broken. But with a phone, smart watch or esp32 shouldn't you be using securer WiFi with SSL MQTT already? Also for things like garage it might be good to ignore more unlock codes for 5 minutes.
@AndreasSpiess
@AndreasSpiess 2 роки тому
Good points. I thought using a simple encryption call is not too complicated. And concerning Wi-Fi: You are right. There we can use all the internet things. But I wanted to be independent from Wi-Fi and chose ESP-Now which reduces our possibilities.
@algre977
@algre977 2 роки тому
ESPnow has native encryption mode available, have you thought of using it instead of AES library, or is it less secure ?
@AndreasSpiess
@AndreasSpiess 2 роки тому
I only leaned it from my viewers. And I am not sure on how to use it in the Arduino framework.
@typxxilps
@typxxilps 2 роки тому
I have a simple question: this video is mostly translated into german - for the first time I guess. The title and the description is german and I had recogniced it on another channel from portugal most recently where I had thought for a long time that this could be a german emigrant cause he quite often visited germany and Berlin but did not sound that german. And not your channel has flipped the languages too so I ask myself if you did the translation or simply clicked an option like translate into.
@AndreasSpiess
@AndreasSpiess 2 роки тому
UKposts now offers an automatic translation if I upload my English script (if I chose to do so). This is why I chose to use it for several languages. What do you think about the quality?
@roystervi
@roystervi 2 роки тому
hi is there a sensor that can do radius to pick up people (travel through walls) and display them as distance? something like ultra sonic sensors. example, mounted in the center of one house and if am standing it a room it will display feet away.
@AndreasSpiess
@AndreasSpiess 2 роки тому
I do not know of such a sensor.
@liucyrus22
@liucyrus22 2 роки тому
What about using a RTC, manipulate the value into some custom format (prevent brute forcing), and encrypt the time?
@AndreasSpiess
@AndreasSpiess 2 роки тому
I assume then the two clocks have to be synchronized from time-to-time. Standard clocks differ after a year or two.
@dd0356
@dd0356 2 роки тому
Interesting project! although i am not a big fan of a "smart-watch" having myself wearing 24x7 for a about a 2 years. And this episode calls for a follow-up episode of m2m and machine to human "control" and communication using wifi/ble using various technologies like websockets over http. I got some time 2 weeks back but my body was too weak then. Now i am feeling better, but my employer thinks i am 100% fit, that means life is back to where it was!
@AndreasSpiess
@AndreasSpiess 2 роки тому
I am glad to read that you are better now. I thought about you when they showed the horrible pictures in some Indian hospitals. Fortunately, I did not have to go through all this pain. Now I am vaccinated and they say, that, even if I would get it, it should be weaker.
@dd0356
@dd0356 2 роки тому
yes it was the worst thing i have seen in my entire life. and even worse it could have been controlled. in my opinion, we had massive political rallies (1million people without masks) because of ongoing provincial assembly elections and village level elections ( we have 3-tier political system here, national level-state level-district/village level). For example one state has 90,000 villages and each one of them is having elections. This urge for power comes from history, especially during medivavl/mughal times and british colonial times, it was feudal and this seat of power was "auctioned" for highest bidder who would in return extract taxes from the local people. Even in 21st century, many people have this kind of thinking in their subconscious mind. in 2020, they had imposed a complete lockdown for about 2-3 months and our economic growth went to -ve range for the first time in 30 years. So this time no lockdown. Had they imposed lockdown in the first week of april for about 10 days, this would not have become such a tragedy. Now they only think about economy and money. Even in my organisation, they started building pressure on me to start working after 10 days...on the other hand those people who i talk to over phone regarding work were also infected. Although we have hospitals but the number of cases were just too many for these hospitals to handle. Most important, this thing develops very fast say in 5-10 days. Although i am far from medical expert, i have to say, this virus looks like a mischief. This is made in such a way that it spreads very fast (i think 10 minute contact is sufficient ) Then it attacks almost all the muscles of body, including lungs, skin stomach, intestine etc..since virus still have no direct cure, medicines have to be given based on where it has attacked which require multi-specialty hospital which are less in number and very costly. Regarding vaccine, my father got a single dose (indian made oxford astrazeneca) but he still got this thing. By god's grace, only mild lung infection (about 5%) was there and lots of weakness. Now recovered. They say right now there is a new variant which is spreading very fast and is genetically different than the one vaccine is designed for. There is a third variant also, which is about 1000 times more contagious and lethal..We do not have pfizer vaccine here, due to legal battle between pharma company and government besides it has to be stored in -70C. As it stands now, 80% get cured at home but with weakness for about a month.... Right now, prevention seems to be the only cure..and i don't know whether economy is more important of human life is. From this entire episode, the only takeaway was that if people were proactive, this would not have escalated to such proportions...Right now we have "micro-lockdowns" and work from home. Not sure what will happen when these restrictions are removed.
@cqhamchik
@cqhamchik 2 роки тому
Dishka the best!
@AndreasSpiess
@AndreasSpiess 2 роки тому
:-)
@ElecDashTronDotOrg
@ElecDashTronDotOrg 2 роки тому
ESP-NOW already has built in encryption without the need for an external lib
@AndreasSpiess
@AndreasSpiess 2 роки тому
Other viewers also mentioned it. But so far I did not see examples in the Arduino IDE
@ElecDashTronDotOrg
@ElecDashTronDotOrg 2 роки тому
@@AndreasSpiess docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/network/esp_now.html look under the security section. These docs are for espidf but the same functions exist in the Arduino sdk
@AdityaMehendale
@AdityaMehendale 2 роки тому
Hi Andreas, Are you affected in CH from the import-restriction starting as of 1 July? Do you have any tips for "stockpiling" of handy and non-perishable goods before the restrictions begin? To be clear - I am all for the 21% sales-tax. It is the $25 "handling charges" that the couriers charge that peeves me..
@AndreasSpiess
@AndreasSpiess 2 роки тому
So far I do not know if anything changes here. The handling fee is also what I think is even not "legal". To charge us to collect taxes is not a good idea, I think. This is not the case for all other taxes.
@calvinbrowne2126
@calvinbrowne2126 2 роки тому
I'd limit the greater than window to, say less than 100. Otherwise, an easy attack is to just use the highest number? And on a successful match, a sync as well maybe.
@AndreasSpiess
@AndreasSpiess 2 роки тому
You are right. This would be a simple but useful change.
@MrFireBath
@MrFireBath 2 роки тому
Please work on that code sent > code last received. If I send you the max number from longint I will always be right. Set a limit the new code should be higher than the old code but not too much (an interval of 100 codes should be ok)
@zeero4ever
@zeero4ever 2 роки тому
You would still have to know the correct encryption key.
@madejp
@madejp 2 роки тому
The idea is, that attacker can't encrypt message because hi don't now key. Hi can only copy a message, so hi can't change any value.
@userou-ig1ze
@userou-ig1ze 2 роки тому
@@zeero4ever it depends how the code is validated. If it only checks whether the integer has increased, you can bruteforce randomly, at minimum, increasing the counter (which at some point will overflow or start at 0 again)
@AndreasSpiess
@AndreasSpiess 2 роки тому
I agree, a number window would be a simple and good addition. But I can assure you to create a number without knowing the key is not simple at all...
@firstlast1661
@firstlast1661 2 роки тому
It seems to me that if you are sending ONLY a number then @user above is right and you must limit the number of acceptable messages (to 100 for example), otherwise almost any message would be decrypted to a valid message. If you are sending something like "hello world" + number and validating that the decrypted message includes "hello world" then the possible values for the cryptotext is much larger than the set of acceptable messages, and brute forcing is less feasible.
@gareth4168
@gareth4168 2 роки тому
This is primarily an authentication (and message integrity) problem, not a confidentiality protection problem. Using MACing (message authentication based on symmetric crypto) or signing (the same but for asymmetric crypto) is a better fit for this application than encrypting with AES-CBC. Something like HMAC-SHA with a preshared key would be a good candidate. Also, it is necessary to protect the integrity of the message - i.e. to prove that the decrypted plaintext is a valid message which has not been generated or modified by an attacker. As others here have noted, a bidirectional scheme providing mutual authentication is preferable and such a scheme could be designed based on HMAC or similar.
@AndreasSpiess
@AndreasSpiess 2 роки тому
I agree, it would be preferable to use the two way communication possibility. When I started the project I wanted to keep it open for other communications like 433MHz (which usually is one way).
@florianbogeschdorfer3438
@florianbogeschdorfer3438 2 роки тому
Couldn't we use the built in encryption for ESP NOW? Although I havent found a library that would support that yet.
@AndreasSpiess
@AndreasSpiess 2 роки тому
I do not know of a built-in encryption. Anyway, I wanted something which could also be used with 433MHz communication for example.
@emmoemminghaus6455
@emmoemminghaus6455 2 роки тому
@Andreas Spiess Good Video... You did not mention the AES feature of ESP-Now, did you play with it? I did, aftermassive problems with interoperability for ESP8266 and ESP32 (Might be a NON-OS and RTOS Problem) i found out that there is no flag indicating a packet was crypted on the receiving end. First i was exciteted not to use an external AES library, but cryptography in ESP-Now is BS³[TM] and everything else than secure. At the end i have to implement separate calls to the AES subsystem im my ESPHome Module for ESP-Now. Might be i also remove the restriction in ESP Now that muilticasts can not be crypted.
@AndreasSpiess
@AndreasSpiess 2 роки тому
I even did not know it has an AES subsystem. Thanks for the info. BTW in a former project I also had issues between the two ESPs because of different representations of variables in the ESP8266 and the ESP32.
@emmoemminghaus6455
@emmoemminghaus6455 2 роки тому
@@AndreasSpiess huh, what kind of different representations? Might be this is the problem i have with the interoperability in my implementation.
@AndreasSpiess
@AndreasSpiess 2 роки тому
I do no more remember the details :-( If you use Strings it should work.
@emmoemminghaus6455
@emmoemminghaus6455 2 роки тому
@@AndreasSpiess Thanks... will make a test with "only" String Payload...
@Daniel-ri2ys
@Daniel-ri2ys 2 роки тому
Hi Andreas, did you already play with flash encryption on an ESP32? I could get the example from espressif working, but not my own code.... When I try to convert the INO sketch to a CPP file then it works, but later the CMakeLists.txt file is missing.
@AndreasSpiess
@AndreasSpiess 2 роки тому
No. I had no need for it because my work is open-source.
@jaygee6447
@jaygee6447 2 роки тому
What about a multi step entry? Transmitter > receiver, if there’s a confirmed connection the transmitter sends a different set of keys, therefore the only way to milk is if the transmitter is next to the door (if someone had your key and were next to the door you’d be done anyway!)
@AndreasSpiess
@AndreasSpiess 2 роки тому
You are right. You get lots of new possibilities if we use a back channel to transmit data from the lock to the key.
@galagomara3611
@galagomara3611 2 роки тому
What if we use https to exchange data between sender and receiver? will this be more secure?
@galagomara3611
@galagomara3611 2 роки тому
I see......https uses wifi. It is not the case here :). Thank you for this informative video.
@danielforrest3871
@danielforrest3871 2 роки тому
What Harley do you ride? Any chance for some cool james bond upgrades?
@AndreasSpiess
@AndreasSpiess 2 роки тому
I have a standard Breakout with loud pipes. Because they save lives;-)
@WooShell
@WooShell 2 роки тому
I've tried something similar before (just without encryption etc), but the ESP's wifi has a hard time to get through the steel garage door and metal coated (sun protection) car windows :-( I'm waiting for my ESP with external antenna connector to arrive so I can try again.
@AndreasSpiess
@AndreasSpiess 2 роки тому
I can imagine that a steel door does not help ;-) Let's hope it works with the antenna. Otherwise maybe you can change the location of the receiver.
@ariedel
@ariedel 3 роки тому
Italian subtitles were good enough for an Dane living in Switzerland && Feedback from New Delhi was that Hindi subtitles were fine as well.
@AndreasSpiess
@AndreasSpiess 2 роки тому
Thank you for the feedback. So, I will continue and see after a few months if some new viewers discovered that they could watch the videos... The current viewers probably do not need them.
@us1ni
@us1ni 2 роки тому
@@AndreasSpiess Thanks for the french subtitles! I know a lot of people who have difficulty with english, so it will probably give you some new viewers.
@figueroalabs
@figueroalabs 2 роки тому
Instead of a counter, I use (with CircuitPython) the TOTP library.
@AndreasSpiess
@AndreasSpiess 2 роки тому
Does this need synchronized clocks on both sides?
@figueroalabs
@figueroalabs 2 роки тому
@@AndreasSpiess Yes, in the case of the devices I use, they request NTP at boot.
@AndreasSpiess
@AndreasSpiess 2 роки тому
I used ESP_Now because I wanted to be independent of Wi-Fi. With Wi-Fi you could use it, of course.
@andrekroth
@andrekroth 2 роки тому
fun fact: i have the same idea for the tt-go smartwatch. much love from germany to austria.
@zeero4ever
@zeero4ever 2 роки тому
you mean switzerland ;-)
@AndreasSpiess
@AndreasSpiess 2 роки тому
Now you have a head-start...
@oskimac
@oskimac 2 роки тому
actually i am just looping the last 17 seconds (using Looper for UKposts)
@AndreasSpiess
@AndreasSpiess 2 роки тому
:-)
@RupertBruce
@RupertBruce 2 роки тому
It seems to me that you are using AES as a known-seed hash. I'd just use a good hash function... Beautiful cat!
@RupertBruce
@RupertBruce 2 роки тому
On second thought, the added key to the hash function adds a hidden layer of security... Carry on 😎
@AndreasSpiess
@AndreasSpiess 2 роки тому
I am not security specialist. So I took what was available ;-) And the CPUs are fast enough...
@craigs5212
@craigs5212 2 роки тому
Got a similar problem: How to store a shared key in the browser accessing my esp32 server such that only the devices with the key have access. Upon Access the server takes it shared secret key, hashes it with a random blob to make a session key. The server also sends the blob to the client browser. The client browser hashes the blob with its copy of the secret key creating the same session key which is attached to each transaction. The server verifies the session key and all is good. Don't need to encrypt data just need to restrict access to specific machines. So how does one store the secret key on the client PC in a non domain environment.? First thought was to use MAC address but seems the browser does not have access to that.
@AndreasSpiess
@AndreasSpiess 2 роки тому
1. If you allow two way communication you get a lot of additional possibilities, you are right. 2. I am no specialist. But maybe they use these famous cookies to store something specific? Not a key, but maybe something else. For encryption they usually use the certificates.
Rutgers University Confirmed: Meshtastic and LoRa are dangerous
13:27
Andreas Spiess
Переглядів 695 тис.
Блоховирус !🦠 #симба #тигра #булли
00:57
Симбочка Пимпочка
Переглядів 7 млн
Эксперимент во Вьетнаме. Истоки зависимости
00:47
ДЖЕЙХУН САФАРОВ і ЛЕВИ НА ДЖИПІ в ДЗК на ВИЖИВАННЯ
1:15:40
Use the very attractive new ATTINY chips for your projects
14:34
Andreas Spiess
Переглядів 186 тис.
Pouring liquid nitrogen gone wrong
3:09
NileRed Extra
Переглядів 170 тис.
Radar Sensors from $3 to over $100: Which one is Best?
14:31
Andreas Spiess
Переглядів 143 тис.
How does NB-IOT and CAT-M1 / LTE-M compare to LoRaWAN (Tutorial)?
21:58
Andreas Spiess
Переглядів 52 тис.
How America RUINED the world's screws! (Robertson vs. Phillips)
9:46
Stumpy Nubs
Переглядів 239 тис.
Upgrade your Raspberry Pi to a Homelab (instead of a Raspberry Pi 5)
16:54
Andreas Spiess
Переглядів 236 тис.
Are Home Battery Installs BANNED In The UK?
14:31
Artisan Electrics
Переглядів 28 тис.
Fantasy Moon girl photo adjust colour background pc 7/20/pm
0:44
Amir TECh
Переглядів 166 тис.
iPhone 19?
0:16
ARGEN
Переглядів 3 млн