what-the-bank/sources/org/ejbca/cvc/CVCertificate.java

71 lines
2.2 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package org.ejbca.cvc;
import java.io.IOException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.PublicKey;
import java.security.Signature;
import java.security.SignatureException;
import java.security.cert.CertificateException;
import o.AbstractC15245glT;
import o.C15288gmc;
import o.C15294gmi;
import o.glA;
import o.glH;
import o.glK;
import o.glP;
import o.glQ;
import o.glS;
import org.ejbca.cvc.exception.ConstructionException;
/* loaded from: classes6.dex */
public class CVCertificate extends glA {
private static glS[] c = {glS.CERTIFICATE_BODY, glS.SIGNATURE};
public CVCertificate() {
super(glS.CV_CERTIFICATE);
}
public CVCertificate(glQ glq) throws ConstructionException {
this();
c((AbstractC15245glT) glq);
}
public String toString() {
return d("");
}
public final void a(PublicKey publicKey, String str) throws CertificateException, NoSuchAlgorithmException, NoSuchProviderException, InvalidKeyException, SignatureException {
try {
String c2 = glH.c((C15288gmc) ((glP) ((glQ) e(glS.CERTIFICATE_BODY)).e(glS.PUBLIC_KEY)).e(glS.OID));
Signature signature = Signature.getInstance(c2, str);
signature.initVerify(publicKey);
signature.update(f());
if (signature.verify(C15294gmi.e(c2, ((glK) e(glS.SIGNATURE)).d))) {
} else {
throw new SignatureException("Signature verification failed!");
}
} catch (NoSuchFieldException e) {
throw new CertificateException("CV-Certificate is corrupt", e);
} catch (ConstructionException e2) {
throw new CertificateException("CV-Certificate is corrupt", e2);
}
}
public final byte[] f() throws ConstructionException {
try {
return ((glQ) e(glS.CERTIFICATE_BODY)).d();
} catch (IOException e) {
throw new ConstructionException(e);
} catch (NoSuchFieldException e2) {
throw new ConstructionException(e2);
}
}
@Override // o.glA
public final glS[] a() {
return c;
}
}