what-the-bank/sources/o/Ltv.java

72 lines
2.5 KiB
Java

package o;
import com.eracom.OBM2.EncryptedMessageException;
import java.math.BigInteger;
/* loaded from: classes.dex */
public final class Ltv {
private int a;
private int b;
private int c;
private BigInteger d;
byte[] e;
private BigInteger f;
private int h;
private String i;
private String j;
public Ltv(C17386wMj c17386wMj, int i, String str, String str2) throws EncryptedMessageException {
byte[] bArr;
this.c = i;
this.i = str;
this.j = str2;
if (i == 0 || str2 == null || str == null) {
throw new EncryptedMessageException("Error no : 42 Invalid RSA key");
}
try {
this.d = new BigInteger(str2, 16);
this.f = new BigInteger(str, 16);
int i2 = c17386wMj.a;
int length = (this.j.length() + 1) / 2;
int length2 = (this.i.length() + 1) / 2;
int i3 = this.c;
if (length != i3 || length2 != i3) {
StringBuilder sb = new StringBuilder("Error no : 41 Invalid RSA key length mod=");
sb.append(length);
sb.append("<>");
sb.append(this.c);
sb.append(" exp=");
sb.append(length2);
sb.append("<>");
sb.append(this.c);
throw new EncryptedMessageException(sb.toString());
}
int i4 = length << 3;
this.h = i4;
int i5 = (i4 + 7) / 8;
this.a = i5;
this.b = i5 - 1;
if (i5 < 0) {
throw new EncryptedMessageException("Error no : 40 input data too large for RSA encryption");
}
byte[] byteArray = new BigInteger(1, c17386wMj.c).modPow(this.f, this.d).toByteArray();
int length3 = byteArray.length;
if (byteArray[0] != 0 || length3 <= this.a) {
int i6 = this.a;
if (length3 < i6) {
bArr = new byte[i6];
System.arraycopy(byteArray, 0, bArr, i6 - length3, length3);
}
this.e = byteArray;
}
int i7 = length3 - 1;
bArr = new byte[i7];
System.arraycopy(byteArray, 1, bArr, 0, i7);
byteArray = bArr;
this.e = byteArray;
} catch (NumberFormatException unused) {
throw new EncryptedMessageException("Error no : 42 Invalid RSA key");
}
}
}