Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
avatar image
1
Question by stevesmith_styku · May 13, 2016 at 08:48 PM · monoreleasebest practicescertificatedistribution

What is the best way to add root certificates to a unity build for distribution?

I have solved the issue of getting web requests to work in Unity scripts in this answer: http://answers.unity3d.com/questions/1184815/how-to-stop-mono-from-preventing-authentication.html#answer-1186348

However, manually adding certs by command line for all computers that needs to run my build isn't a great solution. I mean I guess from one of my scripts I could make a call to System.Diagnostics.Process.Start with the command I need. But that's really hacky.

Is there a better way to include the root certs I need with my unity application, that travels with my build files, and can be installed along with the application on another computer? Or am I stuck with this hack?

Comment
Add comment · Show 1
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 iamarugin · Aug 11, 2017 at 05:30 AM 0
Share

Did you find any solution that will work on linux/mac too?

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by stevesmith_styku · Oct 21, 2016 at 01:07 AM

Well I'll go ahead and add a response to my own unanswered question.... it turns out Mono uses a specific directory to store it's certs. On windows the default location appears to be in [local user]\AppData\Roaming.mono\certs\Trust. So what you can do is use mozroots (using an elevated command prompt) to download the certs into this directory, then copy them to whichever machine needs them.

This gets me close! But the problem I have now is that I need this location to be in a place where all users can access, because I don't want to have to manually copy these certs for each user on the machine. I wonder if there is a way to change the directory mono reads these certs from, or is it hard coded? Any ideas?

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 Seraphic572 · Jun 21, 2017 at 02:06 PM 0
Share

Can some help me out with this exception

TlsException: The authentication or decryption has failed. $$anonymous$$ono.Security.Protocol.Tls.RecordProtocol.ProcessAlert (AlertLevel alertLevel, AlertDescription alertDesc) $$anonymous$$ono.Security.Protocol.Tls.RecordProtocol.InternalReceiveRecordCallback (IAsyncResult asyncResult) Rethrow as IOException: The authentication or decryption has failed. $$anonymous$$ono.Security.Protocol.Tls.SslStreamBase.AsyncHandshakeCallback (IAsyncResult asyncResult) Rethrow as $$anonymous$$qttConnectionException: Exception connecting to the broker uPLibrary.Networking.$$anonymous$$2$$anonymous$$qtt.$$anonymous$$qttClient.Connect (System.String clientId, System.String username, System.String password, Boolean willRetain, Byte willQosLevel, Boolean willFlag, System.String willTopic, System.String will$$anonymous$$essage, Boolean cleanSession, UInt16 keepAlivePeriod) uPLibrary.Networking.$$anonymous$$2$$anonymous$$qtt.$$anonymous$$qttClient.Connect (System.String clientId) $$anonymous$$qttPublisher.Publish () (at Assets/$$anonymous$$qttPublisher.cs:48) Client.Start () (at Assets/Client.cs:30)

avatar image
0

Answer by iamarugin · Aug 11, 2017 at 06:52 AM

@stevesmith_styku You can import root certificates at runtime:

 var path; //Path to root certificate
  using (X509Store store = new X509Store(StoreName.Root, StoreLocation.CurrentUser)) {
     store.Open(OpenFlags.ReadWrite);
     store.Add(new X509Certificate2(X509Certificate2.CreateFromCertFile(path))); //where cert is an X509Certificate object
  }
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 floriankorsakissoksah · Jan 23, 2019 at 12:45 PM 0
Share

Actually, the X509Store is not available in Unity, on purpose. The store is not available on many platforms supported by Unity. If you try to run the code above, it will not actually add the certificate in the needed store.

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

56 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 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 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

Bizarre compile errors in Unity while Visual Studio will build project successfully 0 Answers

Unable to call web data ("TlsException: The server stopped the handshake") 1 Answer

Is it OK to make a profit with LEGO Microgame? 0 Answers

Level multiple data values should I use a list? 0 Answers

Drastically worse performance with IL2CPP compared to Mono on Android 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