what-the-bank/sources/org/bouncycastle/i18n/LocalizedMessage.java

671 lines
25 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package org.bouncycastle.i18n;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.os.Process;
import android.os.SystemClock;
import android.text.AndroidCharacter;
import android.text.TextUtils;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewConfiguration;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Method;
import java.nio.charset.Charset;
import java.text.DateFormat;
import java.text.Format;
import java.text.MessageFormat;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import java.util.TimeZone;
import net.sf.scuba.smartcards.ISOFileInfo;
import o.C4403bZM;
import o.xzZ;
import org.bouncycastle.i18n.filter.Filter;
import org.bouncycastle.i18n.filter.TrustedInput;
import org.bouncycastle.i18n.filter.UntrustedInput;
import org.bouncycastle.i18n.filter.UntrustedUrlInput;
/* loaded from: classes6.dex */
public class LocalizedMessage {
public static final String DEFAULT_ENCODING = "ISO-8859-1";
protected FilteredArguments arguments;
protected String encoding;
protected FilteredArguments extraArgs;
protected Filter filter;
protected final String id;
protected ClassLoader loader;
protected final String resource;
/* JADX INFO: Access modifiers changed from: protected */
/* loaded from: classes6.dex */
public class FilteredArguments {
protected static final int FILTER = 1;
protected static final int FILTER_URL = 2;
protected static final int NO_FILTER = 0;
protected int[] argFilterType;
protected Object[] arguments;
protected Filter filter;
protected Object[] filteredArgs;
protected boolean[] isLocaleSpecific;
final LocalizedMessage this$0;
protected Object[] unpackedArgs;
private static final byte[] $$a = {40, 9, -20, ISOFileInfo.AB};
private static final int $$b = 229;
private static int $10 = 0;
private static int $11 = 1;
private static int d = 0;
private static int e = 1;
private static int[] b = {-553257900, -1283597882, 29400631, -457944084, 1632856715, -346439625, -558400024, -2125881866, -1951889222, 663761861, 725003990, 901782170, 1079956129, 1017018848, -1239228472, -1901932932, -1812637862, -1892910697};
/* JADX WARN: Removed duplicated region for block: B:10:0x0024 */
/* JADX WARN: Removed duplicated region for block: B:7:0x001c */
/* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:10:0x0024 -> B:4:0x002d). Please report as a decompilation issue!!! */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
private static void f(short r6, byte r7, byte r8, java.lang.Object[] r9) {
/*
int r7 = r7 * 3
int r0 = r7 + 1
int r8 = r8 + 4
int r6 = r6 * 2
int r6 = 104 - r6
byte[] r1 = org.bouncycastle.i18n.LocalizedMessage.FilteredArguments.$$a
byte[] r0 = new byte[r0]
r2 = 0
if (r1 != 0) goto L14
r3 = r8
r4 = r2
goto L2d
L14:
r3 = r2
L15:
int r8 = r8 + 1
byte r4 = (byte) r6
r0[r3] = r4
if (r3 != r7) goto L24
java.lang.String r6 = new java.lang.String
r6.<init>(r0, r2)
r9[r2] = r6
return
L24:
int r3 = r3 + 1
r4 = r1[r8]
r5 = r8
r8 = r6
r6 = r4
r4 = r3
r3 = r5
L2d:
int r6 = -r6
int r6 = r6 + r8
r8 = r3
r3 = r4
goto L15
*/
throw new UnsupportedOperationException("Method not decompiled: org.bouncycastle.i18n.LocalizedMessage.FilteredArguments.f(short, byte, byte, java.lang.Object[]):void");
}
private static void a(int[] iArr, int i, Object[] objArr) {
Object method;
int length;
int[] iArr2;
int i2;
int i3 = 2;
int i4 = 2 % 2;
C4403bZM c4403bZM = new C4403bZM();
char[] cArr = new char[4];
char[] cArr2 = new char[iArr.length * 2];
int[] iArr3 = b;
char c = '0';
int i5 = 729798706;
int i6 = 1;
int i7 = 0;
if (iArr3 != null) {
int i8 = $11 + 55;
$10 = i8 % 128;
int i9 = i8 % 2;
int length2 = iArr3.length;
int[] iArr4 = new int[length2];
int i10 = 0;
while (i10 < length2) {
int i11 = $10 + 29;
$11 = i11 % 128;
int i12 = i11 % i3;
try {
Object[] objArr2 = {Integer.valueOf(iArr3[i10])};
Object obj = xzZ.y.get(729798706);
if (obj == null) {
obj = ((Class) xzZ.c(TextUtils.indexOf("", c) + 16, 5 - Drawable.resolveOpacity(0, 0), (char) (58134 - View.resolveSize(0, 0)))).getMethod("i", Integer.TYPE);
xzZ.y.put(729798706, obj);
}
iArr4[i10] = ((Integer) ((Method) obj).invoke(null, objArr2)).intValue();
i10++;
i3 = 2;
c = '0';
} catch (Throwable th) {
Throwable cause = th.getCause();
if (cause == null) {
throw th;
}
throw cause;
}
}
iArr3 = iArr4;
}
int length3 = iArr3.length;
int[] iArr5 = new int[length3];
int[] iArr6 = b;
if (iArr6 != null) {
int i13 = $11 + 11;
$10 = i13 % 128;
if (i13 % 2 != 0) {
length = iArr6.length;
iArr2 = new int[length];
} else {
length = iArr6.length;
iArr2 = new int[length];
}
int i14 = 0;
while (i14 < length) {
Object[] objArr3 = new Object[i6];
objArr3[i7] = Integer.valueOf(iArr6[i14]);
Object obj2 = xzZ.y.get(Integer.valueOf(i5));
if (obj2 != null) {
i2 = i5;
} else {
Class cls = (Class) xzZ.c(Color.green(i7) + 15, Gravity.getAbsoluteGravity(i7, i7) + 5, (char) (Color.rgb(i7, i7, i7) + 16835350));
Class<?>[] clsArr = new Class[1];
clsArr[i7] = Integer.TYPE;
obj2 = cls.getMethod("i", clsArr);
i2 = 729798706;
xzZ.y.put(729798706, obj2);
}
iArr2[i14] = ((Integer) ((Method) obj2).invoke(null, objArr3)).intValue();
i14++;
i5 = i2;
i6 = 1;
i7 = 0;
}
iArr6 = iArr2;
}
int i15 = i7;
System.arraycopy(iArr6, i15, iArr5, i15, length3);
c4403bZM.b = i15;
while (c4403bZM.b < iArr.length) {
cArr[i15] = (char) (iArr[c4403bZM.b] >> 16);
cArr[1] = (char) iArr[c4403bZM.b];
cArr[2] = (char) (iArr[c4403bZM.b + 1] >> 16);
cArr[3] = (char) iArr[c4403bZM.b + 1];
c4403bZM.e = (cArr[0] << 16) + cArr[1];
c4403bZM.a = (cArr[2] << 16) + cArr[3];
C4403bZM.d(iArr5);
int i16 = 0;
for (int i17 = 16; i16 < i17; i17 = 16) {
c4403bZM.e ^= iArr5[i16];
Object[] objArr4 = {c4403bZM, Integer.valueOf(C4403bZM.d(c4403bZM.e)), c4403bZM, c4403bZM};
Object obj3 = xzZ.y.get(-1196964548);
if (obj3 == null) {
Class cls2 = (Class) xzZ.c(118 - (ViewConfiguration.getKeyRepeatTimeout() >> 16), 5 - (ViewConfiguration.getJumpTapTimeout() >> 16), (char) (KeyEvent.getMaxKeyCode() >> 16));
byte b2 = (byte) 0;
byte b3 = b2;
Object[] objArr5 = new Object[1];
f(b2, b3, (byte) (b3 - 1), objArr5);
obj3 = cls2.getMethod((String) objArr5[0], Object.class, Integer.TYPE, Object.class, Object.class);
xzZ.y.put(-1196964548, obj3);
}
int intValue = ((Integer) ((Method) obj3).invoke(null, objArr4)).intValue();
c4403bZM.e = c4403bZM.a;
c4403bZM.a = intValue;
i16++;
}
int i18 = c4403bZM.e;
c4403bZM.e = c4403bZM.a;
c4403bZM.a = i18;
c4403bZM.a ^= iArr5[16];
c4403bZM.e ^= iArr5[17];
int i19 = c4403bZM.e;
int i20 = c4403bZM.a;
cArr[0] = (char) (c4403bZM.e >>> 16);
cArr[1] = (char) c4403bZM.e;
cArr[2] = (char) (c4403bZM.a >>> 16);
cArr[3] = (char) c4403bZM.a;
C4403bZM.d(iArr5);
cArr2[c4403bZM.b * 2] = cArr[0];
cArr2[(c4403bZM.b * 2) + 1] = cArr[1];
cArr2[(c4403bZM.b * 2) + 2] = cArr[2];
cArr2[(c4403bZM.b * 2) + 3] = cArr[3];
Object[] objArr6 = {c4403bZM, c4403bZM};
Object obj4 = xzZ.y.get(1914371176);
if (obj4 != null) {
method = obj4;
} else {
Class cls3 = (Class) xzZ.c(146 - AndroidCharacter.getMirror('0'), (SystemClock.elapsedRealtime() > 0L ? 1 : (SystemClock.elapsedRealtime() == 0L ? 0 : -1)) + 4, (char) View.MeasureSpec.getSize(0));
byte b4 = (byte) (3 & $$b);
byte b5 = (byte) (b4 - 1);
Object[] objArr7 = new Object[1];
f(b4, b5, (byte) (b5 - 1), objArr7);
method = cls3.getMethod((String) objArr7[0], Object.class, Object.class);
xzZ.y.put(1914371176, method);
}
((Method) method).invoke(null, objArr6);
int i21 = $10 + 45;
$11 = i21 % 128;
int i22 = i21 % 2;
i15 = 0;
}
objArr[0] = new String(cArr2, 0, i);
}
public void setFilter(Filter filter) {
int i = 2 % 2;
if (filter != this.filter) {
int i2 = 0;
while (i2 < this.unpackedArgs.length) {
int i3 = e;
int i4 = i3 + 119;
d = i4 % 128;
int i5 = i4 % 2;
this.filteredArgs[i2] = null;
i2++;
int i6 = i3 + 37;
d = i6 % 128;
if (i6 % 2 != 0) {
int i7 = 4 % 4;
}
}
}
this.filter = filter;
}
public boolean isEmpty() {
int i = 2 % 2;
int i2 = e;
int i3 = i2 + 17;
int i4 = i3 % 128;
d = i4;
int i5 = i3 % 2;
if (this.unpackedArgs.length == 0) {
int i6 = i4 + 93;
e = i6 % 128;
return i6 % 2 != 0;
}
int i7 = i2 + 101;
d = i7 % 128;
int i8 = i7 % 2;
return false;
}
public Object[] getFilteredArgs(Locale locale) {
int i = 2 % 2;
int i2 = e + 33;
d = i2 % 128;
Object[] objArr = new Object[i2 % 2 != 0 ? this.unpackedArgs.length : this.unpackedArgs.length];
int i3 = 0;
while (true) {
Object[] objArr2 = this.unpackedArgs;
if (i3 >= objArr2.length) {
int i4 = e + 53;
d = i4 % 128;
int i5 = i4 % 2;
return objArr;
}
int i6 = e + 39;
int i7 = i6 % 128;
d = i7;
int i8 = i6 % 2;
Object obj = this.filteredArgs[i3];
if (obj == null) {
int i9 = i7 + 23;
e = i9 % 128;
int i10 = i9 % 2;
Object obj2 = objArr2[i3];
if (!this.isLocaleSpecific[i3]) {
obj = filter(this.argFilterType[i3], obj2);
this.filteredArgs[i3] = obj;
} else {
int i11 = i7 + 21;
e = i11 % 128;
int i12 = i11 % 2;
obj = filter(this.argFilterType[i3], ((LocaleString) obj2).getLocaleString(locale));
}
}
objArr[i3] = obj;
i3++;
}
}
public Filter getFilter() {
int i = 2 % 2;
int i2 = e + 123;
d = i2 % 128;
if (i2 % 2 == 0) {
return this.filter;
}
throw null;
}
public Object[] getArguments() {
int i = 2 % 2;
int i2 = e + 89;
d = i2 % 128;
if (i2 % 2 == 0) {
return this.arguments;
}
Object obj = null;
obj.hashCode();
throw null;
}
private Object filter(int i, Object obj) {
int i2 = 2 % 2;
int i3 = d;
int i4 = i3 + 95;
e = i4 % 128;
int i5 = i4 % 2;
Filter filter = this.filter;
if (filter != null) {
int i6 = i3 + 55;
e = i6 % 128;
if (i6 % 2 == 0) {
throw null;
}
if (obj == null) {
Object[] objArr = new Object[1];
a(new int[]{919206021, 159784494}, (Process.myPid() >> 22) + 4, objArr);
obj = ((String) objArr[0]).intern();
}
if (i != 0) {
if (i != 1) {
if (i != 2) {
return null;
}
return filter.doFilterUrl(obj.toString());
}
String doFilter = filter.doFilter(obj.toString());
int i7 = e + 105;
d = i7 % 128;
int i8 = i7 % 2;
return doFilter;
}
}
return obj;
}
FilteredArguments(LocalizedMessage localizedMessage, Object[] objArr) {
this.this$0 = localizedMessage;
this.filter = null;
this.arguments = objArr;
this.unpackedArgs = new Object[objArr.length];
this.filteredArgs = new Object[objArr.length];
this.isLocaleSpecific = new boolean[objArr.length];
this.argFilterType = new int[objArr.length];
for (int i = 0; i < objArr.length; i++) {
Object obj = objArr[i];
if (obj instanceof TrustedInput) {
int i2 = e + 37;
d = i2 % 128;
int i3 = i2 % 2;
this.unpackedArgs[i] = ((TrustedInput) obj).getInput();
this.argFilterType[i] = 0;
} else if (obj instanceof UntrustedInput) {
int i4 = e + 43;
d = i4 % 128;
int i5 = i4 % 2;
this.unpackedArgs[i] = ((UntrustedInput) obj).getInput();
if (objArr[i] instanceof UntrustedUrlInput) {
int i6 = e + 107;
d = i6 % 128;
int i7 = i6 % 2;
this.argFilterType[i] = 2;
} else {
this.argFilterType[i] = 1;
}
} else {
this.unpackedArgs[i] = obj;
this.argFilterType[i] = 1;
int i8 = e + 87;
d = i8 % 128;
int i9 = i8 % 2;
int i10 = 2 % 2;
}
this.isLocaleSpecific[i] = this.unpackedArgs[i] instanceof LocaleString;
}
int i11 = e + 83;
d = i11 % 128;
int i12 = i11 % 2;
}
FilteredArguments(LocalizedMessage localizedMessage) {
this(localizedMessage, new Object[0]);
}
}
public String toString() {
StringBuffer stringBuffer = new StringBuffer("Resource: \"");
stringBuffer.append(this.resource);
stringBuffer.append("\" Id: \"").append(this.id).append("\" Arguments: ");
stringBuffer.append(this.arguments.getArguments().length).append(" normal");
FilteredArguments filteredArguments = this.extraArgs;
if (filteredArguments != null && filteredArguments.getArguments().length > 0) {
stringBuffer.append(", ").append(this.extraArgs.getArguments().length).append(" extra");
}
stringBuffer.append(" Encoding: ").append(this.encoding);
stringBuffer.append(" ClassLoader: ").append(this.loader);
return stringBuffer.toString();
}
public void setFilter(Filter filter) {
this.arguments.setFilter(filter);
FilteredArguments filteredArguments = this.extraArgs;
if (filteredArguments != null) {
filteredArguments.setFilter(filter);
}
this.filter = filter;
}
public void setExtraArguments(Object[] objArr) {
if (objArr == null) {
this.extraArgs = null;
return;
}
FilteredArguments filteredArguments = new FilteredArguments(this, objArr);
this.extraArgs = filteredArguments;
filteredArguments.setFilter(this.filter);
}
public void setExtraArgument(Object obj) {
setExtraArguments(new Object[]{obj});
}
public void setClassLoader(ClassLoader classLoader) {
this.loader = classLoader;
}
public String getResource() {
return this.resource;
}
public String getId() {
return this.id;
}
public Filter getFilter() {
return this.filter;
}
public Object[] getExtraArgs() {
FilteredArguments filteredArguments = this.extraArgs;
if (filteredArguments == null) {
return null;
}
return filteredArguments.getArguments();
}
public String getEntry(String str, Locale locale, TimeZone timeZone) throws MissingEntryException {
String str2 = this.id;
if (str != null) {
StringBuilder sb = new StringBuilder();
sb.append(str2);
sb.append(".");
sb.append(str);
str2 = sb.toString();
}
String str3 = str2;
try {
ClassLoader classLoader = this.loader;
String string = (classLoader == null ? ResourceBundle.getBundle(this.resource, locale) : ResourceBundle.getBundle(this.resource, locale, classLoader)).getString(str3);
if (!this.encoding.equals(DEFAULT_ENCODING)) {
string = new String(string.getBytes(DEFAULT_ENCODING), this.encoding);
}
if (!this.arguments.isEmpty()) {
string = formatWithTimeZone(string, this.arguments.getFilteredArgs(locale), locale, timeZone);
}
return addExtraArgs(string, locale);
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
} catch (MissingResourceException unused) {
StringBuilder sb2 = new StringBuilder("Can't find entry ");
sb2.append(str3);
sb2.append(" in resource file ");
sb2.append(this.resource);
sb2.append(".");
String obj = sb2.toString();
String str4 = this.resource;
ClassLoader classLoader2 = this.loader;
if (classLoader2 == null) {
classLoader2 = getClassLoader();
}
throw new MissingEntryException(obj, str4, str3, locale, classLoader2);
}
}
public ClassLoader getClassLoader() {
return this.loader;
}
public Object[] getArguments() {
return this.arguments.getArguments();
}
protected String formatWithTimeZone(String str, Object[] objArr, Locale locale, TimeZone timeZone) {
MessageFormat messageFormat = new MessageFormat(" ");
messageFormat.setLocale(locale);
messageFormat.applyPattern(str);
if (!timeZone.equals(TimeZone.getDefault())) {
Format[] formats = messageFormat.getFormats();
for (int i = 0; i < formats.length; i++) {
Format format = formats[i];
if (format instanceof DateFormat) {
DateFormat dateFormat = (DateFormat) format;
dateFormat.setTimeZone(timeZone);
messageFormat.setFormat(i, dateFormat);
}
}
}
return messageFormat.format(objArr);
}
protected String addExtraArgs(String str, Locale locale) {
if (this.extraArgs == null) {
return str;
}
StringBuffer stringBuffer = new StringBuffer(str);
Object[] filteredArgs = this.extraArgs.getFilteredArgs(locale);
for (Object obj : filteredArgs) {
stringBuffer.append(obj);
}
return stringBuffer.toString();
}
public LocalizedMessage(String str, String str2, Object[] objArr) throws NullPointerException {
this.encoding = DEFAULT_ENCODING;
this.extraArgs = null;
this.filter = null;
this.loader = null;
if (str == null) {
throw null;
}
if (str2 == null) {
throw null;
}
if (objArr == null) {
throw null;
}
this.id = str2;
this.resource = str;
this.arguments = new FilteredArguments(this, objArr);
}
public LocalizedMessage(String str, String str2, String str3, Object[] objArr) throws NullPointerException, UnsupportedEncodingException {
this.encoding = DEFAULT_ENCODING;
this.extraArgs = null;
this.filter = null;
this.loader = null;
if (str == null) {
throw null;
}
if (str2 == null) {
throw null;
}
if (objArr == null) {
throw null;
}
this.id = str2;
this.resource = str;
this.arguments = new FilteredArguments(this, objArr);
if (Charset.isSupported(str3)) {
this.encoding = str3;
return;
}
StringBuilder sb = new StringBuilder("The encoding \"");
sb.append(str3);
sb.append("\" is not supported.");
throw new UnsupportedEncodingException(sb.toString());
}
public LocalizedMessage(String str, String str2, String str3) throws NullPointerException, UnsupportedEncodingException {
this.encoding = DEFAULT_ENCODING;
this.extraArgs = null;
this.filter = null;
this.loader = null;
if (str == null) {
throw null;
}
if (str2 == null) {
throw null;
}
this.id = str2;
this.resource = str;
this.arguments = new FilteredArguments(this);
if (Charset.isSupported(str3)) {
this.encoding = str3;
return;
}
StringBuilder sb = new StringBuilder("The encoding \"");
sb.append(str3);
sb.append("\" is not supported.");
throw new UnsupportedEncodingException(sb.toString());
}
public LocalizedMessage(String str, String str2) throws NullPointerException {
this.encoding = DEFAULT_ENCODING;
this.extraArgs = null;
this.filter = null;
this.loader = null;
if (str == null) {
throw null;
}
if (str2 == null) {
throw null;
}
this.id = str2;
this.resource = str;
this.arguments = new FilteredArguments(this);
}
}