package o; import javax.security.auth.x500.X500Principal; /* loaded from: classes2.dex */ public final class nth { int a; final String b; int c; int d; final int e; char[] g; int j; public nth(X500Principal x500Principal) { String name = x500Principal.getName("RFC2253"); this.b = name; this.e = name.length(); } /* JADX INFO: Access modifiers changed from: package-private */ public final String a() { 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.a; i2 = this.e; if (i >= i2 || this.g[i] != ' ') { break; } this.a = i + 1; } if (i == i2) { return null; } this.d = i; this.a = i + 1; while (true) { i3 = this.a; i4 = this.e; if (i3 >= i4 || (c5 = this.g[i3]) == '=' || c5 == ' ') { break; } this.a = i3 + 1; } if (i3 < i4) { this.c = i3; if (this.g[i3] == ' ') { while (true) { i5 = this.a; i6 = this.e; if (i5 >= i6 || (c4 = this.g[i5]) == '=' || c4 != ' ') { break; } this.a = i5 + 1; } if (this.g[i5] != '=' || i5 == i6) { StringBuilder sb = new StringBuilder("Unexpected end of DN: "); sb.append(this.b); throw new IllegalStateException(sb.toString()); } } this.a++; while (true) { int i7 = this.a; if (i7 >= this.e || this.g[i7] != ' ') { break; } this.a = i7 + 1; } int i8 = this.c; int i9 = this.d; if (i8 - i9 > 4) { char[] cArr = this.g; 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.d = i9 + 4; } } char[] cArr2 = this.g; int i10 = this.d; return new String(cArr2, i10, i8 - i10); } StringBuilder sb2 = new StringBuilder("Unexpected end of DN: "); sb2.append(this.b); throw new IllegalStateException(sb2.toString()); } /* JADX INFO: Access modifiers changed from: package-private */ public final char d() { int i; int i2 = this.a + 1; this.a = i2; if (i2 != this.e) { char c = this.g[i2]; 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: int b = b(i2); this.a++; if (b >= 128) { if (b >= 192 && b <= 247) { if (b <= 223) { b &= 31; i = 1; } else if (b <= 239) { b &= 15; i = 2; } else { b &= 7; i = 3; } for (int i3 = 0; i3 < i; i3++) { int i4 = this.a; int i5 = i4 + 1; this.a = i5; if (i5 != this.e && this.g[i5] == '\\') { int i6 = i4 + 2; this.a = i6; int b2 = b(i6); this.a++; if ((b2 & 192) == 128) { b = (b << 6) + (b2 & 63); } } } } return '?'; } return (char) b; } } } StringBuilder sb = new StringBuilder("Unexpected end of DN: "); sb.append(this.b); throw new IllegalStateException(sb.toString()); } /* JADX INFO: Access modifiers changed from: package-private */ public final int b(int i) { int i2; int i3; int i4 = i + 1; if (i4 < this.e) { char[] cArr = this.g; 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 sb = new StringBuilder("Malformed DN: "); sb.append(this.b); throw new IllegalStateException(sb.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 sb2 = new StringBuilder("Malformed DN: "); sb2.append(this.b); throw new IllegalStateException(sb2.toString()); } i3 = c2 - '7'; } return (i2 << 4) + i3; } StringBuilder sb3 = new StringBuilder("Malformed DN: "); sb3.append(this.b); throw new IllegalStateException(sb3.toString()); } }