纳金网

标题: 在网页播放器使用信任链系统 Using the Chain of Trust system in th... [打印本页]

作者: star-小虎    时间: 2013-10-16 16:15
标题: 在网页播放器使用信任链系统 Using the Chain of Trust system in th...

In this section you will learn how to create strongly-named assemblies and use them, in conjunction with Javascript, to interact with your own custom back-ends.

在这个模块,你将学会如何强命名和使用程序集,结合Javascript,来与你的自定义后端进行交互。

The Chain of Trust system allows external internet applications to trust requests which originate from within a Unity Web Player. This is useful if you wish to provide a full-featured API to Unity Developers creating games within the Unity Web Player. To use the Chain of Trust system, you must have some sort of internet application backend which accepts requests; the most common example would be a web application with a REST API. You must also have a Managed C# assembly which contains code for calling your internet application.

信任链系统允许外部互联网应用信任来源于Unity Web Player内部的请求。这个对于你向Unity开发者提供一个全功能的API在Unity Web Player开发游戏是很有用的。为了应用Chain of Trust system,你必须有一些能够接受请求的互联网应用程序的后端;最常见的例子是一个网页应用程序带有REST API。同时你还必须包含有沟通你的互联网应用的代码来Managed C#配置。

Generate a key pair 生成密钥对

The first step in establishing a chain of trust is to create the cryptographic key pair needed to sign your assembly. Do this on Windows, OS X or Linux using the SN tool.

第一步建立chain of trust是创立加密密钥需要标记你的配置。是在Window,OS X还是在Linux上使用SN工具。

Sign your assembly 程序集签名

Next take your Managed C# assembly (which you will use to call your backend), and sign it using the key pair you generated. You will need to use the al tool, which is included with Windows, OS X and Linux.

然后获取Managed C#程序集(你用来调用后端的程序),并使用你生成的秘钥签名。你将需要用到al工具,包含在Windows,OS X和Linux。

Signing the assembly is a simple process.

签名程序集是一个简单的过程。

Inject your secret 加密

You can inject secrets into the Unity Web Player at any time after your Unity game has loaded. This is done with the Javascript SendMessagefunction exposed on the UnityObject2 Javascript object.

在你的Unity游戏已经加载,在任何时候在Unity Web Player里加密。这个是通过Javascript SendMessage暴露在UnityObject2 Javascript对象。

When you pass a specially-formatted message to a certain game object, the Chain of Trust system detects that you want to inject a secret and intercept the message. You do not need to create or rename any game objects to use this system. With a UnityObject2 instance called u the Javascript call will be:

当你通过一种特定格式发送消息给一个特定的游戏项目,信任链系统 就会检测到你想要添加秘钥来拦截消息。你不需要创建或者更改任何游戏项目的名字里用这个系统。用一个UnityObject2实例叫做u,Javascript调用是:

u.GetUnity().SendMessage("ChainOfTrust_SetValueASDF", ".", "name=mySecretDataName;value=mySecretValue;publickey=publicKeyTokenOfMyAssembly");

Retrieve your secret 解密

Once a secret has been injected into the Unity Web Player, you can only retrieve it with a cryptographically-signed ("strong named") Managed C# assembly with a matching public key token.

一旦加密Unity Web Player,你只能用具有密码签名(“强命名”)Managed C#程序集带有一个匹配的公钥获取。



作者: star-小虎    时间: 2013-10-16 16:17
顶一下!!!!
作者: 艾西格亚    时间: 2013-10-16 16:38
太密集了,上传时请注意间隔




欢迎光临 纳金网 (http://rs.narkii.com/club/) Powered by Discuz! X2.5