Google Native Client - 如何保护源代码?
使用 Google Native Client,是否可以保护源代码,使其与 JavaScript 不同,在客户端中不可见?
如果是这样,怎么办?谢谢!
With Google Native Client, can the source code be protected so that, unlike JavaScript, it is not visible in the client?
If so, how? Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
顾名思义,Google Native Client 使用本机代码。
这意味着,您的代码已编译,就像桌面上的普通可执行二进制文件一样。可以反汇编,但无法恢复源代码。
As the name says, Google Native Client uses native code.
That means, your code is compiled, just like with your average executable binary on the desktop. It can be disassembled, but the source code can't be recovered.
本机客户端意味着您在客户端上运行本机代码。在大多数情况下,您将在客户端上运行 i386 或 amd64 机器语言。如果您使用的是编译语言,那么您的用户无法直接恢复它。用户可以反汇编您的软件以恢复有关代码的一些信息,但他们无法恢复原始源代码(除非它是汇编语言)。从反汇编的二进制文件重写一个软件很困难,但只要有足够的时间,通常是可以完成的。这实际上取决于您对使用您代码的人有多偏执。
Native client means that you are running native code on the client. In most cases, you'll be running i386 or amd64 machine language on your client. If you're using a compiled language, then your users cannot directly recover it. Users could disassemble your software to recover some information about your code, but they cannot recover the original source code (unless it is assembly language). Rewriting a piece of software from the disassembled binary is difficult, but given enough time, it can usually be done. It really depends on how paranoid you are about the people using your code.
Native Client 的结构要求需要实现可靠的反汇编,以便能够执行静态分析,这可能会导致某些代码混淆技术无法使用。这些通常是恶意软件使用的相同技术,使恶意软件分析变得困难,即,如果通过不同的偏移量解码,则对指令流有两种有效的解释。然而,Native Client 确实允许某种形式的自修改代码,因为它具有 JIT 支持。例如,Mono 使用即时代码生成,并且只要 JIT 代码继续符合 NaCl 安全要求,就可以使用相同的接口来创建混淆代码。
使用 JIT 接口当然会使您的代码不可移植到其他 CPU 架构。
Native Client's structural requirements to enable reliable disassembly so that it can perform static analysis can make some techniques for code obfuscation unusable. These are often the same techniques used by malware to make malware analysis difficult, i.e., have two valid interpretations of the instruction stream if decoded by different offsets. Native Client does, however, permit a form of self-modifying code since it has JIT support. Mono uses just-in-time code generation, for example, and the same interfaces can be used to create obfuscated code, as long as the JIT'ted code continue to conform to the NaCl security requirements.
Using the JIT interface would of course make your code non-portable to other CPU architectures.