blob: a130ca4c1fd2e675b680e5cdaf1c129ef6651879 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
C++RAW
#include "UnityPrefix.h"
#include "Configuration/UnityConfigure.h"
#include "Runtime/Scripting/ScriptingManager.h"
#include "Runtime/Scripting/ScriptingExportUtility.h"
#if UNITY_WEBPLAYER
#include "PlatformDependent/CommonWebPlayer/ChainOfTrust.h"
#endif
CSRAW
using System;
using System.Security;
namespace UnityEngine
{
CSRAW #if !UNITY_WINRT
// Webplayer security related class.
CLASS Security
// Prefetch the webplayer socket security policy from a non-default port number.
CSRAW static public bool PrefetchSocketPolicy(string ip, int atPort, int timeout=3000)
{
#if UNITY_EDITOR || UNITY_WEBPLAYER
var method = GetUnityCrossDomainHelperMethod("PrefetchSocketPolicy");
var result = method.Invoke(null, new object[] { ip, atPort, timeout});
return (bool)result;
#else
return true;
#endif
}
CONDITIONAL UNITY_WEBPLAYER || UNITY_EDITOR
CSRAW
[System.Security.SecuritySafeCritical]
public static string GetChainOfTrustValue (string name)
{
var callingAssembly = System.Reflection.Assembly.GetCallingAssembly ();
if (!_verifiedAssemblies.Contains(callingAssembly))
throw new ArgumentException("Calling assembly needs to be verified by Security.LoadAndVerifyAssembly");
var token = callingAssembly.GetName ().GetPublicKeyToken ();
return GetChainOfTrustValueInternal (name, UnityEngine.Security.TokenToHex (token));
}
CONDITIONAL UNITY_WEBPLAYER || UNITY_EDITOR
CUSTOM private static string GetChainOfTrustValueInternal (string name, string publicKeyToken)
{
#if UNITY_WEBPLAYER
std::string token = publicKeyToken.AsUTF8 ();
std::string result = ChainOfTrust::GetValue(name,token);
return scripting_string_new(result);
#else
return scripting_string_new(string());
#endif
}
END
CSRAW #endif
}
|