what-the-bank/sources/org/bouncycastle/asn1/x509/DSAParameter.java

72 lines
2.4 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package org.bouncycastle.asn1.x509;
import java.math.BigInteger;
import java.util.Enumeration;
import org.bouncycastle.asn1.ASN1EncodableVector;
import org.bouncycastle.asn1.ASN1Integer;
import org.bouncycastle.asn1.ASN1Object;
import org.bouncycastle.asn1.ASN1Primitive;
import org.bouncycastle.asn1.ASN1Sequence;
import org.bouncycastle.asn1.ASN1TaggedObject;
import org.bouncycastle.asn1.DERSequence;
/* loaded from: classes6.dex */
public class DSAParameter extends ASN1Object {
ASN1Integer g;
ASN1Integer p;
ASN1Integer q;
@Override // org.bouncycastle.asn1.ASN1Object, org.bouncycastle.asn1.ASN1Encodable
public ASN1Primitive toASN1Primitive() {
ASN1EncodableVector aSN1EncodableVector = new ASN1EncodableVector();
aSN1EncodableVector.add(this.p);
aSN1EncodableVector.add(this.q);
aSN1EncodableVector.add(this.g);
return new DERSequence(aSN1EncodableVector);
}
public BigInteger getQ() {
return this.q.getPositiveValue();
}
public BigInteger getP() {
return this.p.getPositiveValue();
}
public BigInteger getG() {
return this.g.getPositiveValue();
}
public static DSAParameter getInstance(ASN1TaggedObject aSN1TaggedObject, boolean z) {
return getInstance(ASN1Sequence.getInstance(aSN1TaggedObject, z));
}
public static DSAParameter getInstance(Object obj) {
if (obj instanceof DSAParameter) {
return (DSAParameter) obj;
}
if (obj != null) {
return new DSAParameter(ASN1Sequence.getInstance(obj));
}
return null;
}
private DSAParameter(ASN1Sequence aSN1Sequence) {
if (aSN1Sequence.size() != 3) {
StringBuilder sb = new StringBuilder("Bad sequence size: ");
sb.append(aSN1Sequence.size());
throw new IllegalArgumentException(sb.toString());
}
Enumeration objects = aSN1Sequence.getObjects();
this.p = ASN1Integer.getInstance(objects.nextElement());
this.q = ASN1Integer.getInstance(objects.nextElement());
this.g = ASN1Integer.getInstance(objects.nextElement());
}
public DSAParameter(BigInteger bigInteger, BigInteger bigInteger2, BigInteger bigInteger3) {
this.p = new ASN1Integer(bigInteger);
this.q = new ASN1Integer(bigInteger2);
this.g = new ASN1Integer(bigInteger3);
}
}