Desktop version

Main > Forum > 1C:Enterprise Platform > 1C:Enterprise. Mobile platform > OpenSSLSecureConnection does not run on Android mobile apps

Forum

Search UsersRules
OpenSSLSecureConnection does not run on Android mobile apps
#1
Just came
Points:: 0
Joined:: Oct 16, 2018

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);

Profile
#2
Administrator
Points:: 0
Joined:: Oct 3, 2019

Hello Thanh Son Nguyen,

could you show the error message?

Profile
#3
Just came
Points:: 0
Joined:: Oct 16, 2018

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.

Profile
#4
Administrator
Points:: 0
Joined:: Oct 3, 2019

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?

Profile
#5
Just came
Points:: 0
Joined:: Oct 16, 2018

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.

Profile
#6
Administrator
Points:: 0
Joined:: Oct 3, 2019

Hello,

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

Profile
#7
Just came
Points:: 0
Joined:: Oct 16, 2018

Hello,

Mobile platform is 8.3.22
1C Platform is 8.3.22

Profile
#8
Administrator
Points:: 0
Joined:: Oct 3, 2019

Ok, then let's do the following:

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

Profile
#9
Just came
Points:: 0
Joined:: Oct 16, 2018

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.

Profile
#10
Administrator
Points:: 0
Joined:: Oct 3, 2019

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?

Profile
#11
Administrator
Points:: 0
Joined:: Oct 3, 2019

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 :-)

Profile
#12
Just came
Points:: 0
Joined:: Oct 16, 2018

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.

Profile
#13
Administrator
Points:: 0
Joined:: Oct 3, 2019

OK,

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

Profile
#14
Just came
Points:: 0
Joined:: Oct 16, 2018

Yes, it is ok without SSL

Profile
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)



© 1C LLC. All rights reserved
1C Company respects the privacy of our customers and visitors
to our Web-site.