71 lines
2.2 KiB
Java
71 lines
2.2 KiB
Java
package org.bouncycastle.asn1.x9;
|
|
|
|
import org.bouncycastle.asn1.ASN1Choice;
|
|
import org.bouncycastle.asn1.ASN1Null;
|
|
import org.bouncycastle.asn1.ASN1Object;
|
|
import org.bouncycastle.asn1.ASN1ObjectIdentifier;
|
|
import org.bouncycastle.asn1.ASN1Primitive;
|
|
import org.bouncycastle.asn1.ASN1TaggedObject;
|
|
|
|
/* loaded from: classes6.dex */
|
|
public class X962Parameters extends ASN1Object implements ASN1Choice {
|
|
private ASN1Primitive params;
|
|
|
|
@Override // org.bouncycastle.asn1.ASN1Object, org.bouncycastle.asn1.ASN1Encodable
|
|
public ASN1Primitive toASN1Primitive() {
|
|
return this.params;
|
|
}
|
|
|
|
public boolean isNamedCurve() {
|
|
return this.params instanceof ASN1ObjectIdentifier;
|
|
}
|
|
|
|
public boolean isImplicitlyCA() {
|
|
return this.params instanceof ASN1Null;
|
|
}
|
|
|
|
public ASN1Primitive getParameters() {
|
|
return this.params;
|
|
}
|
|
|
|
public static X962Parameters getInstance(ASN1TaggedObject aSN1TaggedObject, boolean z) {
|
|
return getInstance(aSN1TaggedObject.getObject());
|
|
}
|
|
|
|
public static X962Parameters getInstance(Object obj) {
|
|
if (obj == null || (obj instanceof X962Parameters)) {
|
|
return (X962Parameters) obj;
|
|
}
|
|
if (obj instanceof ASN1Primitive) {
|
|
return new X962Parameters((ASN1Primitive) obj);
|
|
}
|
|
if (!(obj instanceof byte[])) {
|
|
throw new IllegalArgumentException("unknown object in getInstance()");
|
|
}
|
|
try {
|
|
return new X962Parameters(ASN1Primitive.fromByteArray((byte[]) obj));
|
|
} catch (Exception e) {
|
|
StringBuilder sb = new StringBuilder("unable to parse encoded data: ");
|
|
sb.append(e.getMessage());
|
|
throw new IllegalArgumentException(sb.toString());
|
|
}
|
|
}
|
|
|
|
public X962Parameters(X9ECParameters x9ECParameters) {
|
|
this.params = null;
|
|
this.params = x9ECParameters.toASN1Primitive();
|
|
}
|
|
|
|
public X962Parameters(ASN1Primitive aSN1Primitive) {
|
|
this.params = aSN1Primitive;
|
|
}
|
|
|
|
public X962Parameters(ASN1ObjectIdentifier aSN1ObjectIdentifier) {
|
|
this.params = aSN1ObjectIdentifier;
|
|
}
|
|
|
|
public X962Parameters(ASN1Null aSN1Null) {
|
|
this.params = aSN1Null;
|
|
}
|
|
}
|