How to generate and use a SSL certificate in NodeJS

SdĂ­let
VloĆŸit
  • čas pƙidĂĄn 28. 08. 2020
  • In this video you will learn how to generate a #SSL/#TLS certificates
    for development purposes. You will also learn how to use them in a #nodejs #express application.
    🚀 Deploy NodeJs app: zeet.co/r/yourstruly
    (One FREE project forever 😘)
    ⭐ Kite is a free AI-powered coding assistant that will help you code faster and smarter. The Kite plugin integrates with all the top editors and IDEs to give you smart completions and documentation while you’re typing. I've been using Kite for 6 months and I love it! www.kite.com/get-kite/?...
    FREE $100 credit @Digital Ocean: m.do.co/c/3208f08b3324
    Subscribe: czcams.com/users/yourstruly2...
    Support the channel:
    Paypal: www.paypal.me/trulymittal
    Patreon: / trulymittal
    Github (full-tutorial): github.com/trulymittal/ssl-se...
    ---------------
    Other useful Playlists
    ---------------
    #RestAPI (#NodeJS and MongoDB): ‱ REST API using NodeJS ...
    #API Authentication using #JWT: ‱ NodeJS API Authenticat...
    #Firebase: ‱ Firebase | Build a Not...
    Docker: ‱ Docker
    MongoDB: ‱ Learn MongoDB in 50 mi...
    Html/Css/Js: ‱ HTML / CSS / JS
    Android: ‱ Android
    Challenges: ‱ Challenges
    ---------------
    What I use
    ---------------
    Mouse: amzn.to/2O9RJtu
    Keyboard: amzn.to/2qxajCU
    Keyboard 2: amzn.to/2XDWH4X
    Monitor: amzn.to/2pDg7dH
    Processor: amzn.to/347WWIb
    RAM: amzn.to/2QEkUqw
    Graphics: amzn.to/33aBrF4
    Microphone: amzn.to/2DabdI9
    #StayHome #WithMe #yoursTRULY #tutorial #howto #android

