175 lines
5.6 KiB
Java
175 lines
5.6 KiB
Java
package o;
|
|
|
|
import com.google.common.primitives.UnsignedBytes;
|
|
import java.io.ByteArrayOutputStream;
|
|
import java.io.EOFException;
|
|
import java.io.IOException;
|
|
import java.io.InputStream;
|
|
import org.spongycastle.asn1.ASN1ParsingException;
|
|
|
|
/* renamed from: o.gnt, reason: case insensitive filesystem */
|
|
/* loaded from: classes6.dex */
|
|
public abstract class AbstractC15344gnt extends AbstractC15315gnE implements InterfaceC15322gnQ {
|
|
private static final char[] b = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
|
|
protected final int c;
|
|
public final byte[] e;
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
@Override // o.AbstractC15315gnE
|
|
public abstract void c(gnG gng) throws IOException;
|
|
|
|
public AbstractC15344gnt(byte[] bArr, int i) {
|
|
byte[] bArr2;
|
|
if (bArr == null) {
|
|
throw new NullPointerException("data cannot be null");
|
|
}
|
|
if (bArr.length == 0 && i != 0) {
|
|
throw new IllegalArgumentException("zero length data with non-zero pad bits");
|
|
}
|
|
if (i > 7 || i < 0) {
|
|
throw new IllegalArgumentException("pad bits cannot be greater than 7 or less than 0");
|
|
}
|
|
if (bArr == null) {
|
|
bArr2 = null;
|
|
} else {
|
|
byte[] bArr3 = new byte[bArr.length];
|
|
System.arraycopy(bArr, 0, bArr3, 0, bArr.length);
|
|
bArr2 = bArr3;
|
|
}
|
|
this.e = bArr2;
|
|
this.c = i;
|
|
}
|
|
|
|
@Override // o.InterfaceC15322gnQ
|
|
public final String j() {
|
|
StringBuffer stringBuffer = new StringBuffer("#");
|
|
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
|
try {
|
|
new gnG(byteArrayOutputStream).d(this);
|
|
byte[] byteArray = byteArrayOutputStream.toByteArray();
|
|
for (int i = 0; i != byteArray.length; i++) {
|
|
char[] cArr = b;
|
|
stringBuffer.append(cArr[(byteArray[i] >>> 4) & 15]);
|
|
stringBuffer.append(cArr[byteArray[i] & 15]);
|
|
}
|
|
return stringBuffer.toString();
|
|
} catch (IOException e) {
|
|
StringBuilder sb = new StringBuilder("Internal error encoding BitString: ");
|
|
sb.append(e.getMessage());
|
|
throw new ASN1ParsingException(sb.toString(), e);
|
|
}
|
|
}
|
|
|
|
public final int g() {
|
|
byte[] bArr = this.e;
|
|
int i = this.c;
|
|
if (i > 0 && bArr.length <= 4) {
|
|
bArr = c(bArr, i);
|
|
}
|
|
int i2 = 0;
|
|
for (int i3 = 0; i3 != bArr.length && i3 != 4; i3++) {
|
|
i2 |= (bArr[i3] & UnsignedBytes.MAX_VALUE) << (i3 << 3);
|
|
}
|
|
return i2;
|
|
}
|
|
|
|
public final byte[] b() {
|
|
return c(this.e, this.c);
|
|
}
|
|
|
|
public String toString() {
|
|
return j();
|
|
}
|
|
|
|
@Override // o.AbstractC15346gnv
|
|
public int hashCode() {
|
|
int i = this.c;
|
|
return i ^ grK.c(c(this.e, i));
|
|
}
|
|
|
|
@Override // o.AbstractC15315gnE
|
|
protected final boolean e(AbstractC15315gnE abstractC15315gnE) {
|
|
if (!(abstractC15315gnE instanceof AbstractC15344gnt)) {
|
|
return false;
|
|
}
|
|
AbstractC15344gnt abstractC15344gnt = (AbstractC15344gnt) abstractC15315gnE;
|
|
int i = this.c;
|
|
return i == abstractC15344gnt.c && grK.b(c(this.e, i), c(abstractC15344gnt.e, abstractC15344gnt.c));
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public static AbstractC15344gnt b(int i, InputStream inputStream) throws IOException {
|
|
if (i <= 0) {
|
|
throw new IllegalArgumentException("truncated BIT STRING detected");
|
|
}
|
|
int read = inputStream.read();
|
|
int i2 = i - 1;
|
|
byte[] bArr = new byte[i2];
|
|
if (i2 != 0) {
|
|
int i3 = 0;
|
|
while (i3 < i2) {
|
|
int read2 = inputStream.read(bArr, i3, i2 - i3);
|
|
if (read2 < 0) {
|
|
break;
|
|
}
|
|
i3 += read2;
|
|
}
|
|
if (i3 != i2) {
|
|
throw new EOFException("EOF encountered in middle of BIT STRING");
|
|
}
|
|
if (read > 0 && read < 8) {
|
|
byte b2 = bArr[i - 2];
|
|
if (b2 != ((byte) ((255 << read) & b2))) {
|
|
return new goO(bArr, read);
|
|
}
|
|
}
|
|
}
|
|
return new C15367gog(bArr, read);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
@Override // o.AbstractC15315gnE
|
|
public final AbstractC15315gnE h() {
|
|
return new C15367gog(this.e, this.c);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
@Override // o.AbstractC15315gnE
|
|
public final AbstractC15315gnE f() {
|
|
return new goO(this.e, this.c);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: protected */
|
|
public static byte[] c(byte[] bArr, int i) {
|
|
byte[] bArr2;
|
|
if (bArr == null) {
|
|
bArr2 = null;
|
|
} else {
|
|
bArr2 = new byte[bArr.length];
|
|
System.arraycopy(bArr, 0, bArr2, 0, bArr.length);
|
|
}
|
|
if (i > 0) {
|
|
int length = bArr.length - 1;
|
|
bArr2[length] = (byte) ((255 << i) & bArr2[length]);
|
|
}
|
|
return bArr2;
|
|
}
|
|
|
|
public final byte[] e() {
|
|
if (this.c != 0) {
|
|
throw new IllegalStateException("attempt to get non-octet aligned data from BIT STRING");
|
|
}
|
|
byte[] bArr = this.e;
|
|
if (bArr == null) {
|
|
return null;
|
|
}
|
|
byte[] bArr2 = new byte[bArr.length];
|
|
System.arraycopy(bArr, 0, bArr2, 0, bArr.length);
|
|
return bArr2;
|
|
}
|
|
|
|
public final int a() {
|
|
return this.c;
|
|
}
|
|
}
|