99 lines
3.9 KiB
Java
99 lines
3.9 KiB
Java
package org.bouncycastle.asn1.eac;
|
|
|
|
import com.google.common.primitives.UnsignedBytes;
|
|
import java.io.IOException;
|
|
import java.util.Hashtable;
|
|
import org.bouncycastle.asn1.ASN1EncodableVector;
|
|
import org.bouncycastle.asn1.ASN1InputStream;
|
|
import org.bouncycastle.asn1.ASN1Object;
|
|
import org.bouncycastle.asn1.ASN1ObjectIdentifier;
|
|
import org.bouncycastle.asn1.ASN1Primitive;
|
|
import org.bouncycastle.asn1.DERApplicationSpecific;
|
|
import org.bouncycastle.util.Integers;
|
|
|
|
/* loaded from: classes6.dex */
|
|
public class CertificateHolderAuthorization extends ASN1Object {
|
|
public static final int CVCA = 192;
|
|
public static final int DV_DOMESTIC = 128;
|
|
public static final int DV_FOREIGN = 64;
|
|
public static final int IS = 0;
|
|
public static final int RADG3 = 1;
|
|
public static final int RADG4 = 2;
|
|
DERApplicationSpecific accessRights;
|
|
ASN1ObjectIdentifier oid;
|
|
public static final ASN1ObjectIdentifier id_role_EAC = EACObjectIdentifiers.bsi_de.branch("3.1.2.1");
|
|
static Hashtable RightsDecodeMap = new Hashtable();
|
|
static BidirectionalMap AuthorizationRole = new BidirectionalMap();
|
|
static Hashtable ReverseMap = new Hashtable();
|
|
|
|
@Override // org.bouncycastle.asn1.ASN1Object, org.bouncycastle.asn1.ASN1Encodable
|
|
public ASN1Primitive toASN1Primitive() {
|
|
ASN1EncodableVector aSN1EncodableVector = new ASN1EncodableVector();
|
|
aSN1EncodableVector.add(this.oid);
|
|
aSN1EncodableVector.add(this.accessRights);
|
|
return new DERApplicationSpecific(76, aSN1EncodableVector);
|
|
}
|
|
|
|
public ASN1ObjectIdentifier getOid() {
|
|
return this.oid;
|
|
}
|
|
|
|
public int getAccessRights() {
|
|
return this.accessRights.getContents()[0] & UnsignedBytes.MAX_VALUE;
|
|
}
|
|
|
|
private void setPrivateData(ASN1InputStream aSN1InputStream) throws IOException {
|
|
ASN1Primitive readObject = aSN1InputStream.readObject();
|
|
if (!(readObject instanceof ASN1ObjectIdentifier)) {
|
|
throw new IllegalArgumentException("no Oid in CerticateHolderAuthorization");
|
|
}
|
|
this.oid = (ASN1ObjectIdentifier) readObject;
|
|
ASN1Primitive readObject2 = aSN1InputStream.readObject();
|
|
if (!(readObject2 instanceof DERApplicationSpecific)) {
|
|
throw new IllegalArgumentException("No access rights in CerticateHolderAuthorization");
|
|
}
|
|
this.accessRights = (DERApplicationSpecific) readObject2;
|
|
}
|
|
|
|
private void setOid(ASN1ObjectIdentifier aSN1ObjectIdentifier) {
|
|
this.oid = aSN1ObjectIdentifier;
|
|
}
|
|
|
|
private void setAccessRights(byte b) {
|
|
this.accessRights = new DERApplicationSpecific(EACTags.getTag(83), new byte[]{b});
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public static String getRoleDescription(int i) {
|
|
return (String) AuthorizationRole.get(Integers.valueOf(i));
|
|
}
|
|
|
|
public static int getFlag(String str) {
|
|
Integer num = (Integer) AuthorizationRole.getReverse(str);
|
|
if (num != null) {
|
|
return num.intValue();
|
|
}
|
|
throw new IllegalArgumentException("Unknown value ".concat(String.valueOf(str)));
|
|
}
|
|
|
|
public CertificateHolderAuthorization(DERApplicationSpecific dERApplicationSpecific) throws IOException {
|
|
if (dERApplicationSpecific.getApplicationTag() == 76) {
|
|
setPrivateData(new ASN1InputStream(dERApplicationSpecific.getContents()));
|
|
}
|
|
}
|
|
|
|
public CertificateHolderAuthorization(ASN1ObjectIdentifier aSN1ObjectIdentifier, int i) throws IOException {
|
|
setOid(aSN1ObjectIdentifier);
|
|
setAccessRights((byte) i);
|
|
}
|
|
|
|
static {
|
|
RightsDecodeMap.put(Integers.valueOf(2), "RADG4");
|
|
RightsDecodeMap.put(Integers.valueOf(1), "RADG3");
|
|
AuthorizationRole.put(Integers.valueOf(192), "CVCA");
|
|
AuthorizationRole.put(Integers.valueOf(128), "DV_DOMESTIC");
|
|
AuthorizationRole.put(Integers.valueOf(64), "DV_FOREIGN");
|
|
AuthorizationRole.put(Integers.valueOf(0), "IS");
|
|
}
|
|
}
|