OpenSSLSecureConnection does not run on Android mobile apps

Discussions regarding 1C:Enterprise for mobile devices with Android, iOS, or Windows Phone.

#1
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Oct 16, 2018
Company: Royal Ceramic Group

I need to get data from a website that uses https protocol.

I ran a test on my PC and got the data from that website.

However, when I build to a mobile app running on Android, it doesn't work.

Can you help me with this problem?

This is my code:

HttpConnection = New HTTPConnection(host, 443,usr,pwd,,,New OpenSSLSecureConnection);

 
#2
People who like this:0Yes/0No
Administrator
Rating: 23
Joined: Oct 3, 2019
Company:

Hello Thanh Son Nguyen,

could you show the error message?

 
#3
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Oct 16, 2018
Company: Royal Ceramic Group

The response status is 403 (pic: OpenSSL_Error.jpg)

I think OpenSSLSercureConnection not run on Mobile App (Android and iOS - I also test on iOS mobile app).

Thanks for your help.

 
#4
People who like this:0Yes/0No
Administrator
Rating: 23
Joined: Oct 3, 2019
Company:

Hello Thanh Son Nguyen,

OpenSSLConnection is available on the mobile platform.

The problem is most likely that when creating an OpenSSLConnection, we also need to specify the Client certificate for the connection.

Syntax:
New OpenSSLSecureConnection(<ClientCertificate>, <CertificationAuthorityCertificates>)

Description:
<ClientCertificate>
If the source of the client certificate is not specified, you can connect only to the servers that do not require the client certificate.

Does the site you want to connect to open in a browser on a mobile device?

 
#5
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Oct 16, 2018
Company: Royal Ceramic Group

Hi, Aleksandr Biryukov

I also have this function to create secure connection:

Function CreateSecureConnection(ClientCertificate = Undefined, CertificationAuthorityCertificates = Undefined) Export

#If WebClient Then
Return Undefined;
#ElsIf MobileClient Then
Return New OpenSSLSecureConnection(New OSClientCertificate, New OSCertificationAuthorityCertificates);
#Else
Return New OpenSSLSecureConnection(ClientCertificate, CertificationAuthorityCertificates);
#EndIf      

EndFunction

But I can run mobile app on pc for test, it does not run when I build apk for Android or XCode project for iOS.
On Android, I install apk file to  BlueStack Simmulate device
On iOS, I upload to TestFlight for test.

 
#6
People who like this:0Yes/0No
Administrator
Rating: 23
Joined: Oct 3, 2019
Company:

Hello,

tell me pls what version of the platform do you use? "OSClientCertificate" is available only with version 8.3.21.

 
#7
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Oct 16, 2018
Company: Royal Ceramic Group

Hello,

Mobile platform is 8.3.22
1C Platform is 8.3.22

 
#8
People who like this:0Yes/0No
Administrator
Rating: 23
Joined: Oct 3, 2019
Company:

Ok, then let's do the following:

Is webserver you want to connect from 1C your server? Does it work on IIS or Apache?

 
#9
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Oct 16, 2018
Company: Royal Ceramic Group

Hello Aleksandr Biryukov,

I explain about this scenario:
1. I'm writing a Mobile app to check inventory for sale.
2. To determine the selling price, it is necessary to check the price at another website.
3. This website uses a secure SSL connection and requires an account to access.
4. I run a test on my PC to check that the connection to this website is OK.
5. But when I build the apk file to run on Android, it can't connect. Report Response Status = 403.

 
#10
People who like this:0Yes/0No
Administrator
Rating: 23
Joined: Oct 3, 2019
Company:

Hey Thanh Son Nguyen,

I understand your scenario :-)

The most likely reason that the connection is not created is that the application does not receive a client certificate from the server. If in Windows this happens by itself, then in Android it does not always happen automatically.

Therefore, to solve the problem when creating a connection, we need to specify the path to the local user certificate. But before that, this certificate must be obtained from the server.

That's why I asked - do you have access to the server? Or is it not your server?

 
#11
People who like this:0Yes/0No
Administrator
Rating: 23
Joined: Oct 3, 2019
Company:

And one more thing - if this is your server, then to rule out other errors, I would first make a test connection without SSL to check if everything works.

And only after that would I switch to using SSL :-)

 
#12
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Oct 16, 2018
Company: Royal Ceramic Group

Hello Aleksandr Biryukov,

This is not my server.
This is a 3rd party service that provides market price information.
My customers must have an account to access that service.

 
#13
People who like this:0Yes/0No
Administrator
Rating: 23
Joined: Oct 3, 2019
Company:

OK,

is it possible for you to test the work without using SSL for first?

 
#14
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Oct 16, 2018
Company: Royal Ceramic Group

Yes, it is ok without SSL

 
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)
Be the first to know tips & tricks on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.