207 lines
9.9 KiB
Java
207 lines
9.9 KiB
Java
package o;
|
|
|
|
import java.math.BigInteger;
|
|
import java.security.interfaces.ECPublicKey;
|
|
import java.security.spec.ECField;
|
|
import java.security.spec.ECFieldFp;
|
|
import java.security.spec.ECParameterSpec;
|
|
import java.security.spec.ECPoint;
|
|
import java.security.spec.EllipticCurve;
|
|
import java.util.Arrays;
|
|
import org.bouncycastle.jce.ECPointUtil;
|
|
import org.ejbca.cvc.exception.ConstructionException;
|
|
|
|
/* renamed from: o.gma, reason: case insensitive filesystem */
|
|
/* loaded from: classes6.dex */
|
|
public final class C15286gma extends glP implements ECPublicKey {
|
|
private static glS[] d = {glS.OID, glS.MODULUS, glS.COEFFICIENT_A, glS.COEFFICIENT_B, glS.BASE_POINT_G, glS.BASE_POINT_R_ORDER, glS.PUBLIC_POINT_Y, glS.COFACTOR_F};
|
|
|
|
public C15286gma(glY gly) throws ConstructionException, NoSuchFieldException {
|
|
c(gly.e(glS.OID));
|
|
c(gly.b.get(glS.MODULUS));
|
|
c(gly.b.get(glS.COEFFICIENT_A));
|
|
c(gly.b.get(glS.COEFFICIENT_B));
|
|
c(gly.b.get(glS.BASE_POINT_G));
|
|
c(gly.b.get(glS.BASE_POINT_R_ORDER));
|
|
c(gly.e(glS.PUBLIC_POINT_Y));
|
|
c(gly.b.get(glS.COFACTOR_F));
|
|
}
|
|
|
|
public C15286gma(C15288gmc c15288gmc, ECPublicKey eCPublicKey, InterfaceC15243glE interfaceC15243glE) throws ConstructionException {
|
|
c(c15288gmc);
|
|
ECParameterSpec params = eCPublicKey.getParams();
|
|
boolean z = interfaceC15243glE == null || interfaceC15243glE.a();
|
|
if (z) {
|
|
ECField field = params.getCurve().getField();
|
|
if (field instanceof ECFieldFp) {
|
|
c(new glK(glS.MODULUS, e(((ECFieldFp) field).getP().toByteArray())));
|
|
}
|
|
c(new glK(glS.COEFFICIENT_A, e(params.getCurve().getA().toByteArray())));
|
|
c(new glK(glS.COEFFICIENT_B, e(params.getCurve().getB().toByteArray())));
|
|
c(new glK(glS.BASE_POINT_G, e(params.getGenerator(), params.getCurve())));
|
|
c(new glK(glS.BASE_POINT_R_ORDER, e(params.getOrder().toByteArray())));
|
|
}
|
|
c(new glK(glS.PUBLIC_POINT_Y, e(eCPublicKey.getW(), params.getCurve())));
|
|
if (z) {
|
|
c(new C15287gmb(glS.COFACTOR_F, params.getCofactor()));
|
|
}
|
|
}
|
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:14:0x0043, code lost:
|
|
|
|
if (r3.b.a() != false) goto L16;
|
|
*/
|
|
/* JADX WARN: Code restructure failed: missing block: B:18:0x0046, code lost:
|
|
|
|
if (r3 == null) goto L16;
|
|
*/
|
|
@Override // o.glA
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
protected final java.util.List<o.AbstractC15245glT> c() {
|
|
/*
|
|
r6 = this;
|
|
java.util.ArrayList r0 = new java.util.ArrayList // Catch: java.lang.NoSuchFieldException -> L99
|
|
r0.<init>() // Catch: java.lang.NoSuchFieldException -> L99
|
|
o.glS r1 = o.glS.OID // Catch: java.lang.NoSuchFieldException -> L99
|
|
o.glT r1 = r6.e(r1) // Catch: java.lang.NoSuchFieldException -> L99
|
|
r0.add(r1) // Catch: java.lang.NoSuchFieldException -> L99
|
|
java.security.spec.ECParameterSpec r1 = r6.getParams() // Catch: java.lang.NoSuchFieldException -> L99
|
|
r2 = 0
|
|
if (r1 == 0) goto L49
|
|
o.glA r3 = r6.e() // Catch: java.lang.NoSuchFieldException -> L99
|
|
if (r3 == 0) goto L46
|
|
o.glS r4 = r3.b() // Catch: java.lang.NoSuchFieldException -> L99
|
|
o.glS r5 = o.glS.CERTIFICATE_BODY // Catch: java.lang.NoSuchFieldException -> L99
|
|
if (r4 != r5) goto L46
|
|
o.glQ r3 = (o.glQ) r3 // Catch: java.lang.NoSuchFieldException -> L49
|
|
o.glS r4 = o.glS.HOLDER_AUTH_TEMPLATE // Catch: java.lang.NoSuchFieldException -> L49
|
|
java.util.Map<o.glS, o.glT> r3 = r3.b // Catch: java.lang.NoSuchFieldException -> L49
|
|
java.lang.Object r3 = r3.get(r4) // Catch: java.lang.NoSuchFieldException -> L49
|
|
o.glT r3 = (o.AbstractC15245glT) r3 // Catch: java.lang.NoSuchFieldException -> L49
|
|
if (r3 == 0) goto L48
|
|
org.ejbca.cvc.CVCAuthorizationTemplate r3 = (org.ejbca.cvc.CVCAuthorizationTemplate) r3 // Catch: java.lang.NoSuchFieldException -> L49
|
|
o.glS r4 = o.glS.ROLE_AND_ACCESS_RIGHTS // Catch: java.lang.NoSuchFieldException -> L49
|
|
o.glT r3 = r3.e(r4) // Catch: java.lang.NoSuchFieldException -> L49
|
|
o.glF r3 = (o.glF) r3 // Catch: java.lang.NoSuchFieldException -> L49
|
|
if (r3 == 0) goto L49
|
|
o.glE r3 = r3.b // Catch: java.lang.NoSuchFieldException -> L49
|
|
boolean r3 = r3.a() // Catch: java.lang.NoSuchFieldException -> L49
|
|
if (r3 == 0) goto L49
|
|
goto L48
|
|
L46:
|
|
if (r3 != 0) goto L49
|
|
L48:
|
|
r2 = 1
|
|
L49:
|
|
if (r2 == 0) goto L84
|
|
java.security.spec.EllipticCurve r1 = r1.getCurve() // Catch: java.lang.NoSuchFieldException -> L99
|
|
java.security.spec.ECField r1 = r1.getField() // Catch: java.lang.NoSuchFieldException -> L99
|
|
boolean r1 = r1 instanceof java.security.spec.ECFieldFp
|
|
if (r1 == 0) goto L60
|
|
o.glS r1 = o.glS.MODULUS // Catch: java.lang.NoSuchFieldException -> L99
|
|
o.glT r1 = r6.e(r1) // Catch: java.lang.NoSuchFieldException -> L99
|
|
r0.add(r1) // Catch: java.lang.NoSuchFieldException -> L99
|
|
L60:
|
|
o.glS r1 = o.glS.COEFFICIENT_A // Catch: java.lang.NoSuchFieldException -> L99
|
|
o.glT r1 = r6.e(r1) // Catch: java.lang.NoSuchFieldException -> L99
|
|
r0.add(r1) // Catch: java.lang.NoSuchFieldException -> L99
|
|
o.glS r1 = o.glS.COEFFICIENT_B // Catch: java.lang.NoSuchFieldException -> L99
|
|
o.glT r1 = r6.e(r1) // Catch: java.lang.NoSuchFieldException -> L99
|
|
r0.add(r1) // Catch: java.lang.NoSuchFieldException -> L99
|
|
o.glS r1 = o.glS.BASE_POINT_G // Catch: java.lang.NoSuchFieldException -> L99
|
|
o.glT r1 = r6.e(r1) // Catch: java.lang.NoSuchFieldException -> L99
|
|
r0.add(r1) // Catch: java.lang.NoSuchFieldException -> L99
|
|
o.glS r1 = o.glS.BASE_POINT_R_ORDER // Catch: java.lang.NoSuchFieldException -> L99
|
|
o.glT r1 = r6.e(r1) // Catch: java.lang.NoSuchFieldException -> L99
|
|
r0.add(r1) // Catch: java.lang.NoSuchFieldException -> L99
|
|
L84:
|
|
o.glS r1 = o.glS.PUBLIC_POINT_Y // Catch: java.lang.NoSuchFieldException -> L99
|
|
o.glT r1 = r6.e(r1) // Catch: java.lang.NoSuchFieldException -> L99
|
|
r0.add(r1) // Catch: java.lang.NoSuchFieldException -> L99
|
|
if (r2 == 0) goto L98
|
|
o.glS r1 = o.glS.COFACTOR_F // Catch: java.lang.NoSuchFieldException -> L99
|
|
o.glT r1 = r6.e(r1) // Catch: java.lang.NoSuchFieldException -> L99
|
|
r0.add(r1) // Catch: java.lang.NoSuchFieldException -> L99
|
|
L98:
|
|
return r0
|
|
L99:
|
|
r0 = move-exception
|
|
java.lang.IllegalStateException r1 = new java.lang.IllegalStateException
|
|
r1.<init>(r0)
|
|
throw r1
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: o.C15286gma.c():java.util.List");
|
|
}
|
|
|
|
@Override // java.security.interfaces.ECKey
|
|
public final ECParameterSpec getParams() {
|
|
glK glk = (glK) this.b.get(glS.MODULUS);
|
|
glK glk2 = (glK) this.b.get(glS.COEFFICIENT_A);
|
|
glK glk3 = (glK) this.b.get(glS.COEFFICIENT_B);
|
|
glK glk4 = (glK) this.b.get(glS.BASE_POINT_G);
|
|
glK glk5 = (glK) this.b.get(glS.BASE_POINT_R_ORDER);
|
|
C15287gmb c15287gmb = (C15287gmb) this.b.get(glS.COFACTOR_F);
|
|
if (glk == null) {
|
|
return null;
|
|
}
|
|
EllipticCurve ellipticCurve = new EllipticCurve(new ECFieldFp(new BigInteger(1, glk.d)), new BigInteger(1, glk2.d), new BigInteger(1, glk3.d));
|
|
return new ECParameterSpec(ellipticCurve, ECPointUtil.decodePoint(ellipticCurve, glk4.d), new BigInteger(1, glk5.d), c15287gmb.e);
|
|
}
|
|
|
|
@Override // java.security.interfaces.ECPublicKey
|
|
public final ECPoint getW() {
|
|
try {
|
|
byte[] bArr = ((glK) e(glS.PUBLIC_POINT_Y)).d;
|
|
if (bArr[0] != 4) {
|
|
throw new IllegalArgumentException("First byte must be 0x4");
|
|
}
|
|
int length = (bArr.length - 1) / 2;
|
|
byte[] bArr2 = new byte[length];
|
|
int length2 = (bArr.length - 1) / 2;
|
|
byte[] bArr3 = new byte[length2];
|
|
System.arraycopy(bArr, 1, bArr2, 0, length);
|
|
System.arraycopy(bArr, length + 1, bArr3, 0, length2);
|
|
return new ECPoint(new BigInteger(1, bArr2), new BigInteger(1, bArr3));
|
|
} catch (NoSuchFieldException e) {
|
|
throw new IllegalStateException(e);
|
|
}
|
|
}
|
|
|
|
private static byte[] e(ECPoint eCPoint, EllipticCurve ellipticCurve) {
|
|
int length;
|
|
byte[] e = e(eCPoint.getAffineX().toByteArray());
|
|
byte[] e2 = e(eCPoint.getAffineY().toByteArray());
|
|
if (ellipticCurve != null) {
|
|
length = (ellipticCurve.getField().getFieldSize() + 7) >> 3;
|
|
} else {
|
|
length = e.length > e2.length ? e.length : e2.length;
|
|
}
|
|
int length2 = e.length < length ? length - e.length : 0;
|
|
int length3 = e2.length < length ? length - e2.length : 0;
|
|
byte[] bArr = new byte[(length << 1) + 1];
|
|
Arrays.fill(bArr, (byte) 0);
|
|
bArr[0] = 4;
|
|
System.arraycopy(e, 0, bArr, length2 + 1, length - length2);
|
|
System.arraycopy(e2, 0, bArr, length + 1 + length3, length - length3);
|
|
return bArr;
|
|
}
|
|
|
|
@Override // java.security.Key
|
|
public final String getFormat() {
|
|
return "CVC";
|
|
}
|
|
|
|
@Override // o.glA
|
|
protected final glS[] a() {
|
|
return d;
|
|
}
|
|
|
|
@Override // java.security.Key
|
|
public final String getAlgorithm() {
|
|
return "ECDSA";
|
|
}
|
|
}
|