Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 11 Next capture
2021 2022 2023
1 capture
11 Jun 22 - 11 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
3
Question by kkirkfield · Aug 04, 2015 at 12:48 AM · httpsssl

WebException/TlsException during HTTPS Request

I'm trying to communicate with my REST API through HttpWebRequest/Response. I managed to import the CAs from mozroots.exe, but I'm still getting WebExceptions/TlsExceptions.

Here is some example code that tries to use Flickr API test:

 using System.IO;
 using System.Net;
 using UnityEngine;
 
 public class TestScript : MonoBehaviour
 {
     void Start()
     {
         HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://api.flickr.com/services/rest/?method=flickr.test.echo&name=12345");
         request.Method = "POST";
         HttpWebResponse response = (HttpWebResponse)request.GetResponse();
         StreamReader reader = new StreamReader(response.GetResponseStream());
         Debug.Log(string.Format("Code: {0}\nDesc: {1}\nType: {2}\nLength: {3}\nEncoding: {4}\nContent: {5}", response.StatusCode, response.StatusDescription, response.ContentType, response.ContentLength, response.ContentEncoding, reader.ReadToEnd()));
         reader.Close();
         response.Close();
     }
 }
 

And here is the error:

 TlsException: Invalid certificate received from server. Error code: 0xffffffff80092012
 Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.validateCertificates (Mono.Security.X509.X509CertificateCollection certificates)
 Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.ProcessAsTls1 ()
 Mono.Security.Protocol.Tls.Handshake.HandshakeMessage.Process ()
 (wrapper remoting-invoke-with-check) Mono.Security.Protocol.Tls.Handshake.HandshakeMessage:Process ()
 Mono.Security.Protocol.Tls.ClientRecordProtocol.ProcessHandshakeMessage (Mono.Security.Protocol.Tls.TlsStream handMsg)
 Mono.Security.Protocol.Tls.RecordProtocol.InternalReceiveRecordCallback (IAsyncResult asyncResult)
 Rethrow as IOException: The authentication or decryption has failed.
 Mono.Security.Protocol.Tls.SslStreamBase.AsyncHandshakeCallback (IAsyncResult asyncResult)
 Rethrow as WebException: Error getting response stream (Write: The authentication or decryption has failed.): SendFailure
 System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult)
 System.Net.HttpWebRequest.GetResponse ()
 TestScript.Start () (at Assets/TestScript.cs:11)
 

Does anyone know what I'm doing wrong?

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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by kevinzuern · Apr 07, 2017 at 06:22 AM

Unity runs with mono. Check this out: http://www.mono-project.com/docs/faq/security/

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
avatar image
0

Answer by kevinzuern · Apr 07, 2017 at 03:01 PM

I'm a bit late answering this, but for future folks running into this like I did today: Unity runs with mono. Check this out: http://www.mono-project.com/docs/faq/security/

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

25 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

Related Questions

Crossdomain.xml problem in HTTPS / SSL 0 Answers

Does System.Web.HttpWebRequest support SNI in SSL? 2 Answers

Is it possible to do ssl certificate pinning in Unity iOS 1 Answer

WWW with HTTPS on Android not working 0 Answers

Manually validating SSL certificates (no WWW involved) 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