Komentáƙe • 165

  • @petrhybler1618
    @petrhybler1618 Pƙed 3 lety +5

    best tutorial ever !!!! simple, straightforward, and foremost -> working!!! thx boss

  • @cheriecheung4164
    @cheriecheung4164 Pƙed 3 lety +13

    you're a great teacher!! very clear instruction

  • @Cricket_TURF
    @Cricket_TURF Pƙed 2 lety +4

    The Best ever knowledgeable Nodejs Advanced series i have found to expand my knowlage , Thanks !

  • @ammulutrips4657
    @ammulutrips4657 Pƙed 2 lety +2

    This is very very helpful. Your way of teaching is awesome!! Please make some more videos on Node js. Thanks a lot

  • @balotz4
    @balotz4 Pƙed 11 měsĂ­ci +1

    Thank you so much, watching your video helped me understand how the certificate works.

  • @PriyankRupareliya
    @PriyankRupareliya Pƙed 3 lety +2

    Truly helpful. Thank you for such value !

  • @dawid_dahl
    @dawid_dahl Pƙed 3 lety +4

    Perfect, thank you! đŸ–€

  • @StreamOfArunan
    @StreamOfArunan Pƙed 2 lety +2

    Great tutorial! Short and Clear.

  • @barakerzeonlist4608
    @barakerzeonlist4608 Pƙed 3 lety +2

    I love the way you explain it keep it up😍😍

  • @HW-Kanal
    @HW-Kanal Pƙed 3 lety +2

    It was a great help to me, thank you

  • @kennyanthony4319
    @kennyanthony4319 Pƙed rokem

    Yes!!! Thank you so much! Explained beautifully! Liked the video! :)

  • @rafanteapps1888
    @rafanteapps1888 Pƙed 3 lety +1

    Thank you so much! Solved my problem

  • @uttkarshsingh3771
    @uttkarshsingh3771 Pƙed 3 lety +1

    loved your content bro

  • @arunkutz
    @arunkutz Pƙed 3 lety +1

    Thanks for the video . Very helpful.

  • @prageethbhanuka7882
    @prageethbhanuka7882 Pƙed 2 lety

    Thanks a lot! This saved me in an assignment!

  • @asdf14051
    @asdf14051 Pƙed 2 lety

    The only one that could explain it properly!

  • @ananasjuice7059
    @ananasjuice7059 Pƙed 2 lety

    Thank you so much! Reaally well explaind an all.. love

  • @Gil-Porsansky-Archive
    @Gil-Porsansky-Archive Pƙed 3 lety +1

    thank you for the video !

  • @LePhenixGD
    @LePhenixGD Pƙed 2 lety +1

    Great tutorial!

  • @ammulutrips4657
    @ammulutrips4657 Pƙed 2 lety

    Simple,Crisp and clear

  • @mohitagrawal1555
    @mohitagrawal1555 Pƙed 2 lety +1

    thank bro. I am stuck in this problem and can't able to find the way out but u solve it in once .

  • @ParuldotJain
    @ParuldotJain Pƙed 3 měsĂ­ci

    Best video on ssl. Thanks a lot .

  • @whoaboutyt
    @whoaboutyt Pƙed 2 lety +1

    That keyboard . That coding. Omg thx 😃

  • @algodal433
    @algodal433 Pƙed rokem

    This is a very good video. Thank you for sharing.

  • @sonhoangngoc7809
    @sonhoangngoc7809 Pƙed 2 lety +1

    thank you!

  • @PenedoTorneios
    @PenedoTorneios Pƙed 3 lety +1

    TOP!! thank you

  • @joelchacon9278
    @joelchacon9278 Pƙed 2 lety

    good stuff brother!

  • @AshishSharma-tc2el
    @AshishSharma-tc2el Pƙed 3 lety +6

    Make more content on node js â€ïžđŸ”„

  • @vunguyenvan1860
    @vunguyenvan1860 Pƙed 2 lety +1

    thanks for your video, it''s help me so much !

  • @ashtechcoder989
    @ashtechcoder989 Pƙed 3 lety +3

    Amazing content brođŸ˜đŸ”„

  • @electrolyteorb
    @electrolyteorb Pƙed 2 lety +1

    Very precise and clear explanation

  • @deepakverma-uo7pf
    @deepakverma-uo7pf Pƙed 3 lety +2

    nice sir, you are really jental man and my coach
    thank u sir 👍

  • @onion_____
    @onion_____ Pƙed 3 lety +2

    You're a legend tbh. When will you be doing some typescript stuff

  • @mouhannadal-hmedi1501
    @mouhannadal-hmedi1501 Pƙed 8 měsĂ­ci

    thanks a lot!

  • @oswberta
    @oswberta Pƙed rokem +1

    Excellent... realy realy thank you. It's great.

  • @apurvamande7832
    @apurvamande7832 Pƙed 3 lety +1

    Perfect explanation. Thank you :) Can we make this certificate as trusted certificate.

  • @mohamedyahyacheikhmaazouz1650
    @mohamedyahyacheikhmaazouz1650 Pƙed 9 měsĂ­ci

    thank you 🙂

  • @abdulkadirguven1173
    @abdulkadirguven1173 Pƙed 2 lety

    Thank you very much

  • @rapace1370
    @rapace1370 Pƙed 3 lety +4

    Great video! Can I ask you which VSCode theme / Color Scheme / Font do you use? The code is so readable and beautiful

  • @samanthaletourneau9709
    @samanthaletourneau9709 Pƙed 3 lety +1

    Thank you !!! =D

  • @chinmaydeshpande5046
    @chinmaydeshpande5046 Pƙed rokem +1

    thanks bro

  • @geoffroyulrichkouadio3982
    @geoffroyulrichkouadio3982 Pƙed 3 lety +1

    thank you .

  • @JNET_Reloaded
    @JNET_Reloaded Pƙed 2 lety

    amazing thanks :D

  • @parris3142
    @parris3142 Pƙed rokem +1

    well explained

  • @mustafakosmaz7509
    @mustafakosmaz7509 Pƙed rokem +1

    you're a man! thanks

  • @user-tv9gk8df1u
    @user-tv9gk8df1u Pƙed 2 lety

    Thanks alot

  • @grandbudha6251
    @grandbudha6251 Pƙed 3 lety +1

    PERFECT....

  • @notem1nomedisponivel
    @notem1nomedisponivel Pƙed rokem +1

    Thank you so much, works for me. 1000 likes for you

  • @hardikraval1585
    @hardikraval1585 Pƙed 2 lety +1

    Can I ask you which VSCode theme / Color Scheme / Font do you use?

  • @rahulsuthar4966
    @rahulsuthar4966 Pƙed rokem +1

    how did you change your terminal font and color

  • @macros3798
    @macros3798 Pƙed 3 lety +1

    Thank u bro your so good

  • @muditsinghverma
    @muditsinghverma Pƙed 2 lety +1

    Great Tutorial..
    SSL certificates expire after a certain time period like 90 days for Let's Encrypt and generate fresh certificates using AutoSSL or upon renewal. Updating the options variable and restarting the server is a pain in such case. How to update the Node.js app to automatically retrieve valid certificate files from given directories, removing needs to replace hard-coded paths and reboot.

  • @yousufzubair1417
    @yousufzubair1417 Pƙed rokem

    after finding 100s of solution only this one works fine

  • @Zeddted
    @Zeddted Pƙed rokem

    Can this procedure be used for production purposes

  • @Zeddted
    @Zeddted Pƙed rokem

    Can this same method be used for development purposes

  • @juliasetiawan9784
    @juliasetiawan9784 Pƙed rokem

    how do you do this in Next JS, at getServersideProps environment? I believe the server is in node JS

  • @rajpatel9406
    @rajpatel9406 Pƙed 3 lety +1

    Hey man just watched your video and subscribed it,but how do we install openssl on windows 10 for keys and certificates you did looking for your answers

    • @mafiacodes
      @mafiacodes  Pƙed 3 lety

      This would be helpful stackoverflow.com/questions/50625283/how-to-install-openssl-in-windows-10

    • @rajpatel9406
      @rajpatel9406 Pƙed 3 lety +1

      Thanks truly helpful

  • @mangmang9986
    @mangmang9986 Pƙed rokem

    I followed the tutorial an it successfull on the backend but I also need https on the frontend that build with react too

  • @pooriagohari4469
    @pooriagohari4469 Pƙed 3 lety +1

    You helped me
    I ask God to help you bro

  • @xiangxiang5833
    @xiangxiang5833 Pƙed 2 lety +1

    How to download openssl? I cant use the command openssl

  • @daxxramas7974
    @daxxramas7974 Pƙed 2 lety +1

    Hello sir, I am working on a school project for an Android application. For the backend side of things, I created an express rest api (it does not serve any Web page). I am looking for a way to secure communications between m'y Android app and my express server with an ssl certificate. Would self signed certificates be a problem for this use case ? Since I do not need to access the api through a Web browser, i'm guessing i Would never see this browser warning for invalid certificate right ? Do i need to apply further workaround for communication between my Android app and the server, or between postman and the server ?
    I have not tried your method as of yet, but thank you for your clear explanation, it seems so simple and straight forward thanks to you. Cheers

    • @mafiacodes
      @mafiacodes  Pƙed 2 lety

      It won’t be a problem you can use the method as described in this video

    • @daxxramas7974
      @daxxramas7974 Pƙed 2 lety

      @@mafiacodes thanks a lot i will give it a try tonight

  • @raselhossain8855
    @raselhossain8855 Pƙed rokem

    Why ssl is need for nodejs development server?

  • @tushaar9027
    @tushaar9027 Pƙed 3 lety

    Hi video good ,but can expalin cert generation using letsencrypt

  • @blunygeorge
    @blunygeorge Pƙed 2 lety

    Is there a disadvantage of using this local certificate other than the browser not trusting it?
    For context:
    Let's say there is a website that would be only be used by a small number of people and they know what is going on the server side and so they have no problem trusting that certificate. In this case, it would be fine to use that right? Now that I wrote this down I remembered that somehow custom certificates can be added to the browser to be trusted, to handle that as an exception of unknown authors. I think there is something like that.

    • @mafiacodes
      @mafiacodes  Pƙed 2 lety +1

      It is a absolutely 100% fine using this certificate for the use case you defined. And as far as trusting goes may be u can add this as a trusted certificate as u mentioned but I am unaware of it.

  • @dronesgranada
    @dronesgranada Pƙed 3 lety

    You saved my ass!

  • @Virus-ke8xj
    @Virus-ke8xj Pƙed 3 lety

    The value "/cert.pem" is invalid for option "encoding",
    what do I do in this case, PLEASE HELP ME!!!

    • @mafiacodes
      @mafiacodes  Pƙed 3 lety

      Follow the steps again, probably u r using the wrong certificate, if still gives error revert back

  • @rajeevchris4920
    @rajeevchris4920 Pƙed 3 lety +1

    hi yesterday i asked a doubt about shopping cart project i rectified it and it tried to change the image of the iphone to another image it executed but it did not display any change and the area was blank so can you tell me want is the criteria for and image what format should it use and how much size it should be thanks for answering yesterday and now in advace :) if want more details i will contact you through email :)

    • @mafiacodes
      @mafiacodes  Pƙed 3 lety

      What is the context of ur question - I don’t get it bro

    • @rajeevchris4920
      @rajeevchris4920 Pƙed 3 lety

      @@mafiacodes i tried to change the image of the iphone in the shopping crt project so i copied a link from goolge and pasted it in the requied place but after running the application the area was blak why it is blank

    • @mafiacodes
      @mafiacodes  Pƙed 3 lety

      Coz the link might not refer to the image - share the link of image which ur using

    • @rajeevchris4920
      @rajeevchris4920 Pƙed 3 lety

      @@mafiacodes mittal please answer images.app.goo.gl/3ur8QkdGY81uzHzx5 this is the link mittal please answer

  • @yousufkalim
    @yousufkalim Pƙed 3 lety

    Dude which font are you using?

  • @rajataggarwal4780
    @rajataggarwal4780 Pƙed 3 lety +1

    The file key.pem contains both public as well as the private key or only the private key?

    • @mafiacodes
      @mafiacodes  Pƙed 3 lety

      private key only @ 5:34

    • @rajataggarwal4780
      @rajataggarwal4780 Pƙed 3 lety

      @@mafiacodes Ok thanks. Where can I find corresponding public key?

    • @mafiacodes
      @mafiacodes  Pƙed 3 lety

      U need to generate one

    • @rajataggarwal4780
      @rajataggarwal4780 Pƙed 3 lety

      @@mafiacodes key.pem contains a key pair. Refrence: stackoverflow.com/questions/44474516/how-to-create-public-and-private-key-with-openssl

    • @mafiacodes
      @mafiacodes  Pƙed 3 lety +1

      Refer this article for more detailed explanation of what’s going on www.devco.net/archives/2006/02/13/public_-_private_key_encryption_using_openssl.php

  • @sushilrai2290
    @sushilrai2290 Pƙed 3 lety

    will this work on aws ec2 instance ?

  • @muditjain7994
    @muditjain7994 Pƙed 3 lety

    Did everything as you said, but getting certificate invalid in my browser. Found the error due to self signed certificate. How to add ca signed certificate?

    • @mafiacodes
      @mafiacodes  Pƙed 3 lety

      you need to have a valid domain, use that domain to get a free certificate for a CA, like let's encrypt for free certificates or any other paid CA.

    • @muditjain7994
      @muditjain7994 Pƙed 3 lety

      @@mafiacodes bro localhost pe project bnaya hai aur hame bol rhe hain ki http ko https me transform kro.. Without domain kaise krein

  • @HW-Kanal
    @HW-Kanal Pƙed 3 lety

    If I use websocket now, is this also safe?

  • @ThriveniPrasadBlogsandVlogs

    Hi I need help I have downloaded certificate and key from GoDaddy but I don't have how to integrate it in nodejs

    • @mafiacodes
      @mafiacodes  Pƙed 3 lety

      U can use those cert files the same way we have used our own generated files...just simple replace it with ur own downloaded files...

    • @ThriveniPrasadBlogsandVlogs
      @ThriveniPrasadBlogsandVlogs Pƙed 3 lety

      @@mafiacodes but I got the certificates like 2 security certificates,1pem file,1key file and 1more request certificate file I have confusion in this which one need use place of cert please any solution you have share me

    • @mafiacodes
      @mafiacodes  Pƙed 3 lety

      Certificate is most likely the pem file, private key is the key file and other file is just a certificate signing request, so use the pem as certificate and key as private key. Do let me know if all works fine.

  • @anaskhalilkhalilahmed3586

    sir this is not a valid certificate i works on service workers which only works in https context i do a same as u do but same the errors comes https requires for service workers so sir how to install a valid ssl certificate for node js local development purpose

    • @mafiacodes
      @mafiacodes  Pƙed 3 lety

      It’s 💯% valid certificate, it’s only that chrome or other browser does not recognise the certificate authority. You can use it for Dev purposes.

  • @vityamv
    @vityamv Pƙed 3 lety

    how do you manage to write openssl in visual studio code terminal?

    • @mafiacodes
      @mafiacodes  Pƙed 3 lety

      It’s simply a terminal inside vscode, the same terminal which we use without vscode, or I am not able to understand what exactly u mean?

    • @sushilrai2290
      @sushilrai2290 Pƙed 3 lety

      openssl is already installed in mac, u need to install it in win 10 and linux.... is what I heard

    • @Iconejey
      @Iconejey Pƙed 3 lety

      @@sushilrai2290 Most UNIX OSs like MacOS and Linux already have openssl integrated.

    • @mafiacodes
      @mafiacodes  Pƙed 3 lety

      ✅

  • @sambhusbabu
    @sambhusbabu Pƙed 3 lety

    Do you know how the CZcams stream video in different qualities (240p, 360p,...) For android app. Can you help me to build CZcams like video streaming app with video quality control.

    • @MrMedzoo
      @MrMedzoo Pƙed 3 lety +2

      CZcams use Media source API to do this and is quite difficult to implement, instead you use some protocole which do the hard work for you on server side like hls, hds, dash and for the client android have already implement these protocol so you just need to use exoplayer api

    • @mafiacodes
      @mafiacodes  Pƙed 3 lety

      💯

    • @sambhusbabu
      @sambhusbabu Pƙed 3 lety

      @@MrMedzoo thanks

  • @thatonefoxxy
    @thatonefoxxy Pƙed 3 lety +1

    Is it now really encrypted or not?

  • @nirajlonkar
    @nirajlonkar Pƙed 3 lety

    How to deploy this on heroku?

  • @treeworldnight3700
    @treeworldnight3700 Pƙed 11 měsĂ­ci

    How can I write rocket on console.log like thatt^o^?, thanks you

  • @lionetbom8209
    @lionetbom8209 Pƙed 3 lety

    Hello good Morning
    The following error is happening to me with the app started and when trying to access from the web browser
    An error occurred connecting to localhost: 3000. You cannot communicate securely with the other party - there are no common encryption algorithms.
    Error code: SSL_ERROR_NO_CYPHER_OVERLAP

    • @mafiacodes
      @mafiacodes  Pƙed 3 lety +1

      Share code on GitHub

    • @lionetbom8209
      @lionetbom8209 Pƙed 3 lety

      @@mafiacodes Hi, this github.com/sergiopj/photo-translator-backend
      thank you for all!!

    • @mafiacodes
      @mafiacodes  Pƙed 3 lety +1

      Most likely issue with Firefox, seems ur using that?
      Try chrome

    • @lionetbom8209
      @lionetbom8209 Pƙed 3 lety

      @@mafiacodes If the following happens to me with chrome:
      ERR_SSL_VERSION_OR_CIPHER_MISMATCH
      Protocol not supported
      The client and the server do not support the same version of SSL or encryption protocol.
      Thank you for all!

  • @sandboxproto2783
    @sandboxproto2783 Pƙed 2 lety

    yes its invalid ssl across all browsers

  • @damiangilz
    @damiangilz Pƙed 3 lety

    If an error page shows, just click anywhere in the page and you can also type "thisissecure" without the " and the page then loads.

  • @Switch620
    @Switch620 Pƙed 9 měsĂ­ci

    self signed certs suck though!

  • @tambolaking5383
    @tambolaking5383 Pƙed 3 lety

    You get free certificate from aws

    • @mafiacodes
      @mafiacodes  Pƙed 3 lety +1

      Well u can get it from let’s encrypt also BUT the point is u need to provide a domain there, and in development u might not have a domain

  • @thesrinathkamath
    @thesrinathkamath Pƙed 2 lety

    how to listen to ssl renewal and serve automatically?

    • @mafiacodes
      @mafiacodes  Pƙed 2 lety

      This is a manually generated ssl, so u need to do a cron job and then issue the command again

    • @thesrinathkamath
      @thesrinathkamath Pƙed 2 lety

      @@mafiacodes But can't it be handled inside the node-server? with SNICallbacks?
      or TLS

    • @mafiacodes
      @mafiacodes  Pƙed 2 lety +1

      It can be done but since it’s a development certificate so you can generate it for as long as you want even 10years or even more, for a production SSL you should get a certificate from a certificate authority and then definitely you can handle auto renewals using the said callbacks or even create a cron for the same.

    • @thesrinathkamath
      @thesrinathkamath Pƙed 2 lety

      @@mafiacodes Thanx bro!

  • @jampackedjames
    @jampackedjames Pƙed 3 lety

    I followed your instructions and Chrome gave me: Your connection is not private
    NET::ERR_CERT_INVALID

    • @mafiacodes
      @mafiacodes  Pƙed 3 lety

      I think u haven’t watched the full video till the end, since I explained this thing that THIS IS FALSE POSITIVE, since u r a certificate authority and chrome does not know that that’s why ur getting this error but cert is 💯% valid, should be used for developing

    • @subhadipsur7561
      @subhadipsur7561 Pƙed 3 lety

      @@mafiacodes I am also getting this error but not getting response message: "Hello from ssl server". How to fix it?

  • @sinchanaa8093
    @sinchanaa8093 Pƙed 2 měsĂ­ci

    How to generate and use SSL certificate in NodeJS

  • @jeremyh9841
    @jeremyh9841 Pƙed 2 lety

    you should show how to make a certificate from an authority because this example is useless in production

    • @mafiacodes
      @mafiacodes  Pƙed 2 lety

      czcams.com/video/2SzgmTIuHRU/video.html

  • @chayangkoonsuwit
    @chayangkoonsuwit Pƙed rokem

    àž‰àž±àž™àč€àž›àč‡àž™àč„àž—àžą àčàž„àž°àž•àž­àž™àč€àž§àž„àžČàž›àžŁàž°àžĄàžČàž“ 4:00 àž‰àž±àž™àž­àčˆàžČàž™àž„àžłàžšàžŁàžŁàžąàžČàžąàč„àžĄàčˆàž—àž±àž™àč€àž„àžąđŸ˜…

  • @matchstick_art
    @matchstick_art Pƙed 3 lety

    ERR_INVALID_OPT_VALUE_ENCODING

  • @anurag9110
    @anurag9110 Pƙed 3 lety

    too much typing sound.

  • @furkansaryldz8494
    @furkansaryldz8494 Pƙed rokem

    Thanks

  • @CaptainChubbyDuck
    @CaptainChubbyDuck Pƙed rokem

    Hi when Im writing openssl x509 -req -days 365 -in -csr.pem -signkey key.pem -out cert.pem noting happens, the terminal just prints out "Use -help for summary". What am I missing?
    When I did the previous command of req it said it couldnjt find a file openssl.conf
    Can you please help?
    Thanks

    • @StdDev99
      @StdDev99 Pƙed rokem

      Probably because of "-csr.pem" ? The hyphen makes it look like an option and not a value

  • @upbeyond671
    @upbeyond671 Pƙed rokem +1

    Legend

  • @livandy2128
    @livandy2128 Pƙed 2 lety +1

    Thank you very much