156 lines
4.0 KiB
Java
156 lines
4.0 KiB
Java
|
package com.huawei.hms.hatool;
|
||
|
|
||
|
import android.text.TextUtils;
|
||
|
import java.security.SecureRandom;
|
||
|
import o.BAC;
|
||
|
import o.Yqs;
|
||
|
import o.gPM;
|
||
|
|
||
|
/* loaded from: classes2.dex */
|
||
|
public class o0 {
|
||
|
private static o0 c;
|
||
|
private String a;
|
||
|
private String b;
|
||
|
|
||
|
private boolean f() {
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Code restructure failed: missing block: B:12:0x004b, code lost:
|
||
|
|
||
|
if (f() != false) goto L20;
|
||
|
*/
|
||
|
/*
|
||
|
Code decompiled incorrectly, please refer to instructions dump.
|
||
|
To view partially-correct add '--show-bad-code' argument
|
||
|
*/
|
||
|
private java.lang.String a(java.lang.String r3) {
|
||
|
/*
|
||
|
r2 = this;
|
||
|
boolean r0 = r2.f()
|
||
|
if (r0 == 0) goto Ld
|
||
|
java.lang.String r0 = "analytics_keystore"
|
||
|
java.lang.String r0 = o.gPM.e(r0, r3)
|
||
|
goto Lf
|
||
|
Ld:
|
||
|
java.lang.String r0 = ""
|
||
|
Lf:
|
||
|
boolean r1 = android.text.TextUtils.isEmpty(r0)
|
||
|
if (r1 == 0) goto L5e
|
||
|
java.lang.String r0 = "hmsSdk"
|
||
|
java.lang.String r1 = "deCrypt work key first"
|
||
|
com.huawei.hms.hatool.v.c(r0, r1)
|
||
|
java.lang.String r0 = r2.e()
|
||
|
java.lang.String r0 = com.huawei.hms.hatool.n.a(r3, r0)
|
||
|
boolean r3 = android.text.TextUtils.isEmpty(r0)
|
||
|
if (r3 == 0) goto L4e
|
||
|
java.security.SecureRandom r3 = o.BAC.d()
|
||
|
if (r3 != 0) goto L34
|
||
|
r3 = 0
|
||
|
byte[] r3 = new byte[r3]
|
||
|
goto L3c
|
||
|
L34:
|
||
|
r0 = 16
|
||
|
byte[] r0 = new byte[r0]
|
||
|
r3.nextBytes(r0)
|
||
|
r3 = r0
|
||
|
L3c:
|
||
|
java.lang.String r0 = o.Yqs.b(r3)
|
||
|
java.lang.String r3 = r2.b(r0)
|
||
|
r2.c(r3)
|
||
|
boolean r3 = r2.f()
|
||
|
if (r3 == 0) goto L5e
|
||
|
goto L5b
|
||
|
L4e:
|
||
|
boolean r3 = r2.f()
|
||
|
if (r3 == 0) goto L5e
|
||
|
java.lang.String r3 = r2.b(r0)
|
||
|
r2.c(r3)
|
||
|
L5b:
|
||
|
com.huawei.hms.hatool.x.c()
|
||
|
L5e:
|
||
|
return r0
|
||
|
*/
|
||
|
throw new UnsupportedOperationException("Method not decompiled: com.huawei.hms.hatool.o0.a(java.lang.String):java.lang.String");
|
||
|
}
|
||
|
|
||
|
private String c() {
|
||
|
byte[] bArr;
|
||
|
String a = d.a(q0.i(), "Privacy_MY", "PrivacyData", "");
|
||
|
if (!TextUtils.isEmpty(a)) {
|
||
|
return a(a);
|
||
|
}
|
||
|
SecureRandom d = BAC.d();
|
||
|
if (d == null) {
|
||
|
bArr = new byte[0];
|
||
|
} else {
|
||
|
byte[] bArr2 = new byte[16];
|
||
|
d.nextBytes(bArr2);
|
||
|
bArr = bArr2;
|
||
|
}
|
||
|
String b = Yqs.b(bArr);
|
||
|
c(b(b));
|
||
|
return b;
|
||
|
}
|
||
|
|
||
|
public void b() {
|
||
|
byte[] bArr;
|
||
|
SecureRandom d = BAC.d();
|
||
|
if (d == null) {
|
||
|
bArr = new byte[0];
|
||
|
} else {
|
||
|
byte[] bArr2 = new byte[16];
|
||
|
d.nextBytes(bArr2);
|
||
|
bArr = bArr2;
|
||
|
}
|
||
|
String b = Yqs.b(bArr);
|
||
|
if (c(b(b))) {
|
||
|
this.a = b;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public String a() {
|
||
|
if (TextUtils.isEmpty(this.a)) {
|
||
|
this.a = c();
|
||
|
}
|
||
|
return this.a;
|
||
|
}
|
||
|
|
||
|
private static void g() {
|
||
|
synchronized (o0.class) {
|
||
|
if (c == null) {
|
||
|
c = new o0();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private String e() {
|
||
|
if (TextUtils.isEmpty(this.b)) {
|
||
|
this.b = new x().a();
|
||
|
}
|
||
|
return this.b;
|
||
|
}
|
||
|
|
||
|
public static o0 d() {
|
||
|
if (c == null) {
|
||
|
g();
|
||
|
}
|
||
|
return c;
|
||
|
}
|
||
|
|
||
|
private boolean c(String str) {
|
||
|
v.c("hmsSdk", "refresh sp aes key");
|
||
|
if (TextUtils.isEmpty(str)) {
|
||
|
v.c("hmsSdk", "refreshLocalKey(): encrypted key is empty");
|
||
|
return false;
|
||
|
}
|
||
|
d.b(q0.i(), "Privacy_MY", "PrivacyData", str);
|
||
|
d.b(q0.i(), "Privacy_MY", "flashKeyTime", System.currentTimeMillis());
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
private String b(String str) {
|
||
|
return f() ? gPM.a("analytics_keystore", str) : n.b(str, e());
|
||
|
}
|
||
|
}
|