443 lines
13 KiB
Java
443 lines
13 KiB
Java
|
package okhttp3.repackaged.internal.tls;
|
||
|
|
||
|
import javax.security.auth.x500.X500Principal;
|
||
|
|
||
|
/* loaded from: classes6.dex */
|
||
|
final class a {
|
||
|
private final String amT;
|
||
|
private int amU;
|
||
|
private int amV;
|
||
|
private char[] chars;
|
||
|
private int end;
|
||
|
private final int length;
|
||
|
private int pos;
|
||
|
|
||
|
public a(X500Principal x500Principal) {
|
||
|
String name = x500Principal.getName("RFC2253");
|
||
|
this.amT = name;
|
||
|
this.length = name.length();
|
||
|
}
|
||
|
|
||
|
private String vo() {
|
||
|
int i;
|
||
|
int i2;
|
||
|
int i3;
|
||
|
int i4;
|
||
|
char c;
|
||
|
char c2;
|
||
|
char c3;
|
||
|
int i5;
|
||
|
int i6;
|
||
|
char c4;
|
||
|
char c5;
|
||
|
while (true) {
|
||
|
i = this.pos;
|
||
|
i2 = this.length;
|
||
|
if (i >= i2 || this.chars[i] != ' ') {
|
||
|
break;
|
||
|
}
|
||
|
this.pos = i + 1;
|
||
|
}
|
||
|
if (i == i2) {
|
||
|
return null;
|
||
|
}
|
||
|
this.amU = i;
|
||
|
this.pos = i + 1;
|
||
|
while (true) {
|
||
|
i3 = this.pos;
|
||
|
i4 = this.length;
|
||
|
if (i3 >= i4 || (c5 = this.chars[i3]) == '=' || c5 == ' ') {
|
||
|
break;
|
||
|
}
|
||
|
this.pos = i3 + 1;
|
||
|
}
|
||
|
if (i3 >= i4) {
|
||
|
StringBuilder sb = new StringBuilder("Unexpected end of DN: ");
|
||
|
sb.append(this.amT);
|
||
|
throw new IllegalStateException(sb.toString());
|
||
|
}
|
||
|
this.end = i3;
|
||
|
if (this.chars[i3] == ' ') {
|
||
|
while (true) {
|
||
|
i5 = this.pos;
|
||
|
i6 = this.length;
|
||
|
if (i5 >= i6 || (c4 = this.chars[i5]) == '=' || c4 != ' ') {
|
||
|
break;
|
||
|
}
|
||
|
this.pos = i5 + 1;
|
||
|
}
|
||
|
if (this.chars[i5] != '=' || i5 == i6) {
|
||
|
StringBuilder sb2 = new StringBuilder("Unexpected end of DN: ");
|
||
|
sb2.append(this.amT);
|
||
|
throw new IllegalStateException(sb2.toString());
|
||
|
}
|
||
|
}
|
||
|
this.pos++;
|
||
|
while (true) {
|
||
|
int i7 = this.pos;
|
||
|
if (i7 >= this.length || this.chars[i7] != ' ') {
|
||
|
break;
|
||
|
}
|
||
|
this.pos = i7 + 1;
|
||
|
}
|
||
|
int i8 = this.end;
|
||
|
int i9 = this.amU;
|
||
|
if (i8 - i9 > 4) {
|
||
|
char[] cArr = this.chars;
|
||
|
if (cArr[i9 + 3] == '.' && (((c = cArr[i9]) == 'O' || c == 'o') && (((c2 = cArr[i9 + 1]) == 'I' || c2 == 'i') && ((c3 = cArr[i9 + 2]) == 'D' || c3 == 'd')))) {
|
||
|
this.amU = i9 + 4;
|
||
|
}
|
||
|
}
|
||
|
char[] cArr2 = this.chars;
|
||
|
int i10 = this.amU;
|
||
|
return new String(cArr2, i10, i8 - i10);
|
||
|
}
|
||
|
|
||
|
private String vp() {
|
||
|
int i = this.pos + 1;
|
||
|
this.pos = i;
|
||
|
this.amU = i;
|
||
|
this.end = i;
|
||
|
while (true) {
|
||
|
int i2 = this.pos;
|
||
|
if (i2 == this.length) {
|
||
|
StringBuilder sb = new StringBuilder("Unexpected end of DN: ");
|
||
|
sb.append(this.amT);
|
||
|
throw new IllegalStateException(sb.toString());
|
||
|
}
|
||
|
char[] cArr = this.chars;
|
||
|
char c = cArr[i2];
|
||
|
if (c == '\"') {
|
||
|
this.pos = i2 + 1;
|
||
|
while (true) {
|
||
|
int i3 = this.pos;
|
||
|
if (i3 >= this.length || this.chars[i3] != ' ') {
|
||
|
break;
|
||
|
}
|
||
|
this.pos = i3 + 1;
|
||
|
}
|
||
|
char[] cArr2 = this.chars;
|
||
|
int i4 = this.amU;
|
||
|
return new String(cArr2, i4, this.end - i4);
|
||
|
}
|
||
|
if (c == '\\') {
|
||
|
cArr[this.end] = vs();
|
||
|
} else {
|
||
|
cArr[this.end] = c;
|
||
|
}
|
||
|
this.pos++;
|
||
|
this.end++;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private String vq() {
|
||
|
int i;
|
||
|
char[] cArr;
|
||
|
char c;
|
||
|
int i2 = this.pos;
|
||
|
if (i2 + 4 >= this.length) {
|
||
|
StringBuilder sb = new StringBuilder("Unexpected end of DN: ");
|
||
|
sb.append(this.amT);
|
||
|
throw new IllegalStateException(sb.toString());
|
||
|
}
|
||
|
this.amU = i2;
|
||
|
this.pos = i2 + 1;
|
||
|
while (true) {
|
||
|
i = this.pos;
|
||
|
if (i == this.length || (c = (cArr = this.chars)[i]) == '+' || c == ',' || c == ';') {
|
||
|
break;
|
||
|
}
|
||
|
if (c == ' ') {
|
||
|
this.end = i;
|
||
|
this.pos = i + 1;
|
||
|
while (true) {
|
||
|
int i3 = this.pos;
|
||
|
if (i3 >= this.length || this.chars[i3] != ' ') {
|
||
|
break;
|
||
|
}
|
||
|
this.pos = i3 + 1;
|
||
|
}
|
||
|
} else {
|
||
|
if (c >= 'A' && c <= 'F') {
|
||
|
cArr[i] = (char) (c + ' ');
|
||
|
}
|
||
|
this.pos = i + 1;
|
||
|
}
|
||
|
}
|
||
|
this.end = i;
|
||
|
int i4 = this.end;
|
||
|
int i5 = this.amU;
|
||
|
int i6 = i4 - i5;
|
||
|
if (i6 < 5 || (i6 & 1) == 0) {
|
||
|
StringBuilder sb2 = new StringBuilder("Unexpected end of DN: ");
|
||
|
sb2.append(this.amT);
|
||
|
throw new IllegalStateException(sb2.toString());
|
||
|
}
|
||
|
int i7 = i6 / 2;
|
||
|
byte[] bArr = new byte[i7];
|
||
|
int i8 = i5 + 1;
|
||
|
for (int i9 = 0; i9 < i7; i9++) {
|
||
|
bArr[i9] = (byte) Q(i8);
|
||
|
i8 += 2;
|
||
|
}
|
||
|
return new String(this.chars, this.amU, i6);
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Code restructure failed: missing block: B:21:0x009b, code lost:
|
||
|
|
||
|
return new java.lang.String(r0, r1, r8.amV - r1);
|
||
|
*/
|
||
|
/*
|
||
|
Code decompiled incorrectly, please refer to instructions dump.
|
||
|
To view partially-correct add '--show-bad-code' argument
|
||
|
*/
|
||
|
private java.lang.String vr() {
|
||
|
/*
|
||
|
r8 = this;
|
||
|
int r0 = r8.pos
|
||
|
r8.amU = r0
|
||
|
r8.end = r0
|
||
|
L6:
|
||
|
int r0 = r8.pos
|
||
|
int r1 = r8.length
|
||
|
if (r0 < r1) goto L19
|
||
|
char[] r0 = r8.chars
|
||
|
int r1 = r8.amU
|
||
|
java.lang.String r2 = new java.lang.String
|
||
|
int r3 = r8.end
|
||
|
int r3 = r3 - r1
|
||
|
r2.<init>(r0, r1, r3)
|
||
|
return r2
|
||
|
L19:
|
||
|
char[] r1 = r8.chars
|
||
|
char r2 = r1[r0]
|
||
|
r3 = 44
|
||
|
r4 = 43
|
||
|
r5 = 59
|
||
|
r6 = 32
|
||
|
if (r2 == r6) goto L5c
|
||
|
if (r2 == r5) goto L51
|
||
|
r5 = 92
|
||
|
if (r2 == r5) goto L3e
|
||
|
if (r2 == r4) goto L51
|
||
|
if (r2 == r3) goto L51
|
||
|
int r3 = r8.end
|
||
|
int r4 = r3 + 1
|
||
|
r8.end = r4
|
||
|
r1[r3] = r2
|
||
|
int r0 = r0 + 1
|
||
|
r8.pos = r0
|
||
|
goto L6
|
||
|
L3e:
|
||
|
int r0 = r8.end
|
||
|
int r2 = r0 + 1
|
||
|
r8.end = r2
|
||
|
char r2 = r8.vs()
|
||
|
r1[r0] = r2
|
||
|
int r0 = r8.pos
|
||
|
int r0 = r0 + 1
|
||
|
r8.pos = r0
|
||
|
goto L6
|
||
|
L51:
|
||
|
int r0 = r8.amU
|
||
|
java.lang.String r2 = new java.lang.String
|
||
|
int r3 = r8.end
|
||
|
int r3 = r3 - r0
|
||
|
r2.<init>(r1, r0, r3)
|
||
|
return r2
|
||
|
L5c:
|
||
|
int r2 = r8.end
|
||
|
r8.amV = r2
|
||
|
int r0 = r0 + 1
|
||
|
r8.pos = r0
|
||
|
int r0 = r2 + 1
|
||
|
r8.end = r0
|
||
|
r1[r2] = r6
|
||
|
L6a:
|
||
|
int r0 = r8.pos
|
||
|
int r1 = r8.length
|
||
|
if (r0 >= r1) goto L83
|
||
|
char[] r2 = r8.chars
|
||
|
char r7 = r2[r0]
|
||
|
if (r7 != r6) goto L83
|
||
|
int r1 = r8.end
|
||
|
int r7 = r1 + 1
|
||
|
r8.end = r7
|
||
|
r2[r1] = r6
|
||
|
int r0 = r0 + 1
|
||
|
r8.pos = r0
|
||
|
goto L6a
|
||
|
L83:
|
||
|
if (r0 == r1) goto L8f
|
||
|
char[] r1 = r8.chars
|
||
|
char r0 = r1[r0]
|
||
|
if (r0 == r3) goto L8f
|
||
|
if (r0 == r4) goto L8f
|
||
|
if (r0 != r5) goto L6
|
||
|
L8f:
|
||
|
char[] r0 = r8.chars
|
||
|
int r1 = r8.amU
|
||
|
java.lang.String r2 = new java.lang.String
|
||
|
int r3 = r8.amV
|
||
|
int r3 = r3 - r1
|
||
|
r2.<init>(r0, r1, r3)
|
||
|
return r2
|
||
|
*/
|
||
|
throw new UnsupportedOperationException("Method not decompiled: okhttp3.repackaged.internal.tls.a.vr():java.lang.String");
|
||
|
}
|
||
|
|
||
|
private char vs() {
|
||
|
int i = this.pos + 1;
|
||
|
this.pos = i;
|
||
|
if (i == this.length) {
|
||
|
StringBuilder sb = new StringBuilder("Unexpected end of DN: ");
|
||
|
sb.append(this.amT);
|
||
|
throw new IllegalStateException(sb.toString());
|
||
|
}
|
||
|
char c = this.chars[i];
|
||
|
if (c == ' ' || c == '%' || c == '\\' || c == '_' || c == '\"' || c == '#') {
|
||
|
return c;
|
||
|
}
|
||
|
switch (c) {
|
||
|
case '*':
|
||
|
case '+':
|
||
|
case ',':
|
||
|
return c;
|
||
|
default:
|
||
|
switch (c) {
|
||
|
case ';':
|
||
|
case '<':
|
||
|
case '=':
|
||
|
case '>':
|
||
|
return c;
|
||
|
default:
|
||
|
return vt();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private char vt() {
|
||
|
int i;
|
||
|
int i2;
|
||
|
int Q = Q(this.pos);
|
||
|
this.pos++;
|
||
|
if (Q < 128) {
|
||
|
return (char) Q;
|
||
|
}
|
||
|
if (Q < 192 || Q > 247) {
|
||
|
return '?';
|
||
|
}
|
||
|
if (Q <= 223) {
|
||
|
i = Q & 31;
|
||
|
i2 = 1;
|
||
|
} else if (Q <= 239) {
|
||
|
i = Q & 15;
|
||
|
i2 = 2;
|
||
|
} else {
|
||
|
i = Q & 7;
|
||
|
i2 = 3;
|
||
|
}
|
||
|
for (int i3 = 0; i3 < i2; i3++) {
|
||
|
int i4 = this.pos;
|
||
|
int i5 = i4 + 1;
|
||
|
this.pos = i5;
|
||
|
if (i5 == this.length || this.chars[i5] != '\\') {
|
||
|
return '?';
|
||
|
}
|
||
|
int i6 = i4 + 2;
|
||
|
this.pos = i6;
|
||
|
int Q2 = Q(i6);
|
||
|
this.pos++;
|
||
|
if ((Q2 & 192) != 128) {
|
||
|
return '?';
|
||
|
}
|
||
|
i = (i << 6) + (Q2 & 63);
|
||
|
}
|
||
|
return (char) i;
|
||
|
}
|
||
|
|
||
|
private int Q(int i) {
|
||
|
int i2;
|
||
|
int i3;
|
||
|
int i4 = i + 1;
|
||
|
if (i4 >= this.length) {
|
||
|
StringBuilder sb = new StringBuilder("Malformed DN: ");
|
||
|
sb.append(this.amT);
|
||
|
throw new IllegalStateException(sb.toString());
|
||
|
}
|
||
|
char[] cArr = this.chars;
|
||
|
char c = cArr[i];
|
||
|
if (c >= '0' && c <= '9') {
|
||
|
i2 = c - '0';
|
||
|
} else if (c >= 'a' && c <= 'f') {
|
||
|
i2 = c - 'W';
|
||
|
} else {
|
||
|
if (c < 'A' || c > 'F') {
|
||
|
StringBuilder sb2 = new StringBuilder("Malformed DN: ");
|
||
|
sb2.append(this.amT);
|
||
|
throw new IllegalStateException(sb2.toString());
|
||
|
}
|
||
|
i2 = c - '7';
|
||
|
}
|
||
|
char c2 = cArr[i4];
|
||
|
if (c2 >= '0' && c2 <= '9') {
|
||
|
i3 = c2 - '0';
|
||
|
} else if (c2 >= 'a' && c2 <= 'f') {
|
||
|
i3 = c2 - 'W';
|
||
|
} else {
|
||
|
if (c2 < 'A' || c2 > 'F') {
|
||
|
StringBuilder sb3 = new StringBuilder("Malformed DN: ");
|
||
|
sb3.append(this.amT);
|
||
|
throw new IllegalStateException(sb3.toString());
|
||
|
}
|
||
|
i3 = c2 - '7';
|
||
|
}
|
||
|
return (i2 << 4) + i3;
|
||
|
}
|
||
|
|
||
|
public final String findMostSpecific(String str) {
|
||
|
String vp;
|
||
|
this.pos = 0;
|
||
|
this.amU = 0;
|
||
|
this.end = 0;
|
||
|
this.amV = 0;
|
||
|
this.chars = this.amT.toCharArray();
|
||
|
String vo = vo();
|
||
|
if (vo == null) {
|
||
|
return null;
|
||
|
}
|
||
|
do {
|
||
|
int i = this.pos;
|
||
|
if (i == this.length) {
|
||
|
return null;
|
||
|
}
|
||
|
char c = this.chars[i];
|
||
|
if (c == '\"') {
|
||
|
vp = vp();
|
||
|
} else if (c == '#') {
|
||
|
vp = vq();
|
||
|
} else {
|
||
|
vp = (c == '+' || c == ',' || c == ';') ? "" : vr();
|
||
|
}
|
||
|
if (str.equalsIgnoreCase(vo)) {
|
||
|
return vp;
|
||
|
}
|
||
|
int i2 = this.pos;
|
||
|
if (i2 >= this.length) {
|
||
|
return null;
|
||
|
}
|
||
|
char c2 = this.chars[i2];
|
||
|
if (c2 != ',' && c2 != ';' && c2 != '+') {
|
||
|
StringBuilder sb = new StringBuilder("Malformed DN: ");
|
||
|
sb.append(this.amT);
|
||
|
throw new IllegalStateException(sb.toString());
|
||
|
}
|
||
|
this.pos = i2 + 1;
|
||
|
vo = vo();
|
||
|
} while (vo != null);
|
||
|
StringBuilder sb2 = new StringBuilder("Malformed DN: ");
|
||
|
sb2.append(this.amT);
|
||
|
throw new IllegalStateException(sb2.toString());
|
||
|
}
|
||
|
}
|