Re: Encrypted field in form (HTTPS question)

V <[email protected]> Mon, 3 Apr 2023 06:57:58 -0700 (PDT)
Newsgroups comp.lang.php
Message-ID <[email protected]>
groups.google.com/g/sci.math/c/sFUlUZ47ZGs



On Monday, August 21, 2017 at 6:02:18 AM UTC+2, Richard Damon wrote:
> On 8/20/17 11:43 PM, [email protected] wrote: 
> > I'm trying to set up a simple blogging system, where I have a form which will have a textbox which will allow me to post stuff. Now I want a password field on the form, so that random people cannot post. I would like this password to be ENCRYPTED during transit. So - there'll be TWO textboxes, one for the password, and one for the post itself - what would the coding for the form look like? It's only the password that has to be encrypted, not the post. I realise this is more of an HTML question, but really, it concerns the whole thing, front end as well as back. I have no idea what HTTPS coding on the backend looks like. How would I extract the unencrypted password on the server side? 
> > 
> > 
> > Thanks for your help. 
> >
> A form post in pure HTML can not encrypt some data. 
> 
> You could just submit the form via HTTPS, so the whole form is 
> encrypted. HTTPS does the encryption in the communication layer, and you 
> get the unencrypted results (so it is mostly transparent to your script) 
> 
> A second option, that probably isn't really worth doing, is adding 
> javascript to the form, and have that run on submit and have the 
> javascript encrypt the data. You would need to create a new 
> public/private key for each instance of the form sent out to do the 
> encryption, and send the public key with the form. On reception, the 
> page would need to look up the public key to find the matching private 
> key, and use that to decode the password.