package org.bouncycastle.pqc.jcajce.provider.mceliece; import java.io.IOException; import java.security.PrivateKey; import org.bouncycastle.asn1.pkcs.PrivateKeyInfo; import org.bouncycastle.asn1.x509.AlgorithmIdentifier; import org.bouncycastle.crypto.params.AsymmetricKeyParameter; import org.bouncycastle.pqc.asn1.McElieceCCA2PrivateKey; import org.bouncycastle.pqc.asn1.PQCObjectIdentifiers; import org.bouncycastle.pqc.crypto.mceliece.McElieceCCA2PrivateKeyParameters; import org.bouncycastle.pqc.math.linearalgebra.GF2Matrix; import org.bouncycastle.pqc.math.linearalgebra.GF2mField; import org.bouncycastle.pqc.math.linearalgebra.Permutation; import org.bouncycastle.pqc.math.linearalgebra.PolynomialGF2mSmallM; /* loaded from: classes6.dex */ public class BCMcElieceCCA2PrivateKey implements PrivateKey { private static final long serialVersionUID = 1; private McElieceCCA2PrivateKeyParameters params; public String toString() { StringBuilder sb = new StringBuilder(" extension degree of the field : "); sb.append(getN()); sb.append("\n"); String obj = sb.toString(); StringBuilder sb2 = new StringBuilder(); sb2.append(obj); sb2.append(" dimension of the code : "); sb2.append(getK()); sb2.append("\n"); String obj2 = sb2.toString(); StringBuilder sb3 = new StringBuilder(); sb3.append(obj2); sb3.append(" irreducible Goppa polynomial : "); sb3.append(getGoppaPoly()); sb3.append("\n"); return sb3.toString(); } public int hashCode() { return (((((((((this.params.getK() * 37) + this.params.getN()) * 37) + this.params.getField().hashCode()) * 37) + this.params.getGoppaPoly().hashCode()) * 37) + this.params.getP().hashCode()) * 37) + this.params.getH().hashCode(); } public int getT() { return this.params.getGoppaPoly().getDegree(); } public PolynomialGF2mSmallM[] getQInv() { return this.params.getQInv(); } public Permutation getP() { return this.params.getP(); } public int getN() { return this.params.getN(); } /* JADX INFO: Access modifiers changed from: package-private */ public AsymmetricKeyParameter getKeyParams() { return this.params; } public int getK() { return this.params.getK(); } public GF2Matrix getH() { return this.params.getH(); } public PolynomialGF2mSmallM getGoppaPoly() { return this.params.getGoppaPoly(); } @Override // java.security.Key public String getFormat() { return "PKCS#8"; } public GF2mField getField() { return this.params.getField(); } @Override // java.security.Key public byte[] getEncoded() { try { return new PrivateKeyInfo(new AlgorithmIdentifier(PQCObjectIdentifiers.mcElieceCca2), new McElieceCCA2PrivateKey(getN(), getK(), getField(), getGoppaPoly(), getP(), Utils.getDigAlgId(this.params.getDigest()))).getEncoded(); } catch (IOException unused) { return null; } } @Override // java.security.Key public String getAlgorithm() { return "McEliece-CCA2"; } public boolean equals(Object obj) { if (obj == null || !(obj instanceof BCMcElieceCCA2PrivateKey)) { return false; } BCMcElieceCCA2PrivateKey bCMcElieceCCA2PrivateKey = (BCMcElieceCCA2PrivateKey) obj; return getN() == bCMcElieceCCA2PrivateKey.getN() && getK() == bCMcElieceCCA2PrivateKey.getK() && getField().equals(bCMcElieceCCA2PrivateKey.getField()) && getGoppaPoly().equals(bCMcElieceCCA2PrivateKey.getGoppaPoly()) && getP().equals(bCMcElieceCCA2PrivateKey.getP()) && getH().equals(bCMcElieceCCA2PrivateKey.getH()); } public BCMcElieceCCA2PrivateKey(McElieceCCA2PrivateKeyParameters mcElieceCCA2PrivateKeyParameters) { this.params = mcElieceCCA2PrivateKeyParameters; } }