71 lines
2.7 KiB
Java
71 lines
2.7 KiB
Java
package org.bouncycastle.asn1.x509;
|
|
|
|
import java.math.BigInteger;
|
|
import org.bouncycastle.asn1.ASN1EncodableVector;
|
|
import org.bouncycastle.asn1.ASN1Integer;
|
|
import org.bouncycastle.asn1.ASN1Object;
|
|
import org.bouncycastle.asn1.ASN1Primitive;
|
|
import org.bouncycastle.asn1.ASN1Sequence;
|
|
import org.bouncycastle.asn1.ASN1TaggedObject;
|
|
import org.bouncycastle.asn1.DERSequence;
|
|
import org.bouncycastle.asn1.DERTaggedObject;
|
|
|
|
/* loaded from: classes6.dex */
|
|
public class PolicyConstraints extends ASN1Object {
|
|
private BigInteger inhibitPolicyMapping;
|
|
private BigInteger requireExplicitPolicyMapping;
|
|
|
|
@Override // org.bouncycastle.asn1.ASN1Object, org.bouncycastle.asn1.ASN1Encodable
|
|
public ASN1Primitive toASN1Primitive() {
|
|
ASN1EncodableVector aSN1EncodableVector = new ASN1EncodableVector();
|
|
if (this.requireExplicitPolicyMapping != null) {
|
|
aSN1EncodableVector.add(new DERTaggedObject(0, new ASN1Integer(this.requireExplicitPolicyMapping)));
|
|
}
|
|
if (this.inhibitPolicyMapping != null) {
|
|
aSN1EncodableVector.add(new DERTaggedObject(1, new ASN1Integer(this.inhibitPolicyMapping)));
|
|
}
|
|
return new DERSequence(aSN1EncodableVector);
|
|
}
|
|
|
|
public BigInteger getRequireExplicitPolicyMapping() {
|
|
return this.requireExplicitPolicyMapping;
|
|
}
|
|
|
|
public BigInteger getInhibitPolicyMapping() {
|
|
return this.inhibitPolicyMapping;
|
|
}
|
|
|
|
public static PolicyConstraints getInstance(Object obj) {
|
|
if (obj instanceof PolicyConstraints) {
|
|
return (PolicyConstraints) obj;
|
|
}
|
|
if (obj != null) {
|
|
return new PolicyConstraints(ASN1Sequence.getInstance(obj));
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public static PolicyConstraints fromExtensions(Extensions extensions) {
|
|
return getInstance(extensions.getExtensionParsedValue(Extension.policyConstraints));
|
|
}
|
|
|
|
private PolicyConstraints(ASN1Sequence aSN1Sequence) {
|
|
for (int i = 0; i != aSN1Sequence.size(); i++) {
|
|
ASN1TaggedObject aSN1TaggedObject = ASN1TaggedObject.getInstance(aSN1Sequence.getObjectAt(i));
|
|
if (aSN1TaggedObject.getTagNo() == 0) {
|
|
this.requireExplicitPolicyMapping = ASN1Integer.getInstance(aSN1TaggedObject, false).getValue();
|
|
} else {
|
|
if (aSN1TaggedObject.getTagNo() != 1) {
|
|
throw new IllegalArgumentException("Unknown tag encountered.");
|
|
}
|
|
this.inhibitPolicyMapping = ASN1Integer.getInstance(aSN1TaggedObject, false).getValue();
|
|
}
|
|
}
|
|
}
|
|
|
|
public PolicyConstraints(BigInteger bigInteger, BigInteger bigInteger2) {
|
|
this.requireExplicitPolicyMapping = bigInteger;
|
|
this.inhibitPolicyMapping = bigInteger2;
|
|
}
|
|
}
|