62 lines
2.0 KiB
Java
62 lines
2.0 KiB
Java
package org.bouncycastle.asn1.x509.qualified;
|
|
|
|
import org.bouncycastle.asn1.ASN1Choice;
|
|
import org.bouncycastle.asn1.ASN1Encodable;
|
|
import org.bouncycastle.asn1.ASN1Integer;
|
|
import org.bouncycastle.asn1.ASN1Object;
|
|
import org.bouncycastle.asn1.ASN1Primitive;
|
|
import org.bouncycastle.asn1.DERPrintableString;
|
|
|
|
/* loaded from: classes6.dex */
|
|
public class Iso4217CurrencyCode extends ASN1Object implements ASN1Choice {
|
|
int numeric;
|
|
ASN1Encodable obj;
|
|
final int ALPHABETIC_MAXSIZE = 3;
|
|
final int NUMERIC_MINSIZE = 1;
|
|
final int NUMERIC_MAXSIZE = 999;
|
|
|
|
@Override // org.bouncycastle.asn1.ASN1Object, org.bouncycastle.asn1.ASN1Encodable
|
|
public ASN1Primitive toASN1Primitive() {
|
|
return this.obj.toASN1Primitive();
|
|
}
|
|
|
|
public boolean isAlphabetic() {
|
|
return this.obj instanceof DERPrintableString;
|
|
}
|
|
|
|
public int getNumeric() {
|
|
return ((ASN1Integer) this.obj).getValue().intValue();
|
|
}
|
|
|
|
public String getAlphabetic() {
|
|
return ((DERPrintableString) this.obj).getString();
|
|
}
|
|
|
|
public static Iso4217CurrencyCode getInstance(Object obj) {
|
|
if (obj == null || (obj instanceof Iso4217CurrencyCode)) {
|
|
return (Iso4217CurrencyCode) obj;
|
|
}
|
|
if (obj instanceof ASN1Integer) {
|
|
return new Iso4217CurrencyCode(ASN1Integer.getInstance(obj).getValue().intValue());
|
|
}
|
|
if (obj instanceof DERPrintableString) {
|
|
return new Iso4217CurrencyCode(DERPrintableString.getInstance(obj).getString());
|
|
}
|
|
throw new IllegalArgumentException("unknown object in getInstance");
|
|
}
|
|
|
|
public Iso4217CurrencyCode(String str) {
|
|
if (str.length() > 3) {
|
|
throw new IllegalArgumentException("wrong size in alphabetic code : max size is 3");
|
|
}
|
|
this.obj = new DERPrintableString(str);
|
|
}
|
|
|
|
public Iso4217CurrencyCode(int i) {
|
|
if (i > 999 || i <= 0) {
|
|
throw new IllegalArgumentException("wrong size in numeric code : not in (1..999)");
|
|
}
|
|
this.obj = new ASN1Integer(i);
|
|
}
|
|
}
|