what-the-bank/sources/org/bouncycastle/pqc/asn1/McEliecePrivateKey.java

97 lines
3.5 KiB
Java

package org.bouncycastle.pqc.asn1;
import org.bouncycastle.asn1.ASN1EncodableVector;
import org.bouncycastle.asn1.ASN1Integer;
import org.bouncycastle.asn1.ASN1Object;
import org.bouncycastle.asn1.ASN1OctetString;
import org.bouncycastle.asn1.ASN1Primitive;
import org.bouncycastle.asn1.ASN1Sequence;
import org.bouncycastle.asn1.DEROctetString;
import org.bouncycastle.asn1.DERSequence;
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 McEliecePrivateKey extends ASN1Object {
private byte[] encField;
private byte[] encGp;
private byte[] encP1;
private byte[] encP2;
private byte[] encSInv;
private int k;
private int n;
@Override // org.bouncycastle.asn1.ASN1Object, org.bouncycastle.asn1.ASN1Encodable
public ASN1Primitive toASN1Primitive() {
ASN1EncodableVector aSN1EncodableVector = new ASN1EncodableVector();
aSN1EncodableVector.add(new ASN1Integer(this.n));
aSN1EncodableVector.add(new ASN1Integer(this.k));
aSN1EncodableVector.add(new DEROctetString(this.encField));
aSN1EncodableVector.add(new DEROctetString(this.encGp));
aSN1EncodableVector.add(new DEROctetString(this.encP1));
aSN1EncodableVector.add(new DEROctetString(this.encP2));
aSN1EncodableVector.add(new DEROctetString(this.encSInv));
return new DERSequence(aSN1EncodableVector);
}
public GF2Matrix getSInv() {
return new GF2Matrix(this.encSInv);
}
public Permutation getP2() {
return new Permutation(this.encP2);
}
public Permutation getP1() {
return new Permutation(this.encP1);
}
public int getN() {
return this.n;
}
public int getK() {
return this.k;
}
public PolynomialGF2mSmallM getGoppaPoly() {
return new PolynomialGF2mSmallM(getField(), this.encGp);
}
public GF2mField getField() {
return new GF2mField(this.encField);
}
public static McEliecePrivateKey getInstance(Object obj) {
if (obj instanceof McEliecePrivateKey) {
return (McEliecePrivateKey) obj;
}
if (obj != null) {
return new McEliecePrivateKey(ASN1Sequence.getInstance(obj));
}
return null;
}
private McEliecePrivateKey(ASN1Sequence aSN1Sequence) {
this.n = ((ASN1Integer) aSN1Sequence.getObjectAt(0)).getValue().intValue();
this.k = ((ASN1Integer) aSN1Sequence.getObjectAt(1)).getValue().intValue();
this.encField = ((ASN1OctetString) aSN1Sequence.getObjectAt(2)).getOctets();
this.encGp = ((ASN1OctetString) aSN1Sequence.getObjectAt(3)).getOctets();
this.encP1 = ((ASN1OctetString) aSN1Sequence.getObjectAt(4)).getOctets();
this.encP2 = ((ASN1OctetString) aSN1Sequence.getObjectAt(5)).getOctets();
this.encSInv = ((ASN1OctetString) aSN1Sequence.getObjectAt(6)).getOctets();
}
public McEliecePrivateKey(int i, int i2, GF2mField gF2mField, PolynomialGF2mSmallM polynomialGF2mSmallM, Permutation permutation, Permutation permutation2, GF2Matrix gF2Matrix) {
this.n = i;
this.k = i2;
this.encField = gF2mField.getEncoded();
this.encGp = polynomialGF2mSmallM.getEncoded();
this.encSInv = gF2Matrix.getEncoded();
this.encP1 = permutation.getEncoded();
this.encP2 = permutation2.getEncoded();
}
}