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 PoL. · Apr 24, 2014 at 12:05 PM · webplayerclientconnectionauthenticationssl

Why can't I access the constructor: X509Certificate2 (Byte[], String) on Web platform?

I'm trying to use client certificate for SSL connection, like this:

 [...]
 X509Certificate2Collection collection = new X509Certificate2Collection ();
 collection.Add (new X509Certificate2 (pfxCertFile.bytes, "password"));
 stream.AuthenticateAsClient ("server", collection, SslProtocols.Ssl3, false);
 [...]

It works on Andoird platform but on WebPlayer a get this error:

The type System.Security.Cryptography.X509Certificates.X509Certificate2' does not contain a constructor that takes 2' arguments

In WebPlayer platform I have access to these contructors:

 X509Certificate2:
 X509Certificate2 (Byte[])
 X509Certificate2 (String)
 X509Certificate2 (X509Certificate)

 X509Certificate:
 X509Certificate (Byte[])
 X509Certificate (X509Certificate)
 X509Certificate ()
 X509Certificate (SerializationInfo, StreamingContext)

I'm using a PFX file that contains the certificat and private key (self signed). To access the file I need to specify password.

My quiestion is:

How can I pass the PFX file and password to the X509Certificate object on WebPlayer platform?

Is there another way to get the 'AuthenticateAsClient ()' with client cert working on WebPlayer platform?

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 PoL. · Jul 01, 2014 at 01:38 PM 0
Share

@Fragmental

Hi, I'm trying to connect to host via sockets. The connection is established without any problem when there is no client side certificate.

As I mentioned before, i'm trying to authenticate to the host with a self signed certificate, and it works on Android platform. But after switching to Web player, the same constructor used to pass the PFX cert file isn't available at compile time.

2 Replies

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

Answer by Bunny83 · Jul 01, 2014 at 02:08 PM

Well, that's most likely for security reasons. Since webrequests are actually executed through the browser itself, it might be a security risk to allow to create a certificate with private key.

Take a look at the MonoCompatibility page (it takes some time to fully load since it's huge, so be patient) and search for X509Certificate2. There you see which members are supported and which are not.

The Unitywebplayer already bypasses certain restrictions of the security sandbox of the browser since it's a plugin which contains native code. Sometimes it's not obvious why they removed certain members, but if they are only missing in the webplayer, you can be sure it's for security. Keep in mind that someone could inject a unitywebplayer into another site through cross-site-scripting.

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 PoL. · Jul 01, 2014 at 03:24 PM 0
Share

This makes sense, thanks!

avatar image
0

Answer by Fragmental · Jul 01, 2014 at 11:49 AM

If your web player is trying to communicate with a web server, then that web server may need to host a socket server policy file. http://docs.unity3d.com/Manual/SecuritySandbox.html

Comment
Add comment · 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

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

Unity3d HTTPS Get with X509Certificate P12 1 Answer

Asset Server "Role admin does not exist" 3 Answers

Server question on windows 1 Answer

https -- works in IDE & Standalone, does not work in web browser 1 Answer

Unity3D model hosted on site that needs to update to SSL 0 Answers


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