121 lines
4.6 KiB
Java
121 lines
4.6 KiB
Java
package o;
|
|
|
|
import com.google.common.primitives.UnsignedBytes;
|
|
import java.io.UnsupportedEncodingException;
|
|
import net.sf.scuba.smartcards.ISO7816;
|
|
import net.sf.scuba.smartcards.ISOFileInfo;
|
|
import org.jmrtd.lds.CVCAFile;
|
|
|
|
/* renamed from: o.gja, reason: case insensitive filesystem */
|
|
/* loaded from: classes6.dex */
|
|
public final class C15180gja {
|
|
private static final byte[] e = {65, CVCAFile.CAR_TAG, 67, ISO7816.INS_REHABILITATE_CHV, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, ISOFileInfo.FCP_BYTE, 99, ISOFileInfo.FMD_BYTE, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, ISOFileInfo.FCI_BYTE, ISO7816.INS_MANAGE_CHANNEL, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, ISO7816.INS_DECREASE, 49, ISO7816.INS_INCREASE, 51, ISO7816.INS_DECREASE_STAMPED, 53, 54, 55, 56, 57, 43, 47};
|
|
|
|
public static byte[] c(String str) {
|
|
int i;
|
|
char charAt;
|
|
int length = str.length();
|
|
while (length > 0 && ((charAt = str.charAt(length - 1)) == '=' || charAt == '\n' || charAt == '\r' || charAt == ' ' || charAt == '\t')) {
|
|
length--;
|
|
}
|
|
int i2 = (int) ((length * 6) / 8);
|
|
byte[] bArr = new byte[i2];
|
|
int i3 = 0;
|
|
int i4 = 0;
|
|
int i5 = 0;
|
|
for (int i6 = 0; i6 < length; i6++) {
|
|
char charAt2 = str.charAt(i6);
|
|
if (charAt2 >= 'A' && charAt2 <= 'Z') {
|
|
i = charAt2 - 'A';
|
|
} else if (charAt2 >= 'a' && charAt2 <= 'z') {
|
|
i = charAt2 - 'G';
|
|
} else if (charAt2 >= '0' && charAt2 <= '9') {
|
|
i = charAt2 + 4;
|
|
} else if (charAt2 == '+' || charAt2 == '-') {
|
|
i = 62;
|
|
} else if (charAt2 == '/' || charAt2 == '_') {
|
|
i = 63;
|
|
} else {
|
|
if (charAt2 != '\n' && charAt2 != '\r' && charAt2 != ' ' && charAt2 != '\t') {
|
|
return null;
|
|
}
|
|
}
|
|
i5 = (i5 << 6) | ((byte) i);
|
|
i3++;
|
|
if (i3 % 4 == 0) {
|
|
bArr[i4] = (byte) (i5 >> 16);
|
|
bArr[i4 + 1] = (byte) (i5 >> 8);
|
|
bArr[i4 + 2] = (byte) i5;
|
|
i4 += 3;
|
|
}
|
|
}
|
|
int i7 = i3 % 4;
|
|
if (i7 == 1) {
|
|
return null;
|
|
}
|
|
if (i7 == 2) {
|
|
bArr[i4] = (byte) ((i5 << 12) >> 16);
|
|
i4++;
|
|
} else if (i7 == 3) {
|
|
int i8 = i5 << 6;
|
|
bArr[i4] = (byte) (i8 >> 16);
|
|
bArr[i4 + 1] = (byte) (i8 >> 8);
|
|
i4 += 2;
|
|
}
|
|
if (i4 == i2) {
|
|
return bArr;
|
|
}
|
|
byte[] bArr2 = new byte[i4];
|
|
System.arraycopy(bArr, 0, bArr2, 0, i4);
|
|
return bArr2;
|
|
}
|
|
|
|
public static String c(byte[] bArr) {
|
|
return b(bArr, e);
|
|
}
|
|
|
|
private static String b(byte[] bArr, byte[] bArr2) {
|
|
int i;
|
|
byte[] bArr3 = new byte[((bArr.length + 2) << 2) / 3];
|
|
int length = bArr.length - (bArr.length % 3);
|
|
int i2 = 0;
|
|
int i3 = 0;
|
|
while (i2 < length) {
|
|
bArr3[i3] = bArr2[(bArr[i2] & UnsignedBytes.MAX_VALUE) >> 2];
|
|
int i4 = i2 + 1;
|
|
bArr3[i3 + 1] = bArr2[((bArr[i2] & 3) << 4) | ((bArr[i4] & UnsignedBytes.MAX_VALUE) >> 4)];
|
|
byte b = bArr[i4];
|
|
int i5 = i2 + 2;
|
|
bArr3[i3 + 2] = bArr2[((b & 15) << 2) | ((bArr[i5] & UnsignedBytes.MAX_VALUE) >> 6)];
|
|
bArr3[i3 + 3] = bArr2[bArr[i5] & 63];
|
|
i2 += 3;
|
|
i3 += 4;
|
|
}
|
|
int length2 = bArr.length % 3;
|
|
try {
|
|
if (length2 == 1) {
|
|
bArr3[i3] = bArr2[(bArr[length] & UnsignedBytes.MAX_VALUE) >> 2];
|
|
bArr3[i3 + 1] = bArr2[(bArr[length] & 3) << 4];
|
|
bArr3[i3 + 2] = 61;
|
|
i = i3 + 4;
|
|
bArr3[i3 + 3] = 61;
|
|
} else {
|
|
if (length2 == 2) {
|
|
bArr3[i3] = bArr2[(bArr[length] & UnsignedBytes.MAX_VALUE) >> 2];
|
|
byte b2 = bArr[length];
|
|
int i6 = length + 1;
|
|
bArr3[i3 + 1] = bArr2[((b2 & 3) << 4) | ((bArr[i6] & UnsignedBytes.MAX_VALUE) >> 4)];
|
|
bArr3[i3 + 2] = bArr2[(bArr[i6] & 15) << 2];
|
|
i = i3 + 4;
|
|
bArr3[i3 + 3] = 61;
|
|
}
|
|
return new String(bArr3, 0, i3, "US-ASCII");
|
|
}
|
|
return new String(bArr3, 0, i3, "US-ASCII");
|
|
} catch (UnsupportedEncodingException e2) {
|
|
throw new AssertionError(e2);
|
|
}
|
|
i3 = i;
|
|
}
|
|
}
|