what-the-bank/sources/org/bouncycastle/asn1/x9/X9FieldID.java

81 lines
2.8 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package org.bouncycastle.asn1.x9;
import java.math.BigInteger;
import org.bouncycastle.asn1.ASN1EncodableVector;
import org.bouncycastle.asn1.ASN1Integer;
import org.bouncycastle.asn1.ASN1Object;
import org.bouncycastle.asn1.ASN1ObjectIdentifier;
import org.bouncycastle.asn1.ASN1Primitive;
import org.bouncycastle.asn1.ASN1Sequence;
import org.bouncycastle.asn1.DERSequence;
/* loaded from: classes6.dex */
public class X9FieldID extends ASN1Object implements X9ObjectIdentifiers {
private ASN1ObjectIdentifier id;
private ASN1Primitive parameters;
@Override // org.bouncycastle.asn1.ASN1Object, org.bouncycastle.asn1.ASN1Encodable
public ASN1Primitive toASN1Primitive() {
ASN1EncodableVector aSN1EncodableVector = new ASN1EncodableVector();
aSN1EncodableVector.add(this.id);
aSN1EncodableVector.add(this.parameters);
return new DERSequence(aSN1EncodableVector);
}
public ASN1Primitive getParameters() {
return this.parameters;
}
public ASN1ObjectIdentifier getIdentifier() {
return this.id;
}
public static X9FieldID getInstance(Object obj) {
if (obj instanceof X9FieldID) {
return (X9FieldID) obj;
}
if (obj != null) {
return new X9FieldID(ASN1Sequence.getInstance(obj));
}
return null;
}
private X9FieldID(ASN1Sequence aSN1Sequence) {
this.id = ASN1ObjectIdentifier.getInstance(aSN1Sequence.getObjectAt(0));
this.parameters = aSN1Sequence.getObjectAt(1).toASN1Primitive();
}
public X9FieldID(BigInteger bigInteger) {
this.id = prime_field;
this.parameters = new ASN1Integer(bigInteger);
}
public X9FieldID(int i, int i2, int i3, int i4) {
this.id = characteristic_two_field;
ASN1EncodableVector aSN1EncodableVector = new ASN1EncodableVector();
aSN1EncodableVector.add(new ASN1Integer(i));
if (i3 == 0) {
if (i4 != 0) {
throw new IllegalArgumentException("inconsistent k values");
}
aSN1EncodableVector.add(tpBasis);
aSN1EncodableVector.add(new ASN1Integer(i2));
} else {
if (i3 <= i2 || i4 <= i3) {
throw new IllegalArgumentException("inconsistent k values");
}
aSN1EncodableVector.add(ppBasis);
ASN1EncodableVector aSN1EncodableVector2 = new ASN1EncodableVector();
aSN1EncodableVector2.add(new ASN1Integer(i2));
aSN1EncodableVector2.add(new ASN1Integer(i3));
aSN1EncodableVector2.add(new ASN1Integer(i4));
aSN1EncodableVector.add(new DERSequence(aSN1EncodableVector2));
}
this.parameters = new DERSequence(aSN1EncodableVector);
}
public X9FieldID(int i, int i2) {
this(i, i2, 0, 0);
}
}