what-the-bank/sources/org/bouncycastle/asn1/oiw/ElGamalParameter.java

54 lines
1.7 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package org.bouncycastle.asn1.oiw;
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.DERSequence;
/* loaded from: classes6.dex */
public class ElGamalParameter extends ASN1Object {
ASN1Integer g;
ASN1Integer p;
@Override // org.bouncycastle.asn1.ASN1Object, org.bouncycastle.asn1.ASN1Encodable
public ASN1Primitive toASN1Primitive() {
ASN1EncodableVector aSN1EncodableVector = new ASN1EncodableVector();
aSN1EncodableVector.add(this.p);
aSN1EncodableVector.add(this.g);
return new DERSequence(aSN1EncodableVector);
}
public BigInteger getP() {
return this.p.getPositiveValue();
}
public BigInteger getG() {
return this.g.getPositiveValue();
}
public static ElGamalParameter getInstance(Object obj) {
if (obj instanceof ElGamalParameter) {
return (ElGamalParameter) obj;
}
if (obj != null) {
return new ElGamalParameter(ASN1Sequence.getInstance(obj));
}
return null;
}
private ElGamalParameter(ASN1Sequence aSN1Sequence) {
Enumeration objects = aSN1Sequence.getObjects();
this.p = (ASN1Integer) objects.nextElement();
this.g = (ASN1Integer) objects.nextElement();
}
public ElGamalParameter(BigInteger bigInteger, BigInteger bigInteger2) {
this.p = new ASN1Integer(bigInteger);
this.g = new ASN1Integer(bigInteger2);
}
}