How to secure passwords over HTTP

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
3
down vote

favorite












Say my password is abc. I want to send it to the server over HTTP.



I could send it in plaintext and let the server hash it and compare it to the entries in its database, but then anyone that can see traffic over that connection would see the password in plain text.



So then I could hash it client-side and let the server just compare it without hashing since it's already hashed (or the server could even double hash, but no difference in this situation). But then again anyone that can see the traffic would see the password hashed, and then send the hashed password to the server and the server would accept it.



How do I send passwords over HTTP? Do I need to implement some encryption algorithm like RSA public key encryption? Or is this impossible?










share|improve this question









New contributor




FireCubez is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.















  • 1




    Why can't you just use TLS? There's really no other way to do it securely.
    – AndrolGenhald
    3 hours ago










  • @AndrolGenhald I could, this is just a proof of concept. If there's no other way to do it securely then that's the answer I was looking for. You should post it as an answer
    – FireCubez
    3 hours ago














up vote
3
down vote

favorite












Say my password is abc. I want to send it to the server over HTTP.



I could send it in plaintext and let the server hash it and compare it to the entries in its database, but then anyone that can see traffic over that connection would see the password in plain text.



So then I could hash it client-side and let the server just compare it without hashing since it's already hashed (or the server could even double hash, but no difference in this situation). But then again anyone that can see the traffic would see the password hashed, and then send the hashed password to the server and the server would accept it.



How do I send passwords over HTTP? Do I need to implement some encryption algorithm like RSA public key encryption? Or is this impossible?










share|improve this question









New contributor




FireCubez is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.















  • 1




    Why can't you just use TLS? There's really no other way to do it securely.
    – AndrolGenhald
    3 hours ago










  • @AndrolGenhald I could, this is just a proof of concept. If there's no other way to do it securely then that's the answer I was looking for. You should post it as an answer
    – FireCubez
    3 hours ago












up vote
3
down vote

favorite









up vote
3
down vote

favorite











Say my password is abc. I want to send it to the server over HTTP.



I could send it in plaintext and let the server hash it and compare it to the entries in its database, but then anyone that can see traffic over that connection would see the password in plain text.



So then I could hash it client-side and let the server just compare it without hashing since it's already hashed (or the server could even double hash, but no difference in this situation). But then again anyone that can see the traffic would see the password hashed, and then send the hashed password to the server and the server would accept it.



How do I send passwords over HTTP? Do I need to implement some encryption algorithm like RSA public key encryption? Or is this impossible?










share|improve this question









New contributor




FireCubez is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











Say my password is abc. I want to send it to the server over HTTP.



I could send it in plaintext and let the server hash it and compare it to the entries in its database, but then anyone that can see traffic over that connection would see the password in plain text.



So then I could hash it client-side and let the server just compare it without hashing since it's already hashed (or the server could even double hash, but no difference in this situation). But then again anyone that can see the traffic would see the password hashed, and then send the hashed password to the server and the server would accept it.



How do I send passwords over HTTP? Do I need to implement some encryption algorithm like RSA public key encryption? Or is this impossible?







encryption passwords hash http






share|improve this question









New contributor




FireCubez is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




FireCubez is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 3 hours ago





















New contributor




FireCubez is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 3 hours ago









FireCubez

1183




1183




New contributor




FireCubez is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





FireCubez is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






FireCubez is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







  • 1




    Why can't you just use TLS? There's really no other way to do it securely.
    – AndrolGenhald
    3 hours ago










  • @AndrolGenhald I could, this is just a proof of concept. If there's no other way to do it securely then that's the answer I was looking for. You should post it as an answer
    – FireCubez
    3 hours ago












  • 1




    Why can't you just use TLS? There's really no other way to do it securely.
    – AndrolGenhald
    3 hours ago










  • @AndrolGenhald I could, this is just a proof of concept. If there's no other way to do it securely then that's the answer I was looking for. You should post it as an answer
    – FireCubez
    3 hours ago







1




1




