Https from as3 air project in webservice using as3httpclientlib

I am trying to change the implementation of webservice that I made to use HTTPS.

I used as3httpclientlib ( https://code.google.com/p/as3httpclientlib/ ).

When I use an endpoint other than ssl, it works as expected.

However, when I use the SSL endpoint and version 1.3 of as3crypt from the download page ( https://code.google.com/p/as3crypto/downloads/list ) or as3crypto-1_3_patched.swc I get the following:

 I DONT KNOW HOW TO HANDLE DER stuff of TYPE 22 I DONT KNOW HOW TO HANDLE DER stuff of TYPE 22 I DONT KNOW HOW TO HANDLE DER stuff of TYPE 22 I DONT KNOW HOW TO HANDLE DER stuff of TYPE 22 I DONT KNOW HOW TO HANDLE DER stuff of TYPE 12 I DONT KNOW HOW TO HANDLE DER stuff of TYPE 22 I DONT KNOW HOW TO HANDLE DER stuff of TYPE 22 I DONT KNOW HOW TO HANDLE DER stuff of TYPE 22 I DONT KNOW HOW TO HANDLE DER stuff of TYPE 22 [Fault] exception, information=TypeError: Error #1009: Cannot access a property or method of a null object reference. 

With traces coming from line 123 DER.as https://code.google.com/p/as3crypto/source/browse/trunk/as3crypto/src/com/hurlant/util/der/DER.as?r=7 and error from line 225 X509Certificate.as https://code.google.com/p/as3crypto/source/browse/trunk/as3crypto/src/com/hurlant/crypto/cert/X509Certificate.as?spec=svn28&r=7

When I use the latest version of as3crypt https://code.google.com/p/as3crypto/source/detail?r=28 , I get

 [Fault] exception, information=Error: couldn't parse DER stream. 

Thrown out of line 23 https://code.google.com/p/as3crypto/source/browse/trunk/as3crypto/src/com/hurlant/util/asn1/type/SetType.as

The web service I'm trying to access is located on azurewebsites, so it will use the * .azurewebsites.net certificate.

I also use the ASC2 compiler, this caused a couple of errors that I had to fix in the crypto if (hex.length&1==1) hex="0"+hex; , including changing if (hex.length&1==1) hex="0"+hex; before if ((hex.length&1)==1) hex="0"+hex; I found here a syntax error com.hurlant.util.hex on air sdk 3.5

I'm starting to think that this may be due to the way SSL is performed on Azure sites, because when I completely cancel the request, I still get the same error, but pointing to https://www.google.com , I not getting errors.

They declare on their website:

HTTPS does not always work. There are some minor bugs with as3crypto, so, for example, https on yahoo and yahoo belongs to Domains (for example, delicious) do not currently work.

I looked at the list of problems for as3crypt and wondered if one of them had a fix: https://code.google.com/p/as3crypto/issues/list

Does anyone know why I am getting these errors (what is it that azure works differently with their certificate (can this be a wildcard?) And how can I fix it? Is there a supported version of as3crypto? Or is there a better way to use https services in Air mobile apps?

**** **** UPDATE

I tried using a fixed version of as3crypto, but still not fun. Below is a copy of my stack trace for its errors. Does this seem to be an error while parsing the certificate?

enter image description here

I also saw the switch to SecureSocket, but unfortunately it is not supported on iOS.

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/SecureSocket.html

AIR Profile Support: This feature is supported on all computers on operating systems, but is not supported on all AIR TV devices. On mobile devices, supported on Android, but not on iOS. You can check run-time support using the SecureSocket.isSupported property.

FOR RECREATION:

Make a receipt request to any subdomain https azurewebsites.net.

those. The following code will be played:

 var client:HttpClient = new HttpClient(); client.get(new URI("https://httpstest.azurewebsites.net")); 
+4
source share
2 answers

I have the same problem with decorating DER, and fixing this problem helped me: http://code.google.com/p/as3crypto/issues/detail?id=39

What about:

Or is there a better way to use https web services in Air mobile apps?

You can try replacing TLSSocket on as3crypto with the built-in Flash SecureSocket in as3httpclient, I think this should not be too difficult to do. In my project, I tried using both SecureSoket and TLSSocket and stood on TLSSocket because SecureSoket requires FP 11 and does not work with the self-signed certificates that we use on the test server, but SecureSoket also works fine and showed even better performance, TLSSocket . You can also grab the already fixed version of as3crypto from my github ( https://github.com/fsbmain/as3public ) :)

If you still have problems, provide the endpoint of your web service, so I can check it.

UPD:

I was able to reproduce your problem and tested the parsing of the certificate with my corrected as3crypto lib (it still allows you to understand the parsing more deeply), I also tested parsing the same certificate, but it loaded in the browser - the same result in both (as in the screenshot), so the conclusion is that TLSSocket downloads the correct and complete bytes of the certificate, but does not parse it. I tried to fix the parsing, but it requires a deeper immersion in the as3crypto DER implementation. Therefore, I am afraid that the only way to use as3httpclient is to fix DER parsing.

By the way, why does the standard URLLoader not suit you?

+1
source

The as3crypto.swc file is here: http://www.igniterealtime.org/downloads/download-landing.jsp?file=xiff/xiff_3_1_0.zip solved my problem.

as3crypto.swc is located in the libs folder after extraction.

+1
source

Source: https://habr.com/ru/post/1501332/


All Articles