Cov txheej txheem:

Arduino TOTP Generator: 3 Cov Kauj Ruam
Arduino TOTP Generator: 3 Cov Kauj Ruam

Video: Arduino TOTP Generator: 3 Cov Kauj Ruam

Video: Arduino TOTP Generator: 3 Cov Kauj Ruam
Video: OTP Authenticators with NFC, Voice-Enabled 2FA, & TOTP/HOTP Function in Security Keys 2024, Kaum ib hlis
Anonim
Arduino TOTP Generator
Arduino TOTP Generator
Arduino TOTP Generator
Arduino TOTP Generator
Arduino TOTP Generator
Arduino TOTP Generator

Kev tshoov siab

Muaj ib tus phooj ywg nrog kev txaus siab hauv cryptography thiab kev nyab xeeb, Kuv xav tsim lub hnub yug zoo tshaj plaws tam sim no.

*Nov yog qhov haujlwm kuv tau ua hnub yug hnub no thiab tau tsim nyob rau hauv lub sijhawm txwv nruj (zam txim rau qhov ua tsis tau zoo)

NCO TSEG: Lub TOTP tiam uas tau siv hauv txoj haujlwm no tsim thiab siv 6 tus lej lej, tab sis vim yog kuv cov cuab yeej siv tam sim no, kuv tau xaiv txiav cov kab tom ntej 2 tus lej thiab tso saib thiab siv 4, sib cav (tab sis tsis zoo heev) txo qhov kev ruaj ntseg.

Cov Ntaub Ntawv Dav Dav

Txoj haujlwm no tsim cov cai tshiab txhua txhua 30 vib nas this siv tus yuam sij preshared thiab lub sijhawm tam sim no (uas tau khaws cia taug qab ntawm kev siv lub sijhawm ntsuas lub sijhawm tiag tiag) thiab nthuav tawm nws ntawm cov zaub thaum lub pob nyem. Cov ntaub ntawv siv feem ntau yuav yog ob qhov pov thawj raws li Lub Sijhawm Raws Li Ib Lub Sij Hawm Lo Lus (TOTP) thiab HMAC-based Ib Lub Sij Hawm Password (HOTP) rau kev lees paub tseeb.

TOTP yog txheej txheem txheej txheem uas suav nrog tus lej nkag mus ib zaug los ntawm kev qhia tus lej zais thiab lub sijhawm tam sim no. HTOP yog txheej txheem txheej txheem uas siv HMAC cov txheej txheem los tsim tus lej ib zaug.

Cov tuam txhab xws li Google, Microsoft, thiab Steam twb tau siv TOTP thev naus laus zis rau lawv ob qhov kev txheeb xyuas qhov tseeb

Nthuav nthuav Links

Kab lus piav qhia yuav ua li cas Google siv cov thev naus laus zis no los txheeb xyuas cov neeg siv-https://medium.com/@tilaklodha/google-authenticator-and-how-it-works-2933a4ece8c2

Kev siv JavaScript ntawm HOTP thiab TOTP uas yuav siv tau thaum tsim software siv txoj haujlwm no -

Crytographic library rau Arduino siv hauv txoj haujlwm no -

TOTP Ntawv -

Qib Kev Kws Paub

Cov Lus Qhia no yog rau cov neeg txaus siab uas txaus siab rau kev nyab xeeb thiab tej zaum yuav xav siv cov khoom siv kho vajtse zoo rau tiam ntawm lawv cov TOTP. Cov lus qhia no tau sau rau cov neeg tuaj saib uas twb nkag siab qhov pib ntawm kev txhais cov kab kos hluav taws xob thiab cov txheej txheem rudimentary, tab sis yog tias koj npaj rau qhov yooj yim ua raws li Cov Lus Qhia no raws nraim, tsis txhob txhawj xeeb yog tias koj tsis muaj kev paub dhau los, thiab xav tias dawb nug cov lus nug hauv lus! Tsis tas li ntawd, txoj haujlwm tuaj yeem nthuav rau cov tsim kev paub dhau los ib yam vim tias cov khoom kawg tsis yog tsuas yog ib qho zoo kom muaj nyob ib puag ncig (hauv kuv lub tswv yim), tab sis muaj peev xwm ntau rau kev nthuav dav thiab cov yam ntxwv tshiab yam tsis muaj teeb meem ntau.

Khoom siv

Cov ntaub ntawv:

  1. 1 x Arduino Nano (Amazon)
  2. 1x DS3231 AT24C32 Lub Sijhawm Tiag (RTC) Module (Amazon)
  3. 1x SH5461AS Common Cathode 4 tus lej 7-ntu (Amazon)
  4. 1x Pushbutton (Amazon)
  5. 1x 10k Resistor (Amazon)
  6. Yeem xaiv 1x 5x7cm PCB (Amazon)
  7. YUAV TSUM MUAJ Hlau rau soldering rau PCB
  8. XAUS 1 x Breadboard rau ntsuas (Amazon)

