Android拒绝信任安全证书

时间:2018-08-27 19:38:29

标签: android firebase ssl firebase-realtime-database firebase-authentication

我正在Android Studio中开发应用程序,已连接到通过代理传递的公司Internet连接。

我按照以下说明将我们的CA安全证书添加到了该应用中:https://developer.android.com/training/articles/security-config#CustomTrust

除了在Android Studio中安装CA安全证书外,我还特别尝试过该应用不信任该安全证书。

问题特别是通过致电Fairbeace的服务而造成的 写入或读取实时数据 或将崩溃发送至CRASHLIST服务

浏览器可以很好地连接到网络 只有这个应用程式会引起问题

有什么想法吗?

这个manifest.xml文件

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.--------------">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />

<application
    android:usesCleartextTraffic="true"

    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"

    android:networkSecurityConfig="@xml/network_security_config"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity android:name=".MainActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

</application>

结束此network_security_config.xml

<network-security-config>
<domain-config>
    <domain includeSubdomains="true">android.clients.google.com</domain>
    <domain includeSubdomains="true">csecuretoken.googleapis.com</domain>
    <domain includeSubdomains="true">google.com</domain>
    <domain includeSubdomains="true">googleapis.com</domain>
    <domain includeSubdomains="true">mobilenetworkscoring-pa.googleapis.com</domain>
    <domain includeSubdomains="true">www.googleapis.com</domain>
    <domain includeSubdomains="true">gstatic.com</domain>
    <domain includeSubdomains="true">app-measurement.com</domain>
    <trust-anchors>
        <certificates src="@raw/netfreca"/>
        <certificates src="user"/>
        <certificates src="system"/>
    </trust-anchors>
</domain-config>
<base-config>
    <trust-anchors>
        <certificates src="@raw/netfreca"/>
        <certificates src="system"/>
        <certificates src="user"/>
    </trust-anchors>
</base-config>

file certificate Image

这是我的Java代码

 mAuth.createUserWithEmailAndPassword(email, password)
        .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
            @Override
            public void onComplete(@NonNull Task<AuthResult> task) {
                if (task.isSuccessful()) {
                    // Sign in success, update UI with the signed-in user's information
                    Log.d("yoelLog", "createUserWithEmail:success");
                    FirebaseUser user = mAuth.getCurrentUser();
                } else {
                    // If sign in fails, display a message to the user.
                    Log.w("yoelLog", "createUserWithEmail:failure", task.getException());
                    Toast.makeText(MainActivity.this, "Authentication failed.",
                            Toast.LENGTH_SHORT).show();

此logcat报告

   [FirebaseAuth:] Preparing to create service connection to gms implementation

08-28 18:14:32.447 13811-13811 / com.example.yoel.autofirebaseemail W / BiChannelGoogleApi:[FirebaseAuth:] getGoogleApiForMethod()返回了Gms:com.google.firebase.auth.api.internal.zzal @ eeb4cfd 08-28 18:14:32.447 13811-13811 / com.example.yoel.autofirebaseemail D / yoel登录:登录: 08-28 18:14:32.447 13811-13864 / com.example.yoel.autofirebaseemail W / DynamiteModule:找不到com.google.firebase.auth的本地模块描述符类。 08-28 18:14:32.448 13811-13864 / com.example.yoel.autofirebaseemail I / FirebaseAuth:[FirebaseAuth:]通过FirebaseOptions加载模块。     [FirebaseAuth:]正在准备创建与gms实现的服务连接 08-28 18:14:33.283 13811-13811 / com.example.yoel.autofirebaseemail D / yoelLog:getCurrentUser:1 08-28 18:14:33.739 13811-13868 / com.example.yoel.autofirebaseemail D / EGL_emulation:eglMakeCurrent:0xde569ce0:ver 3 0(tinfo 0xde55a130) 08-28 18:14:34.105 13811-13811 / com.example.yoel.autofirebaseemail W / yoelLog:createUserWithEmail:failure     com.google.firebase.FirebaseNetworkException:发生了网络错误(例如超时,连接中断或主机无法访问)。         在com.google.firebase.auth.api.internal.zzcf.zzb(未知来源:15)         位于com.google.firebase.auth.api.internal.zzbb.zza(未知来源:16)         在com.google.firebase.auth.api.internal.zzcz.zzc中(未知来源:31)         在com.google.firebase.auth.api.internal.zzdc.onFailure上(未知来源:49)         在com.google.firebase.auth.api.internal.zzcj.dispatchTransaction(未知来源:18)         在com.google.android.gms.internal.firebase_auth.zzb.onTransact上(未知来源:12)         在android.os.Binder.execTransact(Binder.java:731) 08-28 18:14:34.140 13811-13868 / com.example.yoel.autofirebaseemail D / EGL_emulation:eglMakeCurrent:0xde569ce0:ver 3 0(tinfo 0xde55a130) 08-28 18:14:34.327 13811-13868 / com.example.yoel.autofirebaseemail D / EGL_emulation:eglMakeCurrent:0xde569ce0:ver 3 0(tinfo 0xde55a130) 08-28 18:14:34.622 13811-13868 / com.example.yoel.autofirebaseemail D / EGL_emulation:eglMakeCurrent:0xde569ce0:ver 3 0(tinfo 0xde55a130) 08-28 18:14:34.835 13811-

0 个答案:

没有答案