Asymmetric Encryption and Decryption in Node.js using RSA Public/Private Key Pairs

Поделиться
HTML-код
  • Опубликовано: 27 окт 2024

Комментарии • 60

  • @SASA_maxillo
    @SASA_maxillo 4 месяца назад +1

    Bro i can't thank you enough, every video is useless except for yours, thank you.

  • @MonicaloveNiallHoran
    @MonicaloveNiallHoran 2 года назад

    Thank you! your video helped me to implement a pair of RSA keys encrypting-decrypting function in my code for my exam project, very useful and well-explained!

  • @NhanNguyen-rh4lg
    @NhanNguyen-rh4lg 4 года назад +3

    Perfect!!! You must be god and saving me Asymmetric, many thank!

    • @TechnoSaviour
      @TechnoSaviour  4 года назад

      Thanks for your encouraging words 🙏

  • @12XFactor
    @12XFactor 3 года назад

    That's good for the basics. To people who think about using exactly that solution, I would recommend not generate the keys one time and use them forever. Generate new keys for every package you want to send. The first information exchange will be the public keys of client and server and the second exchange round is transmitting the encrypted package. To make sure the package is not manipulated, extend the encryption with a signature.

  • @evendevilscry1431
    @evendevilscry1431 3 года назад +1

    Nice video. Got so much to learn.. Thank you

  • @alejandrobermudez8799
    @alejandrobermudez8799 2 года назад

    Very very useful information. Thank you very much.

  • @SwetavSavarn
    @SwetavSavarn 4 месяца назад

    I am quite confused in one thing .
    We are creating public and private key.
    And encrypting our string with that public key
    So if we are decrypting with private key how node-rsa specifiy that this private key is only used to decrypt the data not any other , as both public and private keys are independent not dependent to each other

  • @penguasaphonty8749
    @penguasaphonty8749 3 года назад +1

    I can't run this in node js 8 version. Can you tell me how can I do the same thing in node js 8 version using crypto?

  • @mohamedzemzemi1257
    @mohamedzemzemi1257 4 года назад +2

    GG mate, thanks

  • @00WhiteDragon
    @00WhiteDragon 4 года назад +1

    Nice vid.

  • @rosalyna_24
    @rosalyna_24 3 года назад +1

    hiii nice video but how can i use this module to encrypt a file that i'm going to send

    • @TechnoSaviour
      @TechnoSaviour  3 года назад

      You can try converting the file to base64 string then encrypt it

  • @okzowarz2275
    @okzowarz2275 6 месяцев назад

    how can
    i use with client side

  • @arun0686
    @arun0686 2 года назад +1

    Hi im getting error like RSA PADDING CHECK PKCS1 OAEP ,OAEP DECODING ERROR ..help me

  • @Cdswjp
    @Cdswjp 2 года назад

    I find it interesting that u use the public key for encryption & the private key for decryption. I usually read about it being the other way around. What is the reasoning behind doing this in your opinion?

    • @alejandrobermudez8799
      @alejandrobermudez8799 2 года назад

      Encrypt with public key an decrypt with private key is the way. Please watch the following video: ruclips.net/video/AQDCe585Lnc/видео.html&ab_channel=SimplyExplained

    • @saditya
      @saditya 2 года назад

      depends who is sending the data to whom

  • @gsiva3577
    @gsiva3577 Месяц назад

    Super

  • @abhishekpatel7624
    @abhishekpatel7624 3 года назад

    How the sign and verify works in node-rsa? I implement at my local but all time give me false verify all tho plain text, and keys are everything correct but not sure what happened? Can you please explain?

  • @snehasamuel7426
    @snehasamuel7426 Год назад +1

    why cant i use the private key for encryption and public key for decryption

    • @SASA_maxillo
      @SASA_maxillo 4 месяца назад +2

      because the public key will travel through the internet but the private key can't, and a hacker can get the public key (because it is traveling though the internet) so when a hackers gets it, it's point less, because a public key can only encrypt and can't decrypt, so this is why RSA is a very safe way of transferring data

  • @paymentpablo
    @paymentpablo Год назад

    Any tips for reading an encrypted message that is encrypted elsewhere? I have the private key and I tried importing the private key but it keeps giving me an error saying the private key is wrong?

    • @vanigarlapati7083
      @vanigarlapati7083 Год назад

      any luck? I am also working on the same requirement.

  • @SSinghalS
    @SSinghalS 2 года назад

    I am new to this, I have everything the same, but when I try to run it, the output is not displayed, could you tell me the reason?

  • @TrungNguyen-hx3ps
    @TrungNguyen-hx3ps 3 года назад +1

    Hello, I need to convert a NodeJS function (using the crypto-js library) to PHP. I can pay for it. Can you do that?

    • @labiV1
      @labiV1 3 года назад

      Yes I can do that. Is this job still available?

  • @vipul8512
    @vipul8512 Год назад

    Can we use this in angular 12?

  • @MrRiseful
    @MrRiseful 4 года назад

    Like it!

  • @naumanshigri
    @naumanshigri 3 года назад +1

    aju xheringmo.. very helpful

  • @adaadutv9426
    @adaadutv9426 4 года назад +1

    Do you have example using asp.net core c#

    • @TechnoSaviour
      @TechnoSaviour  4 года назад

      I'm planning to make one with a combination of Angular and .net core

  • @t-pk
    @t-pk 4 года назад +1

    thanks

  • @anejatu1312
    @anejatu1312 3 года назад

    can we use custom private key for decryption, how can i achieve it

    • @alejandrobermudez8799
      @alejandrobermudez8799 2 года назад

      I try using a pair of keys (public an private) generated by the command "ssh-keygen -t rsa -b 4096 -a 100 -f mykey" and work very well. I hope it can be useful.

  • @Unstoppable.Sakshi
    @Unstoppable.Sakshi 2 года назад +1

    Thank you for help .. But How I can apply this on my message in my project

  • @anisulashik8836
    @anisulashik8836 2 года назад

    can i use it in react js ??

    • @TechnoSaviour
      @TechnoSaviour  2 года назад

      Yes, it’s a browser feature can be implemented in any language

  • @matinzd
    @matinzd 2 года назад +1

    You could just use built in crypto lib.

  • @andrewgad6746
    @andrewgad6746 4 года назад

    Nice vid, you could have used a string literal 8:10

    • @TechnoSaviour
      @TechnoSaviour  4 года назад

      Thanks, will use it for other videos

  • @liveabhishekshukla
    @liveabhishekshukla 4 года назад +1

    Please type fast.. video length will be small..

  • @gguitarp1
    @gguitarp1 4 года назад

    Why not just use nodejs’s native crypto module?

    • @TechnoSaviour
      @TechnoSaviour  4 года назад +1

      You can use, I was focused on showing how it works

  • @adityasahoo7839
    @adityasahoo7839 3 года назад

    Facing some problem while encrypting with private key and decrypting with public key.
    Here is my code sample
    const nodeRsa = require('node-rsa');
    const key = new nodeRsa({ b: 1024 }),//public and private keys
    publicKey = key.exportKey('public');
    privateKey = key.exportKey('private');
    let encryptedString = keyPrivate.encrypt("Secret", 'base64');
    let decryptedStrig= keyPublic.decrypt(encryptedString, 'utf8');
    Am getting the error message as
    Error during decryption (probably incorrect key). Original error: Error: This is not private key
    This message during decrypt.
    Please help.
    Thanks for this lovely video though.

    • @TechnoSaviour
      @TechnoSaviour  3 года назад +1

      You are using private key for encryption and public key for decryption.
      It should be other way round

    • @TechnoSaviour
      @TechnoSaviour  3 года назад

      Let encryptedstring = keyPublic.encrypt(......

  • @ІлляБезуглий-т2з
    @ІлляБезуглий-т2з 4 года назад

    Thanks for the video, you give a good example, but you are talking way too slow

    • @TechnoSaviour
      @TechnoSaviour  4 года назад

      Thanks for your suggestion, I'm working on it

    • @kofestar
      @kofestar 4 года назад

      You can easily set the video speed

  • @dennisgonzales9521
    @dennisgonzales9521 3 года назад

    Thanks