Why can't you just use TLS? There's really no other way to do it securely.
– AndrolGenhald
3 hours ago




Why can't you just use TLS? There's really no other way to do it securely.
– AndrolGenhald
3 hours ago












@AndrolGenhald I could, this is just a proof of concept. If there's no other way to do it securely then that's the answer I was looking for. You should post it as an answer
– FireCubez
3 hours ago




@AndrolGenhald I could, this is just a proof of concept. If there's no other way to do it securely then that's the answer I was looking for. You should post it as an answer
– FireCubez
3 hours ago










4 Answers
4






active

oldest

votes

















up vote
9
down vote



accepted










You can't.



To securely sent information over an unsecure channel, you need encryption.



Symmetric encryption is out, because you would first need to transport the key, which you can't do securely over an unsecure channel[*].



That leaves you with public key cryptography. You could of course roll your own, but you don't want to be a Dave, so that's out. Which leaves you with HTTPS.



[*] You can of course try to use a secure channel to exchange the key, for example physical exchange of a key. Then you can use secret key crypto, eg Kerberos.






share|improve this answer



























    up vote
    4
    down vote













    TLS is really the only way to do it.



    But what if I encrypt it with JavaScript?



    The attacker can change the JavaScript you send to the client, or simply inject their own JavaScript that logs all information entered.



    Then I'll use CSP and SRI to prevent the addition of scripts and the modification of my own scripts.



    Glad you're using modern tools to help protect your site, but SRI in a non-secure context really only protects against the compromise of an external resource. An attacker can simply modify the CSP headers and SRI tags.



    There's really no way to do this without using encryption from the beginning, and the only standard way to do that is to use TLS.






    share|improve this answer



























      up vote
      0
      down vote














      Do I need to implement some encryption algorithm like RSA public key encryption?




      If you're considering trying that, you may as well just go the full mile and use HTTPS. Since you don't seem to be an expert, "rolling your own" encryption will undoubtedly have misimplementations that render it insecure.






      share|improve this answer



























        up vote
        0
        down vote













        You can also get cheap SSL certs from various different providers, if your concern is price. Price, however, is linked to trustworthiness and the "security" of you keys. https://www.reddit.com/r/web_design/comments/4vjiec/bestcheapest_place_for_ssl_cert/



        The only absolute way I can think of that would keep http traffic unencrypted is to VPN or tunnel to the server...





        share








        New contributor




        Nielsvh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.

















          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "162"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          noCode: true, onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );






          FireCubez is a new contributor. Be nice, and check out our Code of Conduct.









           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsecurity.stackexchange.com%2fquestions%2f197330%2fhow-to-secure-passwords-over-http%23new-answer', 'question_page');

          );

          Post as a guest






























          4 Answers
          4






          active

          oldest

          votes








          4 Answers
          4






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          9
          down vote



          accepted










          You can't.



          To securely sent information over an unsecure channel, you need encryption.



          Symmetric encryption is out, because you would first need to transport the key, which you can't do securely over an unsecure channel[*].



          That leaves you with public key cryptography. You could of course roll your own, but you don't want to be a Dave, so that's out. Which leaves you with HTTPS.



          [*] You can of course try to use a secure channel to exchange the key, for example physical exchange of a key. Then you can use secret key crypto, eg Kerberos.






          share|improve this answer
























            up vote
            9
            down vote



            accepted










            You can't.



            To securely sent information over an unsecure channel, you need encryption.



            Symmetric encryption is out, because you would first need to transport the key, which you can't do securely over an unsecure channel[*].



            That leaves you with public key cryptography. You could of course roll your own, but you don't want to be a Dave, so that's out. Which leaves you with HTTPS.



            [*] You can of course try to use a secure channel to exchange the key, for example physical exchange of a key. Then you can use secret key crypto, eg Kerberos.






            share|improve this answer






















              up vote
              9
              down vote



              accepted







              up vote
              9
              down vote



              accepted






              You can't.



              To securely sent information over an unsecure channel, you need encryption.



              Symmetric encryption is out, because you would first need to transport the key, which you can't do securely over an unsecure channel[*].



              That leaves you with public key cryptography. You could of course roll your own, but you don't want to be a Dave, so that's out. Which leaves you with HTTPS.



              [*] You can of course try to use a secure channel to exchange the key, for example physical exchange of a key. Then you can use secret key crypto, eg Kerberos.






              share|improve this answer












              You can't.



              To securely sent information over an unsecure channel, you need encryption.



              Symmetric encryption is out, because you would first need to transport the key, which you can't do securely over an unsecure channel[*].



              That leaves you with public key cryptography. You could of course roll your own, but you don't want to be a Dave, so that's out. Which leaves you with HTTPS.



              [*] You can of course try to use a secure channel to exchange the key, for example physical exchange of a key. Then you can use secret key crypto, eg Kerberos.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered 3 hours ago









              tim

              21.9k55690




              21.9k55690






















                  up vote
                  4
                  down vote













                  TLS is really the only way to do it.



                  But what if I encrypt it with JavaScript?



                  The attacker can change the JavaScript you send to the client, or simply inject their own JavaScript that logs all information entered.



                  Then I'll use CSP and SRI to prevent the addition of scripts and the modification of my own scripts.



                  Glad you're using modern tools to help protect your site, but SRI in a non-secure context really only protects against the compromise of an external resource. An attacker can simply modify the CSP headers and SRI tags.



                  There's really no way to do this without using encryption from the beginning, and the only standard way to do that is to use TLS.






                  share|improve this answer
























                    up vote
                    4
                    down vote













                    TLS is really the only way to do it.



                    But what if I encrypt it with JavaScript?



                    The attacker can change the JavaScript you send to the client, or simply inject their own JavaScript that logs all information entered.



                    Then I'll use CSP and SRI to prevent the addition of scripts and the modification of my own scripts.



                    Glad you're using modern tools to help protect your site, but SRI in a non-secure context really only protects against the compromise of an external resource. An attacker can simply modify the CSP headers and SRI tags.



                    There's really no way to do this without using encryption from the beginning, and the only standard way to do that is to use TLS.






                    share|improve this answer






















                      up vote
                      4
                      down vote










                      up vote
                      4
                      down vote









                      TLS is really the only way to do it.



                      But what if I encrypt it with JavaScript?



                      The attacker can change the JavaScript you send to the client, or simply inject their own JavaScript that logs all information entered.



                      Then I'll use CSP and SRI to prevent the addition of scripts and the modification of my own scripts.



                      Glad you're using modern tools to help protect your site, but SRI in a non-secure context really only protects against the compromise of an external resource. An attacker can simply modify the CSP headers and SRI tags.



                      There's really no way to do this without using encryption from the beginning, and the only standard way to do that is to use TLS.






                      share|improve this answer












                      TLS is really the only way to do it.



                      But what if I encrypt it with JavaScript?



                      The attacker can change the JavaScript you send to the client, or simply inject their own JavaScript that logs all information entered.



                      Then I'll use CSP and SRI to prevent the addition of scripts and the modification of my own scripts.



                      Glad you're using modern tools to help protect your site, but SRI in a non-secure context really only protects against the compromise of an external resource. An attacker can simply modify the CSP headers and SRI tags.



                      There's really no way to do this without using encryption from the beginning, and the only standard way to do that is to use TLS.







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered 3 hours ago









                      AndrolGenhald

                      8,33841729




                      8,33841729




















                          up vote
                          0
                          down vote














                          Do I need to implement some encryption algorithm like RSA public key encryption?




                          If you're considering trying that, you may as well just go the full mile and use HTTPS. Since you don't seem to be an expert, "rolling your own" encryption will undoubtedly have misimplementations that render it insecure.






                          share|improve this answer
























                            up vote
                            0
                            down vote














                            Do I need to implement some encryption algorithm like RSA public key encryption?




                            If you're considering trying that, you may as well just go the full mile and use HTTPS. Since you don't seem to be an expert, "rolling your own" encryption will undoubtedly have misimplementations that render it insecure.






                            share|improve this answer






















                              up vote
                              0
                              down vote










                              up vote
                              0
                              down vote










                              Do I need to implement some encryption algorithm like RSA public key encryption?




                              If you're considering trying that, you may as well just go the full mile and use HTTPS. Since you don't seem to be an expert, "rolling your own" encryption will undoubtedly have misimplementations that render it insecure.






                              share|improve this answer













                              Do I need to implement some encryption algorithm like RSA public key encryption?




                              If you're considering trying that, you may as well just go the full mile and use HTTPS. Since you don't seem to be an expert, "rolling your own" encryption will undoubtedly have misimplementations that render it insecure.







                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered 1 hour ago









                              Brian Williams

                              1364




                              1364




















                                  up vote
                                  0
                                  down vote













                                  You can also get cheap SSL certs from various different providers, if your concern is price. Price, however, is linked to trustworthiness and the "security" of you keys. https://www.reddit.com/r/web_design/comments/4vjiec/bestcheapest_place_for_ssl_cert/



                                  The only absolute way I can think of that would keep http traffic unencrypted is to VPN or tunnel to the server...





                                  share








                                  New contributor




                                  Nielsvh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                  Check out our Code of Conduct.





















                                    up vote
                                    0
                                    down vote













                                    You can also get cheap SSL certs from various different providers, if your concern is price. Price, however, is linked to trustworthiness and the "security" of you keys. https://www.reddit.com/r/web_design/comments/4vjiec/bestcheapest_place_for_ssl_cert/



                                    The only absolute way I can think of that would keep http traffic unencrypted is to VPN or tunnel to the server...





                                    share








                                    New contributor




                                    Nielsvh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                    Check out our Code of Conduct.



















                                      up vote
                                      0
                                      down vote










                                      up vote
                                      0
                                      down vote









                                      You can also get cheap SSL certs from various different providers, if your concern is price. Price, however, is linked to trustworthiness and the "security" of you keys. https://www.reddit.com/r/web_design/comments/4vjiec/bestcheapest_place_for_ssl_cert/



                                      The only absolute way I can think of that would keep http traffic unencrypted is to VPN or tunnel to the server...





                                      share








                                      New contributor




                                      Nielsvh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                      Check out our Code of Conduct.









                                      You can also get cheap SSL certs from various different providers, if your concern is price. Price, however, is linked to trustworthiness and the "security" of you keys. https://www.reddit.com/r/web_design/comments/4vjiec/bestcheapest_place_for_ssl_cert/



                                      The only absolute way I can think of that would keep http traffic unencrypted is to VPN or tunnel to the server...






                                      share








                                      New contributor




                                      Nielsvh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                      Check out our Code of Conduct.








                                      share


                                      share






                                      New contributor




                                      Nielsvh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                      Check out our Code of Conduct.









                                      answered 46 secs ago









                                      Nielsvh

                                      1011




                                      1011




                                      New contributor




                                      Nielsvh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                      Check out our Code of Conduct.





                                      New contributor





                                      Nielsvh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                      Check out our Code of Conduct.






                                      Nielsvh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                      Check out our Code of Conduct.




















                                          FireCubez is a new contributor. Be nice, and check out our Code of Conduct.









                                           

                                          draft saved


                                          draft discarded


















                                          FireCubez is a new contributor. Be nice, and check out our Code of Conduct.












                                          FireCubez is a new contributor. Be nice, and check out our Code of Conduct.











                                          FireCubez is a new contributor. Be nice, and check out our Code of Conduct.













                                           


                                          draft saved


                                          draft discarded














                                          StackExchange.ready(
                                          function ()
                                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsecurity.stackexchange.com%2fquestions%2f197330%2fhow-to-secure-passwords-over-http%23new-answer', 'question_page');

                                          );

                                          Post as a guest













































































                                          Comments

                                          Popular posts from this blog

                                          What does second last employer means? [closed]

                                          List of Gilmore Girls characters

                                          Confectionery