如何防止人们破解我的小程序?
操作小程序就像输入
javascript:document.getElementsByTagName("applet")[0].publicMethod();
地址栏一样简单。如何保护我的小程序免受此类操纵?
Manipulating an applet is as easy as entering
javascript:document.getElementsByTagName("applet")[0].publicMethod();
into the address bar. How can I protect my applet from such manipulation?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不可能在客户端实现安全性。您可以通过混淆代码来使事情变得更加困难,但混淆只会阻止临时用户篡改。意志坚定且知识渊博的用户将能够对小程序进行逆向工程,即使它被混淆了。无论你做什么,总会有足够聪明的人找到解决方法。
如果安全性很重要,请在服务器上进行。
It's not possible to implement security on the client side. You can make things more difficult by obfuscating your code, but obfuscation will only stop casual users from tampering. A determined and knowledgable user will be able to reverse engineer the applet even if it is obfuscated. No matter what you do, there will always be someone smart enough to figure out a way around it.
If security is important, do it on the server.
只能访问公共小程序方法。因此,问题的解决方案是将方法设为私有/受保护。
Only public applet methods can be accessed. So the solution to your problem is making the method private/protected.
将方法设为私有。至于 init()、start()、mousePressed()、keyPressed() 等,只需调用私有方法即可
Make the methods private. As for init(), start(), mousePressed(), keyPressed(), etc, just have those methods call upon the private ones