77 lines
3.0 KiB
Java
77 lines
3.0 KiB
Java
package org.bouncycastle.asn1.x509;
|
|
|
|
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.DERSequence;
|
|
|
|
/* loaded from: classes6.dex */
|
|
public class PolicyInformation extends ASN1Object {
|
|
private ASN1ObjectIdentifier policyIdentifier;
|
|
private ASN1Sequence policyQualifiers;
|
|
|
|
public String toString() {
|
|
StringBuffer stringBuffer = new StringBuffer("Policy information: ");
|
|
stringBuffer.append(this.policyIdentifier);
|
|
if (this.policyQualifiers != null) {
|
|
StringBuffer stringBuffer2 = new StringBuffer();
|
|
for (int i = 0; i < this.policyQualifiers.size(); i++) {
|
|
if (stringBuffer2.length() != 0) {
|
|
stringBuffer2.append(", ");
|
|
}
|
|
stringBuffer2.append(PolicyQualifierInfo.getInstance(this.policyQualifiers.getObjectAt(i)));
|
|
}
|
|
stringBuffer.append("[");
|
|
stringBuffer.append(stringBuffer2);
|
|
stringBuffer.append("]");
|
|
}
|
|
return stringBuffer.toString();
|
|
}
|
|
|
|
@Override // org.bouncycastle.asn1.ASN1Object, org.bouncycastle.asn1.ASN1Encodable
|
|
public ASN1Primitive toASN1Primitive() {
|
|
ASN1EncodableVector aSN1EncodableVector = new ASN1EncodableVector();
|
|
aSN1EncodableVector.add(this.policyIdentifier);
|
|
ASN1Sequence aSN1Sequence = this.policyQualifiers;
|
|
if (aSN1Sequence != null) {
|
|
aSN1EncodableVector.add(aSN1Sequence);
|
|
}
|
|
return new DERSequence(aSN1EncodableVector);
|
|
}
|
|
|
|
public ASN1Sequence getPolicyQualifiers() {
|
|
return this.policyQualifiers;
|
|
}
|
|
|
|
public ASN1ObjectIdentifier getPolicyIdentifier() {
|
|
return this.policyIdentifier;
|
|
}
|
|
|
|
public static PolicyInformation getInstance(Object obj) {
|
|
return (obj == null || (obj instanceof PolicyInformation)) ? (PolicyInformation) obj : new PolicyInformation(ASN1Sequence.getInstance(obj));
|
|
}
|
|
|
|
private PolicyInformation(ASN1Sequence aSN1Sequence) {
|
|
if (aSN1Sequence.size() <= 0 || aSN1Sequence.size() > 2) {
|
|
StringBuilder sb = new StringBuilder("Bad sequence size: ");
|
|
sb.append(aSN1Sequence.size());
|
|
throw new IllegalArgumentException(sb.toString());
|
|
}
|
|
this.policyIdentifier = ASN1ObjectIdentifier.getInstance(aSN1Sequence.getObjectAt(0));
|
|
if (aSN1Sequence.size() > 1) {
|
|
this.policyQualifiers = ASN1Sequence.getInstance(aSN1Sequence.getObjectAt(1));
|
|
}
|
|
}
|
|
|
|
public PolicyInformation(ASN1ObjectIdentifier aSN1ObjectIdentifier, ASN1Sequence aSN1Sequence) {
|
|
this.policyIdentifier = aSN1ObjectIdentifier;
|
|
this.policyQualifiers = aSN1Sequence;
|
|
}
|
|
|
|
public PolicyInformation(ASN1ObjectIdentifier aSN1ObjectIdentifier) {
|
|
this.policyIdentifier = aSN1ObjectIdentifier;
|
|
}
|
|
}
|