forked from organicmaps/organicmaps
[DNM] [android] Enabled ssl cert checking. Disabled the rich page for Booking. (#4566)
* [android] Enabled SSL certificate checking * [android] Disabled reach page for Booking * [android] Disabled ssl cerificate checking for debug configuration
This commit is contained in:
parent
6348e02a11
commit
bccbddf3af
2 changed files with 19 additions and 4 deletions
|
@ -1,12 +1,15 @@
|
|||
package com.mapswithme.maps.location;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.net.SSLCertificateSocketFactory;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
|
||||
import com.mapswithme.maps.BuildConfig;
|
||||
import com.mapswithme.util.log.DebugLogger;
|
||||
import com.mapswithme.util.log.Logger;
|
||||
|
||||
import javax.net.SocketFactory;
|
||||
import javax.net.ssl.SSLSocketFactory;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
@ -74,11 +77,9 @@ class SocketWrapper implements PlatformSocket
|
|||
{
|
||||
if (ssl)
|
||||
{
|
||||
//TODO: use a boolean flag about using the secure or insecure ssl socket (must be done before release!)
|
||||
//https://jira.mail.ru/browse/MAPSME-2786
|
||||
SSLSocketFactory sf = SSLCertificateSocketFactory.getInsecure(0, null);
|
||||
try
|
||||
{
|
||||
SocketFactory sf = getSocketFactory();
|
||||
return sf.createSocket(host, port);
|
||||
} catch (IOException e)
|
||||
{
|
||||
|
@ -98,6 +99,20 @@ class SocketWrapper implements PlatformSocket
|
|||
return null;
|
||||
}
|
||||
|
||||
|
||||
@SuppressLint("SSLCertificateSocketFactoryGetInsecure")
|
||||
@NonNull
|
||||
private static SocketFactory getSocketFactory()
|
||||
{
|
||||
// Trusting to any ssl certificate factory that will be used in
|
||||
// debug mode, for testing purposes only.
|
||||
if (BuildConfig.DEBUG)
|
||||
//TODO: implement the custom KeyStore to make the self-signed certificates work
|
||||
return SSLCertificateSocketFactory.getInsecure(0, null);
|
||||
|
||||
return SSLSocketFactory.getDefault();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close()
|
||||
{
|
||||
|
|
|
@ -97,7 +97,7 @@ public class PlacePageView extends RelativeLayout
|
|||
private static final String PREF_USE_DMS = "use_dms";
|
||||
|
||||
//TODO: remove this after booking_api.cpp will be done
|
||||
private static final boolean USE_OLD_BOOKING = false;
|
||||
private static final boolean USE_OLD_BOOKING = true;
|
||||
|
||||
private boolean mIsDocked;
|
||||
private boolean mIsFloating;
|
||||
|
|
Loading…
Add table
Reference in a new issue