如何使离线HTML / JavaScript网站安全? [英] How can an offline HTML/JavaScript website be made secure?

查看:109
本文介绍了如何使离线HTML / JavaScript网站安全?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何离线网站( zip,MHTML SingleFile )安全吗?是否有技术(混淆,加密)或HTML或JavaScript(ECMAScript)规范中的任何可允许离线网站自己安全的内容?

How can an offline website (zip, MHTML, SingleFile) be made secure? Are there techniques (obfuscating, encrypting) or anything within the specs of HTML or JavaScript (ECMAScript) that would allow for an offline website to be secure on its own?

通过安全我的意思是,如果用户拥有网站的本地副本,他们可能还没有密码访问内容。想象一下在PDF文档中使用的安全级别。

By "secure" I mean that if a user has a local copy of the website, they may not still have access to the contents without a password. Imagine a level of security approximating that which is used in PDF documents.

推荐答案

您可以使用离线js函数( https://code.google.com/p/crypto-js/#Ciphers here是一些算法可以)加密所有的数据,并要求一个密码来解密它。
请注意,您不应该存储正确的密码,而是通过使用用户给出的密码进行解密来检查是否正确的密码(使用正确的密码加密hello world,然后检查是否密码由用户提供)。

You may use an offline js function (https://code.google.com/p/crypto-js/#Ciphers here are some algorithms that will do) to encrypt all the data, and ask for a password to decrypt it. Note that you shouldn't store the correct password, but instead check if it is correct by decrypting with the password given by the user a known message (encrypt "hello world" with the correct password, and then check if the password given by the user works).

这篇关于如何使离线HTML / JavaScript网站安全?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