简体   繁体   中英

Securely hide jQuery result from user - 2

I know i've asked this question before ( Securely hide jQuery result from user? ), but i'm hoping to ask the same question and get a different answer...

Basically, I have a jQuery script that generates a random key pair. I need to get that key pair from the jQuery script to a php variable without the user being able to see it.

I've been told that this is impossible by a lot of people but I'd really like a 25th opinion.

From what I understand, this would infact be possible by using node.js with something like ssjquery or cheerio, but before I go that route, is there a simpler solution?

I have an idea and i'd just like to know if it would work.

Could I encrypt the data with an RSA public key as part of the jQuery script, then decrypt it on the server with the private key? I've tried this by adding phpseclib-jsbn-rsa encryption into the script, and it seems to work, but is there a way that the user could get the data before the encryption? https://github.com/mvhaen/phpseclib-jsbn-rsa Also, would it makeany difference if I called the script with file_get_contents from a php page?

I just don't know enough about what's really going on in the process to judge if it'd work. So, if anyone could enlighten me that'd be great, or if you know of another way without using nodejs, jsdom, phantomjs, etc, please let me know.

Thanks.

If you absolutely have to use jQuery, then node.js is your only option to securely generate these keys server side. There is no way to securely generate these in the browser without the user being able to grab them in some fashion.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM