Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Jix · Jun 08, 2014 at 08:42 AM · wwwsecuritywwwform

How to secure important data in code

Hello,

I have a code that downloads levels from an ftp server link that requires a username and password, how do I protect the link, username, and password from hackers or reverse engineers? My code looks like this:

     public tk2dTextMesh msg;
     public LevelList levels;
 
     void LoadFromWWW()
     {
         StartCoroutine(link());
     }
 
     IEnumerator link()
     {
         string form = "&Username=username" + "&Password=mypass";
         WWW www = new WWW("ftp://myServer.COM/gameData/levels.xml" + "/?" + form);
         yield return www;
         if (!string.IsNullOrEmpty(www.error))
         {
             msg.text = "Error: " + www.error;
         }
         else if (!string.IsNullOrEmpty(www.text))
         {
             // convert string to stream
             byte[] byteArray = Encoding.UTF8.GetBytes(www.text);
             MemoryStream assetStream = new MemoryStream(byteArray);
             XmlSerializer xml = new XmlSerializer(typeof(LevelList));
             levels = xml.Deserialize(assetStream) as LevelList;
             msg.text = levels.list.Count.ToString();
 
             assetStream.Close();
         }
         else
             msg.text = "Empty";
     }

I read somewhere that someone may open my code somehow and can read my link easily, what should I do?

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image fafase · Jun 08, 2014 at 09:29 AM 0
Share

Using encryption, like md5. Plenty of example overt the internet.

avatar image Jix · Jun 08, 2014 at 12:23 PM 0
Share

I'm sorry but it seems that I wasn't clear enough, I'm writing my own pass and username in the code itself as you can see in my code. What I'm afraid of is that someone may break my published build and do reverse engineering and manage to open my code. He can read my link, pass and password right of the code.

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Bunny83 · Jun 08, 2014 at 10:19 AM

The answer is simple:

  • Don't store such data in the client

  • Use temporary credentials which are generated "on the fly" on the server and only last for limited time.

The general rule is: You can't store such information in a secure way on the client side.

Fact is if you allow access to a certain resource on your server, it can be accessed. The only way to limit that access is on the server side. If you want to offer certain resources only to certain users, it's a matter of how do you identify / distinguish those users on the server side?

If you're not interested in hiding certein resources / levels from those who aren't allowed to load them, there's no need to secure anything. If all users should be able to download the levels, just use a generic FTB user + password. Make sure that user only has read access to the desired files.

Such things are usually easier to handle on a webserver with PHP or any other serverside scripting language.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Jix · Jun 08, 2014 at 12:26 PM 0
Share

Ok, clear enough. So putting the link with username and password like that in the code isn't a secure way.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

22 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

WWW/WWWForm, does Unity validate SSL certificates over HTTPS? 0 Answers

WWW/WWWForm, does Unity validate SSL certificates? 1 Answer

How do I use RESTful apis from Unity? 0 Answers

OAuth process 0 Answers

Why isn't this $_POST working properly? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges