{"id":249681,"date":"2015-02-05T00:01:03","date_gmt":"2015-02-04T20:01:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=249681"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=249681","title":{"rendered":"<span class=\"post_title\">\u0417\u0430\u0449\u0438\u0442\u0430 \u0438\u0433\u0440 \u0438 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043e\u0442 \u0432\u0437\u043b\u043e\u043c\u0430 \u0434\u043b\u044f \u0447\u0430\u0439\u043d\u0438\u043a\u043e\u0432 (Unity, C#, Mono)<\/span>"},"content":{"rendered":"<div class=\"content html_format\">     \t\u0412\u0441\u0435\u043c \u0441\u043d\u043e\u0432\u0430 \u0437\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439\u0442\u0435! \u0414\u043e\u0448\u043b\u0438 \u0440\u0443\u043a\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u0440\u0443\u0442\u0443\u044e \u0441\u0442\u0430\u0442\u044c\u044e \u043d\u0430 \u0432\u0435\u0441\u044c\u043c\u0430 \u0432\u0430\u0436\u043d\u0443\u044e \u0442\u0435\u043c\u0443 \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0438\u0433\u0440. \u0418\u0442\u0430\u043a, \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e \u0437\u0430\u0449\u0438\u0442\u0435 \u0432\u0430\u0448\u0438\u0445 \u0434\u0440\u0430\u0433\u043e\u0446\u0435\u043d\u043d\u044b\u0445 \u0438\u0433\u0440 \u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u043f\u0438\u043b\u0438\u0442\u0435 \u043d\u0430 Unity \u0432 \u043d\u0430\u0434\u0435\u0436\u0434\u0435 \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0430 \u0431\u0443\u0445\u0430\u043d\u043a\u0443 \u0445\u043b\u0435\u0431\u0430, \u043e\u0442 \u0432\u0437\u043b\u043e\u043c\u0430 \u0437\u043b\u043e\u0431\u043d\u044b\u043c\u0438 \u0448\u043a\u043e\u043b\u044c\u043d\u0438\u043a\u0430\u043c\u0438. \u041f\u043e\u0447\u0435\u043c\u0443 \u0448\u043a\u043e\u043b\u044c\u043d\u0438\u043a\u0430\u043c\u0438? \u041f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043d\u0430\u0434\u0435\u0436\u043d\u043e\u0439 \u043d\u0430 100% \u0437\u0430\u0449\u0438\u0442\u044b \u0430\u043f\u0440\u0438\u043e\u0440\u0438 \u0431\u044b\u0442\u044c \u043d\u0435 \u043c\u043e\u0436\u0435\u0442. \u0418 \u043a\u0442\u043e \u0437\u0430\u0445\u043e\u0447\u0435\u0442, \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u0432\u0437\u043b\u043e\u043c\u0430\u0435\u0442. \u0412\u043e\u043f\u0440\u043e\u0441 \u043b\u0438\u0448\u044c \u0432 \u0442\u043e\u043c, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0438 \u0441\u0438\u043b \u043e\u043d \u043d\u0430 \u044d\u0442\u043e \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u0442. \u0418 \u043a\u0430\u043a \u043b\u044e\u0431\u044f\u0442 \u0448\u0443\u0442\u0438\u0442\u044c \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u0438\u043a\u0438 \u2014 \u0442\u0435\u0440\u043c\u043e\u0440\u0435\u043a\u0442\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u0440\u0438\u043f\u0442\u043e\u0430\u043d\u0430\u043b\u0438\u0437 \u043d\u0438\u043a\u0442\u043e \u043d\u0435 \u043e\u0442\u043c\u0435\u043d\u044f\u043b.<\/p>\n<p>  \u0418\u0442\u0430\u043a, \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u044e\u0441\u044c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043e 3 \u0430\u0441\u043f\u0435\u043a\u0442\u0430\u0445 (\u0438 \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0443 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e):  <\/p>\n<ul>\n<li>\u0437\u0430\u0449\u0438\u0442\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f (\u0441\u0435\u0439\u0432\u043e\u0432)<\/li>\n<li>\u0437\u0430\u0449\u0438\u0442\u0430 \u043f\u0430\u043c\u044f\u0442\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/li>\n<li>\u0437\u0430\u0449\u0438\u0442\u0430 \u0432\u043d\u0443\u0442\u0440\u0438\u0438\u0433\u0440\u043e\u0432\u044b\u0445 \u043f\u043e\u043a\u0443\u043f\u043e\u043a (Google Play)<\/li>\n<\/ul>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/9f9\/dc3\/9f3\/9f9dc39f333a014c0d7119f780a67f8d.jpg\" alt=\"image\"\/><a name=\"habracut\"><\/a><\/p>\n<h4>1. \u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430<\/h4>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0438\u0433\u0440\u043e\u0432\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 (\u0442\u0438\u043f\u044b, \u043a\u043b\u0430\u0441\u0441\u044b) \u0432 \u0441\u0442\u0440\u043e\u043a\u0438. \u0421\u0442\u043e\u0438\u0442 \u0438\u0437\u0443\u0447\u0438\u0442\u044c JSON \u0438\u043b\u0438 XML \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e. \u041d\u0430\u0447\u0438\u043d\u0430\u0442\u044c \u0441 XML \u043d\u0435 \u0441\u043e\u0432\u0435\u0442\u0443\u044e, \u0442.\u043a. \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 iOS. \u041b\u0443\u0447\u0448\u0435 \u0438\u0437\u0443\u0447\u0438\u0442\u044c JSON, \u0432\u043e\u0442 \u0441\u0441\u044b\u043b\u043a\u0430 <a href=\"http:\/\/wiki.unity3d.com\/index.php\/SimpleJSON\">wiki.unity3d.com\/index.php\/SimpleJSON<\/a>. \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u044d\u0442\u043e \u0442\u0435\u043c\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u0438 \u044f \u043d\u0435 \u0431\u0443\u0434\u0443 \u043d\u0430 \u044d\u0442\u043e\u043c \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f. \u0415\u0441\u043b\u0438 \u043b\u0435\u043d\u0438\u0432\u043e \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u2014 \u043c\u043e\u0436\u043d\u043e \u043f\u043e \u0441\u0442\u0430\u0440\u0438\u043d\u043a\u0435 \u043b\u0435\u043f\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0435\u043f\u0430\u0440\u0430\u0442\u043e\u0440\u043e\u0432. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"cs\">var profile = &quot;name=player;money=999;level=80&quot;; <\/code><\/pre>\n<p>  \u0415\u0449\u0435 \u043d\u0443\u0436\u043d\u043e \u0443\u043c\u0435\u0442\u044c \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u044b \u0431\u0430\u0439\u0442 \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e. \u0422\u0443\u0442 \u0432\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e:<\/p>\n<pre><code class=\"cs\">var bytes = Encoding.Default.GetBytes(profile);  profile = Encoding.Default.GetString(bytes); <\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u0441\u0442\u0440\u043e\u043a\u0443 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0432\u0443\u0430\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0432 \u043a \u043d\u0435\u0439 base64 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435. \u041e\u0441\u043e\u0431\u043e \u043e\u0442\u043c\u0435\u0447\u0443, \u0447\u0442\u043e base64 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c, \u043e\u043d \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u043a\u043b\u044e\u0447\u0430 \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u0432\u0441\u0435 \u0442\u0430\u043a\u043e\u0435. base64 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442 \u0432\u0430\u0448\u0443 \u0441\u0442\u0440\u043e\u043a\u0443 \u0432 \u043d\u043e\u0432\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0443\u044e \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0437 ASCII \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432. \u041d\u0430\u0433\u043b\u044f\u0434\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043a\u0430\u043a \u044d\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442, \u043c\u043e\u0436\u043d\u043e \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 <a href=\"http:\/\/base64.ru\/\">base64.ru\/<\/a>. \u042f \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u043a\u043e\u0434 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438:<\/p>\n<pre><code class=\"cs\">using System; using System.Text;  namespace Assets.Scripts.Common { \tpublic static class Base64     {         public static string Encode(string plainText)         {             var plainTextBytes = Encoding.UTF8.GetBytes(plainText);              return Convert.ToBase64String(plainTextBytes);         }          public static string Decode(string base64EncodedData)         {             var base64EncodedBytes = Convert.FromBase64String(base64EncodedData);              return Encoding.UTF8.GetString(base64EncodedBytes);         }     } } <\/code><\/pre>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u043e\u0442\u043c\u0435\u0447\u0443, \u0447\u0442\u043e base64 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0431\u044b\u0441\u0442\u0440\u043e \u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u043c \u043f\u043e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0441 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0435\u0439 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u0434\u0430\u0436\u0435 \u0432 \u0446\u0438\u043a\u043b\u0435 Update.<\/p>\n<h4>2. \u0417\u0430\u0449\u0438\u0442\u0430 \u0438\u0433\u0440\u043e\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 (\u0441\u0435\u0439\u0432\u043e\u0432)<\/h4>\n<p>  \u0418\u0442\u0430\u043a, \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0443\u043c\u0435\u0435\u043c \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0438\u0433\u0440\u043e\u0432\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0441\u0442\u0440\u043e\u043a\u0443. \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0434\u043e \u043f\u043e\u0434\u0443\u043c\u0430\u0442\u044c, \u043a\u0443\u0434\u0430 \u0438\u0445 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c. \u041f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u0432 \u0433\u043e\u043b\u043e\u0432\u0443 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0441\u0435\u0439\u0432\u044b \u0432 \u0444\u0430\u0439\u043b\u044b \u0432 Application.persistentDataPath. \u041c\u0438\u043d\u0443\u0441\u043e\u0432 \u0443 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u0434\u0432\u0430:  <\/p>\n<ul>\n<li>Application.persistentDataPath \u043c\u043e\u0436\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c\u0441\u044f \u043f\u0440\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u0442\u0441\u044f \u043d\u0430 SD \u043a\u0430\u0440\u0442\u0443). \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0444\u0430\u0439\u043b \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0435\u0442 not found, \u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043f\u043e\u0442\u0435\u0440\u044f\u0435\u0442 \u0432\u0435\u0441\u044c \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441<\/li>\n<li>\u042d\u0442\u043e \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 web-\u043f\u043b\u0435\u0435\u0440\u0435 \u0438 windows phone<\/li>\n<\/ul>\n<p>  \u0412\u0442\u043e\u0440\u043e\u0439 \u0438 \u0441\u0430\u043c\u044b\u0439 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u2014 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0432 PlayerPrefs. \u041f\u0440\u0438\u043c\u0435\u0440 \u043d\u0438\u0436\u0435:<\/p>\n<pre><code class=\"cs\">const string key = &quot;profile&quot;; var profile = &quot;name=player;money=999;level=80&quot;;  PlayerPrefs.SetString(key, profile); PlayerPrefs.Save();  if (PlayerPrefs.HasKey(key)) {     profile = PlayerPrefs.GetString(key); } <\/code><\/pre>\n<p>  \u041e \u0434\u0430, \u0434\u0435\u0442\u043a\u0430, \u0441\u0443\u043f\u0435\u0440! \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0448\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f. \u0422\u0443\u0442 \u043c\u043e\u0436\u043d\u043e \u043f\u043e-\u0431\u044b\u0441\u0442\u0440\u043e\u043c\u0443 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c base64 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435, \u044d\u0442\u043e \u0443\u0436\u0435 \u0437\u0430\u0449\u0438\u0442\u0438\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043e\u0442 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0447\u0435\u0440\u0435\u0437 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c \u0434\u043b\u044f \u0432\u0437\u043b\u043e\u043c\u0430. \u041d\u043e \u043f\u043e \u0445\u0430\u0440\u0434\u043a\u043e\u0440\u0443 \u0441\u0430\u043c\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043f\u0440\u0438\u043a\u0440\u0443\u0442\u0438\u0442\u044c \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u0435. \u0421\u0440\u0430\u0437\u0443 \u043a \u0434\u0435\u043b\u0443, \u0431\u0435\u0440\u0435\u043c AES \u0438 \u0448\u0438\u0444\u0440\u0443\u0435\u043c. \u041a\u043e\u043f\u0438\u043f\u0430\u0441\u0442\u0438\u043c \u0444\u0430\u0439\u043b AES.cs \u0438 \u043d\u0435 \u0437\u0430\u0434\u0430\u0435\u043c\u0441\u044f \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u043c, \u043a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442:<\/p>\n<pre><code class=\"cs\">using System; using System.IO; using System.Security.Cryptography; using System.Text;  namespace Assets.Scripts.Common {     \/\/\/ &lt;summary&gt;     \/\/\/ AES (Advanced Encryption Standard) implementation with 128-bit key (default)     \/\/\/ - 128-bit AES is approved  by NIST, but not the 256-bit AES     \/\/\/ - 256-bit AES is slower than the 128-bit AES (by about 40%)     \/\/\/ - Use it for secure data protection     \/\/\/ - Do NOT use it for data protection in RAM (in most common scenarios)     \/\/\/ &lt;\/summary&gt;     public static class AES     {         public static int KeyLength = 128;         private const string SaltKey = &quot;ShMG8hLyZ7k~Ge5@&quot;;         private const string VIKey = &quot;~6YUi0Sv5@|{aOZO&quot;;          public static string Encrypt(byte[] value, string password)         {             var keyBytes = new Rfc2898DeriveBytes(password, Encoding.UTF8.GetBytes(SaltKey)).GetBytes(KeyLength \/ 8);             var symmetricKey = new RijndaelManaged { Mode = CipherMode.CBC, Padding = PaddingMode.Zeros };             var encryptor = symmetricKey.CreateEncryptor(keyBytes, Encoding.UTF8.GetBytes(VIKey));              using (var memoryStream = new MemoryStream())             {                 using (var cryptoStream = new CryptoStream(memoryStream, encryptor, CryptoStreamMode.Write))                 {                     cryptoStream.Write(value, 0, value.Length);                     cryptoStream.FlushFinalBlock();                     cryptoStream.Close();                     memoryStream.Close();                      return Convert.ToBase64String(memoryStream.ToArray());                 }             }         }          public static string Encrypt(string value, string password)         {             return Encrypt(Encoding.UTF8.GetBytes(value), password);         }          public static string Decrypt(string value, string password)         {             var cipherTextBytes = Convert.FromBase64String(value);             var keyBytes = new Rfc2898DeriveBytes(password, Encoding.UTF8.GetBytes(SaltKey)).GetBytes(KeyLength \/ 8);             var symmetricKey = new RijndaelManaged { Mode = CipherMode.CBC, Padding = PaddingMode.None };             var decryptor = symmetricKey.CreateDecryptor(keyBytes, Encoding.UTF8.GetBytes(VIKey));              using (var memoryStream = new MemoryStream(cipherTextBytes))             {                 using (var cryptoStream = new CryptoStream(memoryStream, decryptor, CryptoStreamMode.Read))                 {                     var plainTextBytes = new byte[cipherTextBytes.Length];                     var decryptedByteCount = cryptoStream.Read(plainTextBytes, 0, plainTextBytes.Length);                      memoryStream.Close();                     cryptoStream.Close();                      return Encoding.UTF8.GetString(plainTextBytes, 0, decryptedByteCount).TrimEnd(&quot;\\0&quot;.ToCharArray());                 }             }         }     } } <\/code><\/pre>\n<p>  <\/p>\n<h4>3. \u0417\u0430\u0449\u0438\u0442\u0430 \u043f\u0430\u043c\u044f\u0442\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/h4>\n<p>  \u0412\u0441\u0435 \u043f\u043e\u043c\u043d\u044f\u0442 \u0442\u0430\u043a\u0443\u044e PC \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443, \u043a\u0430\u043a ArtMoney? \u041e\u043d\u0430 \u0443\u043c\u0435\u043b\u0430 \u0438\u0441\u043a\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 RAM \u0438 \u0437\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 \u043e\u0442\u0441\u0435\u0438\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u043b\u0430 \u0441\u0442\u0430\u0442\u044c \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u0435\u0440\u043e\u043c \u0432 \u0438\u0433\u0440\u0435. \u0421\u0435\u0439\u0447\u0430\u0441 \u0434\u043b\u044f Android \u0438 iOS \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c \u0440\u0430\u0437\u0432\u0435\u043b\u043e\u0441\u044c \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0441\u0430\u043c\u0430\u044f \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u0430\u044f \u2014 GameKiller.<\/p>\n<p>  \u0417\u0430\u0449\u0438\u0442\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u0442\u0430\u043a\u0438\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u2014 \u043d\u0443\u0436\u043d\u043e \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0428\u0438\u0444\u0440\u043e\u0432\u0430\u0442\u044c \u041a\u0410\u0416\u0414\u042b\u0419 \u0420\u0410\u0417 \u043f\u0440\u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438 \u0434\u0435\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u0442\u044c \u041a\u0410\u0416\u0414\u042b\u0419 \u0420\u0410\u0417 \u043f\u0440\u0438 \u0447\u0442\u0435\u043d\u0438\u0438. \u0418 \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0447\u0430\u0441\u0442\u0430\u044f, \u043d\u0435\u0442 \u0441\u043c\u044b\u0441\u043b\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u044f\u0436\u0435\u043b\u044b\u0439 AES \u0438 \u043d\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u0441\u0443\u043f\u0435\u0440\u0431\u044b\u0441\u0442\u0440\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c. \u042f \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0448 base64 \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0435 \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u2014 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0435, \u0431\u044b\u0441\u0442\u0440\u043e\u0435, \u0441 \u0431\u043b\u044d\u043a\u0434\u0436\u0435\u043a\u043e\u043c \u0438 XOR:<\/p>\n<pre><code class=\"cs\">using System; using System.Text;  namespace Assets.Scripts.Common {     \/\/\/ &lt;summary&gt;     \/\/\/ Simple and fast Base64 XOR encoding with dynamic key (generated on each app run). Use for data protection in RAM. Do NOT use for data storing outside RAM. Do NOT use for secure data encryption.     \/\/\/ &lt;\/summary&gt;     public class B64X     {         public static byte[] Key = Guid.NewGuid().ToByteArray();          public static string Encode(string value)         {             return Convert.ToBase64String(Encode(Encoding.UTF8.GetBytes(value), Key));         }          public static string Decode(string value)         {             return Encoding.UTF8.GetString(Encode(Convert.FromBase64String(value), Key));         }          public static string Encrypt(string value, string key)         {             return Convert.ToBase64String(Encode(Encoding.UTF8.GetBytes(value), Encoding.UTF8.GetBytes(key)));         }          public static string Decrypt(string value, string key)         {             return Encoding.UTF8.GetString(Encode(Convert.FromBase64String(value), Encoding.UTF8.GetBytes(key)));         }          private static byte[] Encode(byte[] bytes, byte[] key)         {             var j = 0;              for (var i = 0; i &lt; bytes.Length; i++)             {                 bytes[i] ^= key[j];                  if (++j == key.Length)                 {                     j = 0;                 }             }              return bytes;         }     } } <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u044b \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043b\u0438 \u0438 \u0440\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043b\u0438 AES-\u043e\u043c \u043f\u0440\u043e\u0444\u0438\u043b\u044c \u0438\u0437 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f, \u0441\u0440\u0430\u0437\u0443 \u0448\u0438\u0444\u0440\u0443\u0435\u043c \u0432\u0441\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u044d\u0442\u0438\u043c B64X (\u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u044f \u0441\u0430\u043c \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u043b). \u0418 \u0440\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u044b\u0432\u0430\u0435\u043c \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437, \u043a\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u043d\u043e \u0443\u0437\u043d\u0430\u0442\u044c, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u0435\u043d\u0435\u0433 \u0443 \u0438\u0433\u0440\u043e\u043a\u0430, \u043a\u0430\u043a\u043e\u0439 \u0443 \u043d\u0435\u0433\u043e \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0438 \u0442.\u0434. B64X \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043b\u044e\u0447 (\u043f\u0430\u0440\u043e\u043b\u044c) \u0434\u043b\u044f \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0430 \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u043d\u0434\u043e\u043c\u043d\u044b\u0439 \u0441\u0435\u0441\u0441\u0438\u043e\u043d\u043d\u044b\u0439 \u043a\u043b\u044e\u0447, \u0447\u0442\u043e\u0431\u044b \u043c\u044b \u043d\u0435 \u043f\u0430\u0440\u0438\u043b\u0438\u0441\u044c, \u0433\u0434\u0435 \u0438 \u043a\u0430\u043a \u0435\u0433\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c.<\/p>\n<h4>4. \u0417\u0430\u0449\u0438\u0442\u0430 \u0432\u043d\u0443\u0442\u0440\u0438\u0438\u0433\u0440\u043e\u0432\u044b\u0445 \u043f\u043e\u043a\u0443\u043f\u043e\u043a<\/h4>\n<p>  \u0414\u043b\u044f \u043c\u043d\u043e\u0433\u0438\u0445 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u044d\u0442\u0430 \u0442\u0435\u043c\u0430 \u043d\u0435 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u0430 \u0438 \u043c\u0430\u043b\u043e \u043a\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0437\u0430\u0449\u0438\u0442\u0443. \u0412 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435, \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0430\u044f \u0438\u0433\u0440\u0430, \u0442\u043e \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0434\u0443\u043c\u0430\u0442\u044c \u043d\u0430\u0434 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u0435\u0435 \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u043a\u0438. \u0415\u0441\u0442\u044c \u0442\u0430\u043a\u0430\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u2014 Freedom. \u0422\u0440\u0435\u0431\u0443\u0435\u0442 \u0440\u0443\u0442 \u0438, \u0435\u0441\u043b\u0438 \u0432 \u0434\u0432\u0443\u0445 \u0441\u043b\u043e\u0432\u0430\u0445, \u043f\u043e\u0434\u043c\u0435\u043d\u044f\u0435\u0442 \u0441\u0435\u0440\u0432\u0438\u0441 \u0432\u043d\u0443\u0442\u0440\u0438\u0438\u0433\u0440\u043e\u0432\u044b\u0445 \u043f\u043e\u043a\u0443\u043f\u043e\u043a. \u041a\u043e\u0440\u043e\u0447\u0435 \u2014 \u0438\u0433\u0440\u043e\u043a \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0432\u0435\u0440\u0448\u0430\u0442\u044c \u043f\u043e\u043a\u0443\u043f\u043a\u0438 \u0437\u0430 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e.<\/p>\n<p>  \u041e\u043f\u0443\u0441\u0442\u0438\u043c \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u0435 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043f\u043e\u043a\u0443\u043f\u043e\u043a \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430, \u0432\u0435\u0434\u044c \u043d\u0435 \u0443 \u0432\u0441\u0435\u0445 \u043e\u043d \u0435\u0441\u0442\u044c. \u0420\u0430\u0441\u0441\u043a\u0430\u0436\u0443, \u0447\u0442\u043e \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 Google \u0432 \u0442\u0430\u043a\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445.<\/p>\n<p>  \u041f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 Google \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u043f\u0430\u0440\u0443 \u043a\u043b\u044e\u0447\u0435\u0439 \u0434\u043b\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 RSA \u2014 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0439 \u0438 \u0437\u0430\u043a\u0440\u044b\u0442\u044b\u0439 \u043a\u043b\u044e\u0447. \u0415\u0441\u043b\u0438 \u043d\u0435 \u0437\u043d\u0430\u0435\u0442\u0435, \u0447\u0442\u043e \u044d\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u2014 \u043f\u043e\u0433\u0443\u0433\u043b\u0438\u0442\u0435 \u0430\u0441\u0438\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u043e\u0435 \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u0435. \u041e\u0442\u043a\u0440\u044b\u0442\u044b\u0439 \u043a\u043b\u044e\u0447 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/s015.radikal.ru\/i331\/1502\/a5\/a9e65c6c1ab2.png\" alt=\"image\"\/><\/p>\n<p>  \u0412\u044b \u0435\u0433\u043e \u0435\u0449\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 \u043f\u0440\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438 \u0438\u0433\u0440\u043e\u0432\u043e\u0433\u043e \u043c\u0430\u0433\u0430\u0437\u0438\u043d\u0430 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438.<\/p>\n<p>  \u0417\u0430\u043a\u0440\u044b\u0442\u044b\u0439 \u043a\u043b\u044e\u0447 Google \u0432\u0430\u043c \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u043f\u043e\u043a\u0430\u0436\u0435\u0442 \u0438 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0434\u043b\u044f \u0446\u0438\u0444\u0440\u043e\u0432\u043e\u0439 \u043f\u043e\u0434\u043f\u0438\u0441\u0438 \u043f\u043e\u043a\u0443\u043f\u043e\u043a. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0437\u0430\u043a\u0440\u044b\u0442\u044b\u043c \u043a\u043b\u044e\u0447\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u044c, \u0430 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c \u043a\u043b\u044e\u0447\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u044c.<\/p>\n<p>  \u041c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0437\u0430\u0449\u0438\u0442\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u2014 Google \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0432\u0441\u0435 json-\u043e\u0442\u0432\u0435\u0442\u044b \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043f\u043e\u043a\u0443\u043f\u043e\u043a, \u0438 \u043d\u0438\u043a\u0442\u043e \u0434\u0440\u0443\u0433\u043e\u0439 \u0442\u0430\u043a\u0443\u044e \u043f\u043e\u0434\u043f\u0438\u0441\u044c \u043f\u043e\u0434\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435 \u043c\u043e\u0436\u0435\u0442. \u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a, \u0437\u043d\u0430\u044f \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0439 \u043a\u043b\u044e\u0447, \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0446\u0438\u0444\u0440\u043e\u0432\u0443\u044e \u043f\u043e\u0434\u043f\u0438\u0441\u044c \u043e\u0442\u0432\u0435\u0442\u043e\u0432 \u0441\u0435\u0440\u0432\u0435\u0440\u0430. \u0418 \u0435\u0441\u043b\u0438 \u0441\u0435\u0440\u0432\u0435\u0440 \u0431\u044b\u043b \u0441\u0444\u0430\u0431\u0440\u0438\u043a\u043e\u0432\u0430\u043d \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Freedom, \u0442\u043e \u0446\u0438\u0444\u0440\u043e\u0432\u0430\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u044c \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0430\u044f.<\/p>\n<p>  \u041f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043e\u0434\u043d\u0443 \u043d\u0435\u043f\u0440\u0438\u044f\u0442\u043d\u0443\u044e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e. \u041d\u0443\u0436\u043d\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0439 base64 \u043a\u043b\u044e\u0447 \u0438\u0437 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u0432 xml-\u043a\u043b\u044e\u0447, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0434\u043e\u0439\u0434\u0435\u0442 \u0434\u043b\u044f \u0434\u0435\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u0438. \u0421\u0432\u0438\u0434\u0443 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0440\u0430\u0441\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e base64. \u041d\u043e \u044d\u0442\u043e \u043d\u0435 \u0442\u0430\u043a. \u041f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u043d\u043b\u0430\u0439\u043d \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u043c \u0438 \u0441\u0440\u0430\u0437\u0443 \u043f\u0440\u0438\u043a\u043e\u043f\u0430\u0442\u044c xml-\u043a\u043b\u044e\u0447 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438. \u041e\u0441\u043e\u0431\u043e \u0437\u0430\u043c\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043e \u0435\u0433\u043e \u0437\u0430\u0449\u0438\u0442\u0435 \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u2014 \u044d\u0442\u043e \u0436\u0435 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0439 \u043a\u043b\u044e\u0447. \u0415\u0433\u043e \u043c\u043e\u0433\u0443\u0442 \u0441\u0444\u0430\u0431\u0440\u0438\u043a\u043e\u0432\u0430\u0442\u044c, \u043d\u043e \u044d\u0442\u043e \u0443\u0436\u0435 \u0434\u0440\u0443\u0433\u0430\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u044f. \u0418\u0442\u0430\u043a, \u0441\u0435\u0440\u0432\u0438\u0441 \u0432\u043e\u0442, \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0442\u0443\u0434\u0430 \u0441\u0432\u043e\u0439 base64 \u043a\u043b\u044e\u0447 \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c xml-\u043a\u043b\u044e\u0447: <a href=\"http:\/\/superdry.apphb.com\/tools\/online-rsa-key-converter\">superdry.apphb.com\/tools\/online-rsa-key-converter<\/a><\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/s04.radikal.ru\/i177\/1502\/4c\/ea55f93ff94e.png\" alt=\"image\"\/><\/p>\n<p>  \u0412 \u043d\u0438\u0436\u043d\u0435\u043c \u043f\u043e\u043b\u0435 \u0438 \u0435\u0441\u0442\u044c \u043d\u0430\u0448 xml-\u043a\u043b\u044e\u0447. \u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0435\u0433\u043e \u0432 \u0438\u0433\u0440\u0435 \u0438\u043b\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438. \u0410 \u0434\u0430\u043b\u044c\u0448\u0435 \u0432\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e. Google \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043d\u0430\u043c \u043f\u043e\u043a\u0443\u043f\u043a\u0443. \u0415\u0441\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0439 \u043f\u043b\u0430\u0433\u0438\u043d \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e\u043a\u0443\u043f\u043e\u043a OpenIAB, \u0442\u043e \u044d\u0442\u043e \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 Purchase, \u0443 \u043d\u0435\u0433\u043e \u0435\u0441\u0442\u044c 2 \u043d\u0443\u0436\u043d\u044b\u0445 \u043d\u0430\u043c \u043f\u043e\u043b\u044f:<\/p>\n<pre><code class=\"cs\">Purchase purchase;  var json = purchase.OriginalJson; var signature = purchase.Signature; <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043f\u043e\u0434\u043f\u0438\u0441\u0438:<\/p>\n<pre><code class=\"cs\">using System; using System.Security.Cryptography;  namespace Assets.Scripts.Common {     public static class GooglePlayPurchaseGuard     {         \/\/\/ &lt;summary&gt;         \/\/\/ Verify Google Play purchase. Protect you app against hack via Freedom. More info: http:\/\/mrtn.me\/blog\/2012\/11\/15\/checking-google-play-signatures-on-net\/         \/\/\/ &lt;\/summary&gt;         \/\/\/ &lt;param name=&quot;purchaseJson&quot;&gt;Purchase JSON string&lt;\/param&gt;         \/\/\/ &lt;param name=&quot;base64Signature&quot;&gt;Purchase signature string&lt;\/param&gt;         \/\/\/ &lt;param name=&quot;xmlPublicKey&quot;&gt;XML public key. Use http:\/\/superdry.apphb.com\/tools\/online-rsa-key-converter to convert RSA public key from Developer Console&lt;\/param&gt;         \/\/\/ &lt;returns&gt;&lt;\/returns&gt;         public static bool Verify(string purchaseJson, string base64Signature, string xmlPublicKey)         {             using (var provider = new RSACryptoServiceProvider())             {                 try                 {                     provider.FromXmlString(xmlPublicKey);                      var signature = Convert.FromBase64String(base64Signature);                     var sha = new SHA1Managed();                     var data = System.Text.Encoding.UTF8.GetBytes(purchaseJson);                      return provider.VerifyData(data, sha, signature);                 }                 catch (Exception e)                 {                     UnityEngine.Debug.Log(e);                 }                  return false;             }         }     } } <\/code><\/pre>\n<p>  \u041d\u0443 \u0438 \u0442\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u043e\u0442 Google \u043f\u0440\u0438\u0448\u0435\u043b \u043e\u0442\u0432\u0435\u0442, \u0447\u0442\u043e \u043f\u043e\u043a\u0443\u043f\u043a\u0430 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u0430, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0435\u0435 \u043f\u043e\u0434\u043f\u0438\u0441\u044c \u0438 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0438\u0433\u0440\u043e\u043a\u0443 \u0444\u0438\u0433\u0443, \u0435\u0441\u043b\u0438 \u043f\u043e\u0434\u043f\u0438\u0441\u044c \u043d\u0435 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442:<\/p>\n<pre><code class=\"cs\">if (GooglePlayPurchaseGuard.Verify(purchase.OriginalJson, purchase.Signature, publicKeyXml)) { } else { } <\/code><\/pre>\n<p>  \u0425\u043e\u0447\u0443 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043f\u0440\u0438 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0438 \u043f\u043e\u043a\u0443\u043f\u043a\u0438 \u043b\u0443\u0447\u0448\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0440\u0430\u043d\u0434\u043e\u043c\u043d\u044b\u0439 payload \u043a \u0437\u0430\u043f\u0440\u043e\u0441\u0443, \u044d\u0442\u043e \u0437\u0430\u0449\u0438\u0442\u0438\u0442 \u043e\u0442 \u0430\u0442\u0430\u043a man-in-the-middle, \u043a\u043e\u0433\u0434\u0430 \u0432\u0430\u043c \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u043f\u043e\u0434\u043f\u0438\u0445\u0438\u0432\u0430\u0442\u044c \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0439 \u043e\u0442\u0432\u0435\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0441 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0439, \u043d\u043e \u043e\u0434\u043d\u043e\u0439 \u0438 \u0442\u043e\u0439 \u0436\u0435 \u0446\u0438\u0444\u0440\u043e\u0432\u043e\u0439 \u043f\u043e\u0434\u043f\u0438\u0441\u044c\u044e. \u042d\u0442\u043e \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0432 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 OpenIAB, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u043a\u043b\u0430\u0434\u0443\u0442 \u0431\u043e\u043b\u0442:<\/p>\n<pre><code class=\"cs\">public static void purchaseProduct(string sku, string developerPayload = &quot;&quot;) <\/code><\/pre>\n<p>  \u0411\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043d\u0430 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u043e\u043c \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435: <a href=\"http:\/\/mrtn.me\/blog\/2012\/11\/15\/checking-google-play-signatures-on-net\/\">mrtn.me\/blog\/2012\/11\/15\/checking-google-play-signatures-on-net\/<\/a><\/p>\n<h4>5. \u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u044b\u043b\u0430 \u043d\u0435 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0437\u0430\u043d\u0443\u0434\u043d\u0430\u044f. \u0412 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0434\u0435\u043b\u0430\u0439\u0442\u0435 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0438\u0433\u0440\u044b \u0438 \u0434\u0430\u0440\u0438\u0442\u0435 \u0438\u0433\u0440\u043e\u043a\u0430\u043c \u043d\u043e\u0432\u044b\u0435 \u0432\u043f\u0435\u0447\u0430\u0442\u043b\u0435\u043d\u0438\u044f!<br \/>  P.S. \u0412 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u0442\u044f\u043d\u0435\u0442 \u0432 \u0438\u0433\u0440\u043e\u0432\u0443\u044e \u0438\u043d\u0434\u0443\u0441\u0442\u0440\u0438\u044e \u0438 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0441\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u0444\u0435\u0440\u0443 \u0434\u0435\u044f\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438)      \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/249681\/\"> http:\/\/habrahabr.ru\/post\/249681\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">     \t\u0412\u0441\u0435\u043c \u0441\u043d\u043e\u0432\u0430 \u0437\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439\u0442\u0435! \u0414\u043e\u0448\u043b\u0438 \u0440\u0443\u043a\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u0440\u0443\u0442\u0443\u044e \u0441\u0442\u0430\u0442\u044c\u044e \u043d\u0430 \u0432\u0435\u0441\u044c\u043c\u0430 \u0432\u0430\u0436\u043d\u0443\u044e \u0442\u0435\u043c\u0443 \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0438\u0433\u0440. \u0418\u0442\u0430\u043a, \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e \u0437\u0430\u0449\u0438\u0442\u0435 \u0432\u0430\u0448\u0438\u0445 \u0434\u0440\u0430\u0433\u043e\u0446\u0435\u043d\u043d\u044b\u0445 \u0438\u0433\u0440 \u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u043f\u0438\u043b\u0438\u0442\u0435 \u043d\u0430 Unity \u0432 \u043d\u0430\u0434\u0435\u0436\u0434\u0435 \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0430 \u0431\u0443\u0445\u0430\u043d\u043a\u0443 \u0445\u043b\u0435\u0431\u0430, \u043e\u0442 \u0432\u0437\u043b\u043e\u043c\u0430 \u0437\u043b\u043e\u0431\u043d\u044b\u043c\u0438 \u0448\u043a\u043e\u043b\u044c\u043d\u0438\u043a\u0430\u043c\u0438. \u041f\u043e\u0447\u0435\u043c\u0443 \u0448\u043a\u043e\u043b\u044c\u043d\u0438\u043a\u0430\u043c\u0438? \u041f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043d\u0430\u0434\u0435\u0436\u043d\u043e\u0439 \u043d\u0430 100% \u0437\u0430\u0449\u0438\u0442\u044b \u0430\u043f\u0440\u0438\u043e\u0440\u0438 \u0431\u044b\u0442\u044c \u043d\u0435 \u043c\u043e\u0436\u0435\u0442. \u0418 \u043a\u0442\u043e \u0437\u0430\u0445\u043e\u0447\u0435\u0442, \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u0432\u0437\u043b\u043e\u043c\u0430\u0435\u0442. \u0412\u043e\u043f\u0440\u043e\u0441 \u043b\u0438\u0448\u044c \u0432 \u0442\u043e\u043c, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0438 \u0441\u0438\u043b \u043e\u043d \u043d\u0430 \u044d\u0442\u043e \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u0442. \u0418 \u043a\u0430\u043a \u043b\u044e\u0431\u044f\u0442 \u0448\u0443\u0442\u0438\u0442\u044c \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u0438\u043a\u0438 \u2014 \u0442\u0435\u0440\u043c\u043e\u0440\u0435\u043a\u0442\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u0440\u0438\u043f\u0442\u043e\u0430\u043d\u0430\u043b\u0438\u0437 \u043d\u0438\u043a\u0442\u043e \u043d\u0435 \u043e\u0442\u043c\u0435\u043d\u044f\u043b.<\/p>\n<p>  \u0418\u0442\u0430\u043a, \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u044e\u0441\u044c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043e 3 \u0430\u0441\u043f\u0435\u043a\u0442\u0430\u0445 (\u0438 \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0443 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e):  <\/p>\n<ul>\n<li>\u0437\u0430\u0449\u0438\u0442\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f (\u0441\u0435\u0439\u0432\u043e\u0432)<\/li>\n<li>\u0437\u0430\u0449\u0438\u0442\u0430 \u043f\u0430\u043c\u044f\u0442\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/li>\n<li>\u0437\u0430\u0449\u0438\u0442\u0430 \u0432\u043d\u0443\u0442\u0440\u0438\u0438\u0433\u0440\u043e\u0432\u044b\u0445 \u043f\u043e\u043a\u0443\u043f\u043e\u043a (Google Play)<\/li>\n<\/ul>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/9f9\/dc3\/9f3\/9f9dc39f333a014c0d7119f780a67f8d.jpg\" alt=\"image\"\/><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-249681","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/249681","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=249681"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/249681\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=249681"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=249681"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=249681"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}