what-the-bank/sources/org/bouncycastle/asn1/x500/RDN.java

74 lines
2.3 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package org.bouncycastle.asn1.x500;
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.ASN1Set;
import org.bouncycastle.asn1.DERSequence;
import org.bouncycastle.asn1.DERSet;
/* loaded from: classes6.dex */
public class RDN extends ASN1Object {
private ASN1Set values;
@Override // org.bouncycastle.asn1.ASN1Object, org.bouncycastle.asn1.ASN1Encodable
public ASN1Primitive toASN1Primitive() {
return this.values;
}
public int size() {
return this.values.size();
}
public boolean isMultiValued() {
return this.values.size() > 1;
}
public AttributeTypeAndValue[] getTypesAndValues() {
int size = this.values.size();
AttributeTypeAndValue[] attributeTypeAndValueArr = new AttributeTypeAndValue[size];
for (int i = 0; i != size; i++) {
attributeTypeAndValueArr[i] = AttributeTypeAndValue.getInstance(this.values.getObjectAt(i));
}
return attributeTypeAndValueArr;
}
public AttributeTypeAndValue getFirst() {
if (this.values.size() == 0) {
return null;
}
return AttributeTypeAndValue.getInstance(this.values.getObjectAt(0));
}
public static RDN getInstance(Object obj) {
if (obj instanceof RDN) {
return (RDN) obj;
}
if (obj != null) {
return new RDN(ASN1Set.getInstance(obj));
}
return null;
}
public RDN(AttributeTypeAndValue[] attributeTypeAndValueArr) {
this.values = new DERSet(attributeTypeAndValueArr);
}
public RDN(AttributeTypeAndValue attributeTypeAndValue) {
this.values = new DERSet(attributeTypeAndValue);
}
private RDN(ASN1Set aSN1Set) {
this.values = aSN1Set;
}
public RDN(ASN1ObjectIdentifier aSN1ObjectIdentifier, ASN1Encodable aSN1Encodable) {
ASN1EncodableVector aSN1EncodableVector = new ASN1EncodableVector();
aSN1EncodableVector.add(aSN1ObjectIdentifier);
aSN1EncodableVector.add(aSN1Encodable);
this.values = new DERSet(new DERSequence(aSN1EncodableVector));
}
}