Kauj Ruam 1: Sib dhos thiab Xeem

Sib dhos thiab Xeem
Sib dhos thiab Xeem
Sib dhos thiab Xeem
Sib dhos thiab Xeem
Sib dhos thiab Xeem
Sib dhos thiab Xeem

Sib sau ua ke tag nrho cov khoom siv ntawm lub khob cij thiab xaim lawv raws li daim kab xev txuas nrog (Cov ntaub ntawv Fritzing nyob ntawm no).

Nco ntsoov tias koj tau teeb tsa Arduino IDE (nws tuaj yeem pom online yog tias koj tsis ua) thiab teeb tsa cov tsev qiv ntawv hauv qab no:

github.com/lucadentella/TOTP-Arduino

github.com/adafruit/RTClib

github.com/maniacbug/Cryptosuite

Rub tawm daim duab txuas (kuj tseem tuaj yeem nkag tau ntawm no: https://gist.github.com/shiv213/569f01a54988cb0207966be9a65cc5ab), thiab qhib nws siv Arduino IDE. Qhib qhov txuas no (https://www.lucadentella.it/OTP/) thiab sau ib lub npe hauv tus as khauj lub npe, thiab tus yuam sij zais cia (10 tus cim ntev) hauv daim teb hauv qab no, ua kom ntseeg tau khaws ob qho ntawm cov txiaj ntsig ntawd hauv qhov chaw nyab xeeb rau thaub qab. Luam cov ntsiab lus ntawm "Arduino HEX array:" teb, thiab hloov rov qab mus rau Arduino editor, hloov cov kab ntawm kab 25 (hmacKey) nrog qhov koj tau theej los ntawm lub xaib.

Tom qab kuaj xyuas txhua qhov txuas xov hlau, xyuas kom tseeb tias RTC module muaj cov npib ntawm tes hauv nws, thiab txuas Arduino rau koj lub khoos phis tawj siv lub USB mini qaum, thiab xa daim duab txuas nrog.

Tom qab rub tawm, thaum lub pob nyem, tus lej yuav tsum tshwm ntawm qhov screen. Yog tias koj rub tawm Google Daim Ntawv Pov Thawj Ua Haujlwm ntawm lub xov tooj ntawm tes thiab rov qab mus rau qhov chaw siv los tsim HEX array, luam theej tawm QR code lossis ntaus "Google Tus Kheej Tus Kheej Tus Kheej" rau hauv app, koj yuav tsum pom tus lej pom hauv lub app. Yog tias txhua yam ua haujlwm tau raug, thaum koj nias lub pob, 4 tus lej uas tso tawm yuav tsum phim thawj 4 ntawm tus lej tam sim no uas pom ntawm lub smartphone app. Yog tias qhov no tsis yog, nco ntsoov tias lub khoos phis tawj siv los tso cov lej Arduino tau teeb tsa rau UTC sijhawm thiab sim dua.

Kauj Ruam 2: Hloov mus rau PCB

Hloov mus rau PCB
Hloov mus rau PCB
Hloov mus rau PCB
Hloov mus rau PCB

Tom qab ua kom ntseeg tau tias txhua yam tau ua tiav, koj tuaj yeem xa cov khoom sib txuas mus rau PCB thiab sib dhos txhua yam ua ke txawm li cas los koj zoo li haum. Kuv tau txuas daim duab PCB ntxiv rau Fritzing cov ntaub ntawv (muaj nyob ntawm no). Nco ntsoov tias kuv tau muab txhua yam khoom tso rau saum lub rooj tsav xwm kom zoo nkauj, tab sis kuj tseem tuaj yeem teeb tsa hauv qab thiab tom qab ntawd muab ntim rau hauv qee yam ntawm cov vaj tsev kom ua kom huv dua. Kuv txiav thiab kub glued popsicle sticks xim nrog Sharpie mus rau ob sab ntawm PCB los tsim lub thawv me me rau chav nyob. Lwm txoj hauv kev xaiv yog txhawm rau txuas lub roj teeb 9-volt rau VIN thiab GND pins ntawm Arduino, ua rau nws ua haujlwm roj teeb.

Kauj ruam 3: Tiav lawm

Tiav lawm!
Tiav lawm!
Tiav lawm!
Tiav lawm!
Tiav lawm!
Tiav lawm!

Nov yog qhov kuv ua tiav lub tshuab hluav taws xob hloov tawm, yog tias koj ua raws thiab ua rau koj tus kheej, qhia nws hauv qab no!

Nco ntsoov pov npav Kuv Cov Lus Qhia rau kev sib tw STEM yog tias koj pom zoo, thiab tawm lus tawm/lus nug koj yuav muaj hauv qab no!

Pom zoo: