what-the-bank/sources/org/jmrtd/lds/ChipAuthenticationInfo.java

620 lines
22 KiB
Java

package org.jmrtd.lds;
import android.text.TextUtils;
import android.view.ViewConfiguration;
import android.widget.ExpandableListView;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.common.base.Ascii;
import java.math.BigInteger;
import java.util.logging.Logger;
import net.sf.scuba.smartcards.ISO7816;
import org.bouncycastle.asn1.ASN1EncodableVector;
import org.bouncycastle.asn1.ASN1Integer;
import org.bouncycastle.asn1.ASN1ObjectIdentifier;
import org.bouncycastle.asn1.ASN1Primitive;
import org.bouncycastle.asn1.DLSequence;
import org.bouncycastle.pqc.jcajce.spec.McElieceCCA2KeyGenParameterSpec;
/* loaded from: classes6.dex */
public class ChipAuthenticationInfo extends SecurityInfo {
private static final Logger LOGGER;
public static final int VERSION_1 = 1;
public static final int VERSION_2 = 2;
private static int a = 0;
private static byte[] b = null;
private static int c = 0;
private static short[] d = null;
private static int e = 0;
private static int f = 0;
private static final long serialVersionUID = 5591988305059068535L;
private BigInteger keyId;
private String oid;
private int version;
private static final byte[] $$a = {123, ISO7816.INS_READ_RECORD2, ISO7816.INS_MSE, -23};
private static final int $$b = 57;
private static int $10 = 0;
private static int $11 = 1;
private static int i = 0;
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Removed duplicated region for block: B:10:0x002a */
/* JADX WARN: Removed duplicated region for block: B:7:0x0022 */
/* JADX WARN: Type inference failed for: r8v2, types: [int] */
/* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:10:0x002a -> B:4:0x002f). 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 h(short r7, byte r8, int r9, java.lang.Object[] r10) {
/*
int r7 = r7 * 2
int r7 = r7 + 4
int r9 = r9 * 2
int r9 = r9 + 1
int r8 = r8 * 2
int r8 = 110 - r8
byte[] r0 = org.jmrtd.lds.ChipAuthenticationInfo.$$a
byte[] r1 = new byte[r9]
r2 = 0
if (r0 != 0) goto L17
r3 = r8
r4 = r2
r8 = r7
goto L2f
L17:
r3 = r2
L18:
r6 = r8
r8 = r7
r7 = r6
int r4 = r3 + 1
byte r5 = (byte) r7
r1[r3] = r5
if (r4 != r9) goto L2a
java.lang.String r7 = new java.lang.String
r7.<init>(r1, r2)
r10[r2] = r7
return
L2a:
r3 = r0[r8]
r6 = r8
r8 = r7
r7 = r6
L2f:
int r3 = -r3
int r7 = r7 + 1
int r8 = r8 + r3
r3 = r4
goto L18
*/
throw new UnsupportedOperationException("Method not decompiled: org.jmrtd.lds.ChipAuthenticationInfo.h(short, byte, int, java.lang.Object[]):void");
}
static {
f = 1;
d();
LOGGER = Logger.getLogger("org.jmrtd");
int i2 = i + 105;
f = i2 % 128;
if (i2 % 2 == 0) {
throw null;
}
}
public ChipAuthenticationInfo(String str, int i2) {
this(str, i2, null);
}
public ChipAuthenticationInfo(String str, int i2, BigInteger bigInteger) {
this.oid = str;
this.version = i2;
this.keyId = bigInteger;
checkFields();
}
@Override // org.jmrtd.lds.SecurityInfo
@Deprecated
public ASN1Primitive getDERObject() {
int i2 = 2 % 2;
ASN1EncodableVector aSN1EncodableVector = new ASN1EncodableVector();
aSN1EncodableVector.add(new ASN1ObjectIdentifier(this.oid));
aSN1EncodableVector.add(new ASN1Integer(this.version));
BigInteger bigInteger = this.keyId;
if (bigInteger != null) {
aSN1EncodableVector.add(new ASN1Integer(bigInteger));
}
DLSequence dLSequence = new DLSequence(aSN1EncodableVector);
int i3 = f + 61;
i = i3 % 128;
int i4 = i3 % 2;
return dLSequence;
}
@Override // org.jmrtd.lds.SecurityInfo
public String getProtocolOIDString() {
int i2 = 2 % 2;
int i3 = i + 73;
f = i3 % 128;
if (i3 % 2 == 0) {
toProtocolOIDString(this.oid);
throw null;
}
String protocolOIDString = toProtocolOIDString(this.oid);
int i4 = i + 45;
f = i4 % 128;
if (i4 % 2 == 0) {
int i5 = 2 / 0;
}
return protocolOIDString;
}
/* JADX WARN: Code restructure failed: missing block: B:19:0x001f, code lost:
if (r3 != 1) goto L13;
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
protected void checkFields() {
/*
r5 = this;
r0 = 2
int r1 = r0 % r0
java.lang.String r1 = r5.oid // Catch: java.lang.Exception -> L58
boolean r1 = checkRequiredIdentifier(r1) // Catch: java.lang.Exception -> L58
r2 = 1
r1 = r1 ^ r2
if (r1 == r2) goto L42
int r1 = org.jmrtd.lds.ChipAuthenticationInfo.f
int r3 = r1 + 63
int r4 = r3 % 128
org.jmrtd.lds.ChipAuthenticationInfo.i = r4
int r3 = r3 % r0
if (r3 == 0) goto L1d
int r3 = r5.version // Catch: java.lang.Exception -> L58
if (r3 == r2) goto L3a
goto L21
L1d:
int r3 = r5.version // Catch: java.lang.Exception -> L58
if (r3 == r2) goto L3a
L21:
if (r3 != r0) goto L24
goto L3a
L24:
java.lang.IllegalArgumentException r0 = new java.lang.IllegalArgumentException // Catch: java.lang.Exception -> L58
java.lang.StringBuilder r1 = new java.lang.StringBuilder // Catch: java.lang.Exception -> L58
java.lang.String r2 = "Wrong version. Was expecting 1 or 2, found "
r1.<init>(r2) // Catch: java.lang.Exception -> L58
int r2 = r5.version // Catch: java.lang.Exception -> L58
r1.append(r2) // Catch: java.lang.Exception -> L58
java.lang.String r1 = r1.toString() // Catch: java.lang.Exception -> L58
r0.<init>(r1) // Catch: java.lang.Exception -> L58
throw r0 // Catch: java.lang.Exception -> L58
L3a:
int r1 = r1 + 5
int r2 = r1 % 128
org.jmrtd.lds.ChipAuthenticationInfo.i = r2
int r1 = r1 % r0
return
L42:
java.lang.IllegalArgumentException r0 = new java.lang.IllegalArgumentException // Catch: java.lang.Exception -> L58
java.lang.StringBuilder r1 = new java.lang.StringBuilder // Catch: java.lang.Exception -> L58
java.lang.String r2 = "Wrong identifier: "
r1.<init>(r2) // Catch: java.lang.Exception -> L58
java.lang.String r2 = r5.oid // Catch: java.lang.Exception -> L58
r1.append(r2) // Catch: java.lang.Exception -> L58
java.lang.String r1 = r1.toString() // Catch: java.lang.Exception -> L58
r0.<init>(r1) // Catch: java.lang.Exception -> L58
throw r0 // Catch: java.lang.Exception -> L58
L58:
r0 = move-exception
java.util.logging.Logger r1 = org.jmrtd.lds.ChipAuthenticationInfo.LOGGER
java.util.logging.Level r2 = java.util.logging.Level.SEVERE
java.lang.String r3 = "Exception"
r1.log(r2, r3, r0)
java.lang.IllegalArgumentException r0 = new java.lang.IllegalArgumentException
java.lang.String r1 = "Malformed ChipAuthenticationInfo."
r0.<init>(r1)
throw r0
*/
throw new UnsupportedOperationException("Method not decompiled: org.jmrtd.lds.ChipAuthenticationInfo.checkFields():void");
}
/* JADX INFO: Access modifiers changed from: package-private */
public static boolean checkRequiredIdentifier(String str) {
int i2 = 2 % 2;
if (!(!ID_CA_DH_3DES_CBC_CBC.equals(str))) {
return true;
}
int i3 = f + 91;
i = i3 % 128;
if (i3 % 2 != 0) {
int i4 = 87 / 0;
if (ID_CA_ECDH_3DES_CBC_CBC.equals(str)) {
return true;
}
} else if (ID_CA_ECDH_3DES_CBC_CBC.equals(str)) {
return true;
}
if (SecurityInfo.ID_CA_DH_AES_CBC_CMAC_128.equals(str) || SecurityInfo.ID_CA_DH_AES_CBC_CMAC_192.equals(str) || !(!SecurityInfo.ID_CA_DH_AES_CBC_CMAC_256.equals(str)) || SecurityInfo.ID_CA_ECDH_AES_CBC_CMAC_128.equals(str) || SecurityInfo.ID_CA_ECDH_AES_CBC_CMAC_192.equals(str)) {
return true;
}
int i5 = i + 95;
f = i5 % 128;
int i6 = i5 % 2;
return SecurityInfo.ID_CA_ECDH_AES_CBC_CMAC_256.equals(str);
}
public String toString() {
int i2 = 2 % 2;
StringBuilder sb = new StringBuilder("ChipAuthenticationInfo [protocol: ");
sb.append(toProtocolOIDString(this.oid));
sb.append(", version: ");
sb.append(this.version);
sb.append(", keyId: ");
Object obj = this.keyId;
if (obj == null) {
int i3 = f + 85;
i = i3 % 128;
int i4 = i3 % 2;
obj = "-";
}
sb.append(obj);
sb.append("]");
String obj2 = sb.toString();
int i5 = f + 5;
i = i5 % 128;
int i6 = i5 % 2;
return obj2;
}
public int hashCode() {
int hashCode;
int i2 = 2 % 2;
int i3 = f;
int i4 = i3 + 71;
i = i4 % 128;
int i5 = i4 % 2;
String str = this.oid;
if (str == null) {
int i6 = i3 + 37;
i = i6 % 128;
int i7 = i6 % 2;
hashCode = 0;
} else {
hashCode = str.hashCode();
}
int i8 = this.version;
BigInteger bigInteger = this.keyId;
return (hashCode * 11) + 3 + (i8 * 61) + ((bigInteger == null ? 111 : bigInteger.hashCode()) * 1991);
}
public boolean equals(Object obj) {
int i2 = 2 % 2;
if (obj == null) {
return false;
}
if (obj == this) {
int i3 = f + 29;
i = i3 % 128;
int i4 = i3 % 2;
return true;
}
if (!ChipAuthenticationInfo.class.equals(obj.getClass())) {
int i5 = f + 55;
i = i5 % 128;
int i6 = i5 % 2;
return false;
}
ChipAuthenticationInfo chipAuthenticationInfo = (ChipAuthenticationInfo) obj;
if (!this.oid.equals(chipAuthenticationInfo.oid) || this.version != chipAuthenticationInfo.version) {
return false;
}
BigInteger bigInteger = this.keyId;
if (bigInteger != null || chipAuthenticationInfo.keyId != null) {
if (bigInteger == null) {
return false;
}
int i7 = f + 33;
i = i7 % 128;
int i8 = i7 % 2;
if (!bigInteger.equals(chipAuthenticationInfo.keyId)) {
return false;
}
}
int i9 = f + 101;
i = i9 % 128;
int i10 = i9 % 2;
return true;
}
public static String toKeyAgreementAlgorithm(String str) {
String obj;
int i2 = 2 % 2;
Object obj2 = null;
if (!ID_CA_DH_3DES_CBC_CBC.equals(str) && !SecurityInfo.ID_CA_DH_AES_CBC_CMAC_128.equals(str)) {
int i3 = i + 71;
f = i3 % 128;
int i4 = i3 % 2;
if (!SecurityInfo.ID_CA_DH_AES_CBC_CMAC_192.equals(str) && !SecurityInfo.ID_CA_DH_AES_CBC_CMAC_256.equals(str)) {
if (ID_CA_ECDH_3DES_CBC_CBC.equals(str) || !(!SecurityInfo.ID_CA_ECDH_AES_CBC_CMAC_128.equals(str)) || SecurityInfo.ID_CA_ECDH_AES_CBC_CMAC_192.equals(str)) {
return "ECDH";
}
int i5 = i + 105;
f = i5 % 128;
if (i5 % 2 == 0) {
SecurityInfo.ID_CA_ECDH_AES_CBC_CMAC_256.equals(str);
obj2.hashCode();
throw null;
}
if (SecurityInfo.ID_CA_ECDH_AES_CBC_CMAC_256.equals(str)) {
return "ECDH";
}
if ("Unknown OID: ".concat(String.valueOf(str)) == null) {
int i6 = f + 3;
i = i6 % 128;
int i7 = i6 % 2;
Object[] objArr = new Object[1];
g((short) (ViewConfiguration.getDoubleTapTimeout() >> 16), (byte) TextUtils.getOffsetBefore("", 0), (-69) - (ExpandableListView.getPackedPositionForGroup(0) > 0L ? 1 : (ExpandableListView.getPackedPositionForGroup(0) == 0L ? 0 : -1)), 1578399234 - (ViewConfiguration.getDoubleTapTimeout() >> 16), 479135533 - (ViewConfiguration.getScrollFriction() > BitmapDescriptorFactory.HUE_RED ? 1 : (ViewConfiguration.getScrollFriction() == BitmapDescriptorFactory.HUE_RED ? 0 : -1)), objArr);
obj = ((String) objArr[0]).intern();
} else {
StringBuilder sb = new StringBuilder("\"");
sb.append(str);
sb.append("\"");
obj = sb.toString();
}
throw new NumberFormatException(obj);
}
}
int i8 = f + 123;
i = i8 % 128;
if (i8 % 2 == 0) {
return "DH";
}
throw null;
}
public static String toCipherAlgorithm(String str) {
int i2 = 2 % 2;
int i3 = f + 125;
i = i3 % 128;
int i4 = i3 % 2;
if (ID_CA_DH_3DES_CBC_CBC.equals(str) || ID_CA_ECDH_3DES_CBC_CBC.equals(str)) {
return "DESede";
}
if (SecurityInfo.ID_CA_DH_AES_CBC_CMAC_128.equals(str) || SecurityInfo.ID_CA_DH_AES_CBC_CMAC_192.equals(str) || SecurityInfo.ID_CA_DH_AES_CBC_CMAC_256.equals(str) || !(!SecurityInfo.ID_CA_ECDH_AES_CBC_CMAC_128.equals(str))) {
return "AES";
}
int i5 = i + 89;
f = i5 % 128;
int i6 = i5 % 2;
if (SecurityInfo.ID_CA_ECDH_AES_CBC_CMAC_192.equals(str)) {
return "AES";
}
int i7 = i + 85;
f = i7 % 128;
if (i7 % 2 == 0) {
SecurityInfo.ID_CA_ECDH_AES_CBC_CMAC_256.equals(str);
throw null;
}
if (SecurityInfo.ID_CA_ECDH_AES_CBC_CMAC_256.equals(str)) {
return "AES";
}
StringBuilder sb = new StringBuilder("Unknown OID: \"");
sb.append(str);
sb.append("\"");
throw new NumberFormatException(sb.toString());
}
/* JADX WARN: Code restructure failed: missing block: B:57:0x0289, code lost:
if (r0 != false) goto L63;
*/
/* JADX WARN: Code restructure failed: missing block: B:58:0x02b2, code lost:
r4 = org.jmrtd.lds.ChipAuthenticationInfo.d;
r1.c = r1.c - 1;
r1.a = (char) (r1.e + (((short) (((short) (r4[r8] ^ (-7303220121662775787L))) + r19)) ^ r20));
*/
/* JADX WARN: Code restructure failed: missing block: B:61:0x028e, code lost:
r4 = org.jmrtd.lds.ChipAuthenticationInfo.b;
r1.c = r1.c - 1;
r1.a = (char) (r1.e + (((byte) (((byte) (r4[r8] ^ (-7303220121662775787L))) + r19)) ^ r20));
*/
/* JADX WARN: Code restructure failed: missing block: B:63:0x028c, code lost:
if (r0 != false) goto L63;
*/
/* JADX WARN: Removed duplicated region for block: B:54:0x027a */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
private static void g(short r19, byte r20, int r21, int r22, int r23, java.lang.Object[] r24) {
/*
Method dump skipped, instructions count: 751
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: org.jmrtd.lds.ChipAuthenticationInfo.g(short, byte, int, int, int, java.lang.Object[]):void");
}
public static String toDigestAlgorithm(String str) {
int i2 = 2 % 2;
int i3 = i + 39;
f = i3 % 128;
Object obj = null;
if (i3 % 2 == 0) {
ID_CA_DH_3DES_CBC_CBC.equals(str);
obj.hashCode();
throw null;
}
if (!ID_CA_DH_3DES_CBC_CBC.equals(str) && !ID_CA_ECDH_3DES_CBC_CBC.equals(str)) {
int i4 = i + 125;
f = i4 % 128;
int i5 = i4 % 2;
if (!SecurityInfo.ID_CA_DH_AES_CBC_CMAC_128.equals(str) && !SecurityInfo.ID_CA_ECDH_AES_CBC_CMAC_128.equals(str)) {
if (SecurityInfo.ID_CA_DH_AES_CBC_CMAC_192.equals(str) || SecurityInfo.ID_CA_ECDH_AES_CBC_CMAC_192.equals(str)) {
return McElieceCCA2KeyGenParameterSpec.SHA256;
}
int i6 = i + 21;
f = i6 % 128;
if (i6 % 2 == 0) {
SecurityInfo.ID_CA_DH_AES_CBC_CMAC_256.equals(str);
obj.hashCode();
throw null;
}
if (SecurityInfo.ID_CA_DH_AES_CBC_CMAC_256.equals(str)) {
return McElieceCCA2KeyGenParameterSpec.SHA256;
}
int i7 = f + 81;
i = i7 % 128;
int i8 = i7 % 2;
if (SecurityInfo.ID_CA_ECDH_AES_CBC_CMAC_256.equals(str)) {
return McElieceCCA2KeyGenParameterSpec.SHA256;
}
StringBuilder sb = new StringBuilder("Unknown OID: \"");
sb.append(str);
sb.append("\"");
throw new NumberFormatException(sb.toString());
}
}
int i9 = i + 71;
f = i9 % 128;
if (i9 % 2 != 0) {
return McElieceCCA2KeyGenParameterSpec.SHA1;
}
obj.hashCode();
throw null;
}
public static int toKeyLength(String str) {
int i2 = 2 % 2;
int i3 = i + 3;
f = i3 % 128;
if (i3 % 2 == 0) {
int i4 = 50 / 0;
if (ID_CA_DH_3DES_CBC_CBC.equals(str)) {
return 128;
}
} else if (!(!ID_CA_DH_3DES_CBC_CBC.equals(str))) {
return 128;
}
if (ID_CA_ECDH_3DES_CBC_CBC.equals(str) || SecurityInfo.ID_CA_DH_AES_CBC_CMAC_128.equals(str) || SecurityInfo.ID_CA_ECDH_AES_CBC_CMAC_128.equals(str)) {
return 128;
}
if (!SecurityInfo.ID_CA_DH_AES_CBC_CMAC_192.equals(str)) {
int i5 = f + 79;
i = i5 % 128;
int i6 = i5 % 2;
if (!SecurityInfo.ID_CA_ECDH_AES_CBC_CMAC_192.equals(str)) {
if (SecurityInfo.ID_CA_DH_AES_CBC_CMAC_256.equals(str)) {
return 256;
}
int i7 = i + 19;
f = i7 % 128;
int i8 = i7 % 2;
if (SecurityInfo.ID_CA_ECDH_AES_CBC_CMAC_256.equals(str)) {
return 256;
}
StringBuilder sb = new StringBuilder("Unknown OID: \"");
sb.append(str);
sb.append("\"");
throw new NumberFormatException(sb.toString());
}
}
int i9 = f + 31;
i = i9 % 128;
int i10 = i9 % 2;
return 192;
}
private static String toProtocolOIDString(String str) {
int i2 = 2 % 2;
if (ID_CA_DH_3DES_CBC_CBC.equals(str)) {
return "id-CA-DH-3DES-CBC-CBC";
}
if (SecurityInfo.ID_CA_DH_AES_CBC_CMAC_128.equals(str)) {
return "id-CA-DH-AES-CBC-CMAC-128";
}
if (SecurityInfo.ID_CA_DH_AES_CBC_CMAC_192.equals(str)) {
return "id-CA-DH-AES-CBC-CMAC-192";
}
if (SecurityInfo.ID_CA_DH_AES_CBC_CMAC_256.equals(str)) {
return "id-CA-DH-AES-CBC-CMAC-256";
}
if (ID_CA_ECDH_3DES_CBC_CBC.equals(str)) {
int i3 = f + 65;
i = i3 % 128;
int i4 = i3 % 2;
return "id-CA-ECDH-3DES-CBC-CBC";
}
if (SecurityInfo.ID_CA_ECDH_AES_CBC_CMAC_128.equals(str)) {
int i5 = i + 27;
f = i5 % 128;
if (i5 % 2 == 0) {
int i6 = 89 / 0;
}
return "id-CA-ECDH-AES-CBC-CMAC-128";
}
if (!SecurityInfo.ID_CA_ECDH_AES_CBC_CMAC_192.equals(str)) {
return !(SecurityInfo.ID_CA_ECDH_AES_CBC_CMAC_256.equals(str) ^ true) ? "id-CA-ECDH-AES-CBC-CMAC-256" : str;
}
int i7 = i + 87;
f = i7 % 128;
int i8 = i7 % 2;
return "id-CA-ECDH-AES-CBC-CMAC-192";
}
static void d() {
c = -232417301;
a = 1406017116;
e = -1329666217;
b = new byte[]{Ascii.NAK, ISO7816.INS_APPEND_RECORD, Ascii.DC2, Ascii.NAK};
}
public int getVersion() {
int i2 = 2 % 2;
int i3 = i;
int i4 = i3 + 57;
f = i4 % 128;
int i5 = i4 % 2;
int i6 = this.version;
int i7 = i3 + 53;
f = i7 % 128;
if (i7 % 2 != 0) {
return i6;
}
Object obj = null;
obj.hashCode();
throw null;
}
@Override // org.jmrtd.lds.SecurityInfo
public String getObjectIdentifier() {
int i2 = 2 % 2;
int i3 = f;
int i4 = i3 + 97;
i = i4 % 128;
if (i4 % 2 != 0) {
throw null;
}
String str = this.oid;
int i5 = i3 + 111;
i = i5 % 128;
int i6 = i5 % 2;
return str;
}
public BigInteger getKeyId() {
int i2 = 2 % 2;
int i3 = f + 81;
i = i3 % 128;
if (i3 % 2 == 0) {
return this.keyId;
}
throw null;
}
}