72 lines
2.5 KiB
Java
72 lines
2.5 KiB
Java
|
package org.bouncycastle.asn1.x509;
|
||
|
|
||
|
import org.bouncycastle.asn1.ASN1Object;
|
||
|
import org.bouncycastle.asn1.ASN1ObjectIdentifier;
|
||
|
import org.bouncycastle.asn1.ASN1Primitive;
|
||
|
import org.bouncycastle.asn1.ASN1Sequence;
|
||
|
import org.bouncycastle.asn1.ASN1TaggedObject;
|
||
|
import org.bouncycastle.asn1.DERSequence;
|
||
|
import org.bouncycastle.util.Strings;
|
||
|
|
||
|
/* loaded from: classes6.dex */
|
||
|
public class GeneralNames extends ASN1Object {
|
||
|
private final GeneralName[] names;
|
||
|
|
||
|
public String toString() {
|
||
|
StringBuffer stringBuffer = new StringBuffer("GeneralNames:");
|
||
|
String lineSeparator = Strings.lineSeparator();
|
||
|
stringBuffer.append(lineSeparator);
|
||
|
for (int i = 0; i != this.names.length; i++) {
|
||
|
stringBuffer.append(" ");
|
||
|
stringBuffer.append(this.names[i]);
|
||
|
stringBuffer.append(lineSeparator);
|
||
|
}
|
||
|
return stringBuffer.toString();
|
||
|
}
|
||
|
|
||
|
@Override // org.bouncycastle.asn1.ASN1Object, org.bouncycastle.asn1.ASN1Encodable
|
||
|
public ASN1Primitive toASN1Primitive() {
|
||
|
return new DERSequence(this.names);
|
||
|
}
|
||
|
|
||
|
public GeneralName[] getNames() {
|
||
|
GeneralName[] generalNameArr = this.names;
|
||
|
GeneralName[] generalNameArr2 = new GeneralName[generalNameArr.length];
|
||
|
System.arraycopy(generalNameArr, 0, generalNameArr2, 0, generalNameArr.length);
|
||
|
return generalNameArr2;
|
||
|
}
|
||
|
|
||
|
public static GeneralNames getInstance(ASN1TaggedObject aSN1TaggedObject, boolean z) {
|
||
|
return getInstance(ASN1Sequence.getInstance(aSN1TaggedObject, z));
|
||
|
}
|
||
|
|
||
|
public static GeneralNames getInstance(Object obj) {
|
||
|
if (obj instanceof GeneralNames) {
|
||
|
return (GeneralNames) obj;
|
||
|
}
|
||
|
if (obj != null) {
|
||
|
return new GeneralNames(ASN1Sequence.getInstance(obj));
|
||
|
}
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
public static GeneralNames fromExtensions(Extensions extensions, ASN1ObjectIdentifier aSN1ObjectIdentifier) {
|
||
|
return getInstance(extensions.getExtensionParsedValue(aSN1ObjectIdentifier));
|
||
|
}
|
||
|
|
||
|
public GeneralNames(GeneralName[] generalNameArr) {
|
||
|
this.names = generalNameArr;
|
||
|
}
|
||
|
|
||
|
public GeneralNames(GeneralName generalName) {
|
||
|
this.names = new GeneralName[]{generalName};
|
||
|
}
|
||
|
|
||
|
private GeneralNames(ASN1Sequence aSN1Sequence) {
|
||
|
this.names = new GeneralName[aSN1Sequence.size()];
|
||
|
for (int i = 0; i != aSN1Sequence.size(); i++) {
|
||
|
this.names[i] = GeneralName.getInstance(aSN1Sequence.getObjectAt(i));
|
||
|
}
|
||
|
}
|
||
|
}
|