End-to-end encryption in Javascript, PHP and MySQL

แชร์
ฝัง
  • เผยแพร่เมื่อ 24 ก.พ. 2023
  • End-to-end encryption in Javascript, PHP, and MySQL
    End-to-end encrypted chats are more secure than the ones where encryption is done on the server side. Because the messages get encrypted even before sending them to the server. This will prevent any read or altered operation of messages in transit. Let's learn how to do it.
    We will be using Javascript for encryption and decryption. And we will be using PHP for handling AJAX requests. All the encrypted messages will be stored in the MySQL database.
    Source code:
    adnan-tech.com/end-to-end-enc...
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 28

  • @braslyn6828
    @braslyn6828 5 หลายเดือนก่อน +1

    Hello, I'm working on encryption these days and I have a question for you. You store Private Keys in the users table in your database. But don't you think this is dangerous? The reason why we encrypt the messages is that the messages cannot be seen clearly after the database is accessed. If the messages table is accessed, the users table can also be easily accessed. If the users table is accessed, encrypted messages can be decrypted using private keys and public keys, emulating the same encryption algorithm you used. In short, there is no point in storing the private key in the database. In some sources I researched, it is said that private keys are stored on the device and public keys are stored on the server side, but I am also confused at this point.

    • @AdnanAfzal565
      @AdnanAfzal565  5 หลายเดือนก่อน

      Even if the database is accessed, the messages are encrypted using hard coded secret key in source code. If you save the keys on user device, and if user changes his device, all the previous messages will be lost.

    • @braslyn6828
      @braslyn6828 5 หลายเดือนก่อน +1

      @@AdnanAfzal565 I also know that it will be lost, what do you mean by the secret key in the source code?

    • @AdnanAfzal565
      @AdnanAfzal565  5 หลายเดือนก่อน

      I am using a secret key to encrypt a message. That secret key is hard coded in source code of this tutorial.

    • @braslyn6828
      @braslyn6828 5 หลายเดือนก่อน

      @@AdnanAfzal565 OK, I have another question: Do you update public and private keys with every login process? Because I examined the source code and if the response from login.php is not empty, you apply the UpdateKeys function.

    • @AdnanAfzal565
      @AdnanAfzal565  5 หลายเดือนก่อน

      @braslyn6828 no. I am not updating on every login.

  • @tiagoborges5108
    @tiagoborges5108 ปีที่แล้ว +1

    Hello, just a question because i dont know a lot about security this end-to-end encrytion is only useful on sendig messages or in others cases also.

    • @AdnanAfzal565
      @AdnanAfzal565  ปีที่แล้ว

      Hello. It depends. For which purpose you want to use this ?

    • @tiagoborges5108
      @tiagoborges5108 ปีที่แล้ว

      @@AdnanAfzal565 I dont have no purpose i just trying to learn.

    • @AdnanAfzal565
      @AdnanAfzal565  ปีที่แล้ว

      This encryption can be used for other purposes as well.

    • @tiagoborges5108
      @tiagoborges5108 ปีที่แล้ว

      @@AdnanAfzal565 Can you please give some type of exemples.

    • @AdnanAfzal565
      @AdnanAfzal565  ปีที่แล้ว

      You can use it for saving sensitive information, like credit cards etc.

  • @thechoosen4240
    @thechoosen4240 7 หลายเดือนก่อน +1

    Good job bro, JESUS IS COMING BACK VERY SOON;WATCH AND PREPARE

  • @spiritualiteislamique9136
    @spiritualiteislamique9136 ปีที่แล้ว +1

    Nice content ! 💯. , but you didn't reply me yet lol...

    • @AdnanAfzal565
      @AdnanAfzal565  ปีที่แล้ว

      Sorry for the delay. I have replied now.

  • @user-fr7fs5gt4c
    @user-fr7fs5gt4c 10 หลายเดือนก่อน +1

    The link to the source code does not work. It only shows a image.

    • @AdnanAfzal565
      @AdnanAfzal565  10 หลายเดือนก่อน

      Let me check.

    • @user-fr7fs5gt4c
      @user-fr7fs5gt4c 10 หลายเดือนก่อน +1

      Thanks. Another concern is: its a very bad security approach to store the secret key into the DB. I guess it would be better to store it on the users-device. If the DB gets hacked, the secret key is available to the hacker.

    • @AdnanAfzal565
      @AdnanAfzal565  10 หลายเดือนก่อน

      @user-fr7fs5gt4c and what happens when user change devices.

    • @braslyn6828
      @braslyn6828 5 หลายเดือนก่อน

      @@AdnanAfzal565 This is normally done in this way: Applications such as Whatsapp, Messenger, Signal store the secret key on the user device. Most online sources write it this way. Logically speaking, this is the most useful thing because if messages are obtained during a database attack, they can be decrypted very easily. However, the question that comes to my mind is what will happen to the private key when the device is reset, and I am currently investigating this.

  • @kdydhncsjfiekdfrhgsdgdfa8987
    @kdydhncsjfiekdfrhgsdgdfa8987 7 หลายเดือนก่อน +2

    please don’t try this. this is not very secure. and this encrypt algorithm is lower algorithm. when you submit the data hacker can see your data.

    • @AdnanAfzal565
      @AdnanAfzal565  7 หลายเดือนก่อน

      The hacker will see the encrypted data. And if your server is on https protocol, it also encrypts all the outgoing data.