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

130 lines
5.5 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package org.bouncycastle.asn1.isismtt.x509;
import java.util.Enumeration;
import org.bouncycastle.asn1.ASN1Encodable;
import org.bouncycastle.asn1.ASN1EncodableVector;
import org.bouncycastle.asn1.ASN1Object;
import org.bouncycastle.asn1.ASN1ObjectIdentifier;
import org.bouncycastle.asn1.ASN1Primitive;
import org.bouncycastle.asn1.ASN1Sequence;
import org.bouncycastle.asn1.ASN1String;
import org.bouncycastle.asn1.ASN1TaggedObject;
import org.bouncycastle.asn1.DERIA5String;
import org.bouncycastle.asn1.DERSequence;
import org.bouncycastle.asn1.isismtt.ISISMTTObjectIdentifiers;
import org.bouncycastle.asn1.x500.DirectoryString;
/* loaded from: classes6.dex */
public class NamingAuthority extends ASN1Object {
public static final ASN1ObjectIdentifier id_isismtt_at_namingAuthorities_RechtWirtschaftSteuern;
private ASN1ObjectIdentifier namingAuthorityId;
private DirectoryString namingAuthorityText;
private String namingAuthorityUrl;
@Override // org.bouncycastle.asn1.ASN1Object, org.bouncycastle.asn1.ASN1Encodable
public ASN1Primitive toASN1Primitive() {
ASN1EncodableVector aSN1EncodableVector = new ASN1EncodableVector();
ASN1ObjectIdentifier aSN1ObjectIdentifier = this.namingAuthorityId;
if (aSN1ObjectIdentifier != null) {
aSN1EncodableVector.add(aSN1ObjectIdentifier);
}
String str = this.namingAuthorityUrl;
if (str != null) {
aSN1EncodableVector.add(new DERIA5String(str, true));
}
DirectoryString directoryString = this.namingAuthorityText;
if (directoryString != null) {
aSN1EncodableVector.add(directoryString);
}
return new DERSequence(aSN1EncodableVector);
}
public String getNamingAuthorityUrl() {
return this.namingAuthorityUrl;
}
public DirectoryString getNamingAuthorityText() {
return this.namingAuthorityText;
}
public ASN1ObjectIdentifier getNamingAuthorityId() {
return this.namingAuthorityId;
}
public static NamingAuthority getInstance(ASN1TaggedObject aSN1TaggedObject, boolean z) {
return getInstance(ASN1Sequence.getInstance(aSN1TaggedObject, z));
}
public static NamingAuthority getInstance(Object obj) {
if (obj == null || (obj instanceof NamingAuthority)) {
return (NamingAuthority) obj;
}
if (obj instanceof ASN1Sequence) {
return new NamingAuthority((ASN1Sequence) obj);
}
StringBuilder sb = new StringBuilder("illegal object in getInstance: ");
sb.append(obj.getClass().getName());
throw new IllegalArgumentException(sb.toString());
}
private NamingAuthority(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();
if (objects.hasMoreElements()) {
ASN1Encodable aSN1Encodable = (ASN1Encodable) objects.nextElement();
if (aSN1Encodable instanceof ASN1ObjectIdentifier) {
this.namingAuthorityId = (ASN1ObjectIdentifier) aSN1Encodable;
} else if (aSN1Encodable instanceof DERIA5String) {
this.namingAuthorityUrl = DERIA5String.getInstance(aSN1Encodable).getString();
} else {
if (!(aSN1Encodable instanceof ASN1String)) {
StringBuilder sb2 = new StringBuilder("Bad object encountered: ");
sb2.append(aSN1Encodable.getClass());
throw new IllegalArgumentException(sb2.toString());
}
this.namingAuthorityText = DirectoryString.getInstance(aSN1Encodable);
}
}
if (objects.hasMoreElements()) {
ASN1Encodable aSN1Encodable2 = (ASN1Encodable) objects.nextElement();
if (aSN1Encodable2 instanceof DERIA5String) {
this.namingAuthorityUrl = DERIA5String.getInstance(aSN1Encodable2).getString();
} else {
if (!(aSN1Encodable2 instanceof ASN1String)) {
StringBuilder sb3 = new StringBuilder("Bad object encountered: ");
sb3.append(aSN1Encodable2.getClass());
throw new IllegalArgumentException(sb3.toString());
}
this.namingAuthorityText = DirectoryString.getInstance(aSN1Encodable2);
}
}
if (objects.hasMoreElements()) {
ASN1Encodable aSN1Encodable3 = (ASN1Encodable) objects.nextElement();
if (aSN1Encodable3 instanceof ASN1String) {
this.namingAuthorityText = DirectoryString.getInstance(aSN1Encodable3);
} else {
StringBuilder sb4 = new StringBuilder("Bad object encountered: ");
sb4.append(aSN1Encodable3.getClass());
throw new IllegalArgumentException(sb4.toString());
}
}
}
public NamingAuthority(ASN1ObjectIdentifier aSN1ObjectIdentifier, String str, DirectoryString directoryString) {
this.namingAuthorityId = aSN1ObjectIdentifier;
this.namingAuthorityUrl = str;
this.namingAuthorityText = directoryString;
}
static {
StringBuilder sb = new StringBuilder();
sb.append(ISISMTTObjectIdentifiers.id_isismtt_at_namingAuthorities);
sb.append(".1");
id_isismtt_at_namingAuthorities_RechtWirtschaftSteuern = new ASN1ObjectIdentifier(sb.toString());
}
}