Red Hat Application Migration Toolkit
package iaik.asn1.structures;
import iaik.asn1.ASN1;
import iaik.asn1.ASN1Object;
import iaik.asn1.ASN1Type;
import iaik.asn1.CodingException;
import iaik.asn1.DerCoder;
import iaik.asn1.ObjectID;
import iaik.asn1.SEQUENCE;
import iaik.asn1.SET;
import iaik.asn1.structures.AttributeValue;
import iaik.asn1.structures.UnknownAttributeValue;
import iaik.asn1.structures.a;
import iaik.pkcs.pkcs9.ChallengePassword;
import iaik.pkcs.pkcs9.ExtensionRequest;
import iaik.utils.CryptoUtils;
import iaik.utils.Util;
public class Attribute implements ASN1Type {
// $FF: synthetic field
static Class e;
// $FF: synthetic field
static Class f;
// $FF: synthetic field
static Class g;
private boolean c;
private ASN1Object[] a;
private ObjectID b;
private static a d = new a();
static Class a(String var0) {
try {
return Class.forName(var0);
} catch (ClassNotFoundException var2) {
throw new NoClassDefFoundError(var2.getMessage());
}
}
public String toString() {
StringBuffer var1 = new StringBuffer();
var1.append(this.b.getName() + ":\n");
try {
for(int var2 = 0; var2 < this.a.length; ++var2) {
var1.append((new ASN1(this.a[var2])).toString());
}
} catch (CodingException var3) {
;
}
return var1.toString();
}
public ASN1Object toASN1Object(boolean var1) {
SEQUENCE var2 = new SEQUENCE();
var2.addComponent(this.b);
SET var3 = new SET(var1);
for(int var4 = 0; var4 < this.a.length; ++var4) {
var3.addComponent(this.a[var4]);
}
var2.addComponent(var3);
return var2;
}
public ASN1Object toASN1Object() {
return this.toASN1Object(this.c);
}
public static void register(ObjectID var0, Class var1) {
d.register(e != null?e:(e = a("iaik.asn1.structures.AttributeValue")), var0, var1);
}
public ASN1Object[] getValue() {
return this.a;
}
public ObjectID getType() {
return this.b;
}
public AttributeValue[] getAttributeValues() throws CodingException {
if(this.a != null && this.a.length != 0) {
AttributeValue[] var1 = new AttributeValue[this.a.length];
for(int var2 = 0; var2 < this.a.length; ++var2) {
try {
var1[var2] = create(this.b);
} catch (InstantiationException var3) {
var1[var2] = new UnknownAttributeValue(this.b);
}
var1[var2].decode(this.a[var2]);
}
return var1;
} else {
throw new NullPointerException("Cannot get attribute value. No values set!");
}
}
public AttributeValue getAttributeValue() throws CodingException {
if(this.a != null && this.a.length != 0) {
Object var1;
try {
var1 = create(this.b);
} catch (InstantiationException var2) {
var1 = new UnknownAttributeValue(this.b);
}
((AttributeValue)var1).decode(this.a[0]);
return (AttributeValue)var1;
} else {
throw new NullPointerException("Cannot get attribute value. No values set!");
}
}
public boolean equals(Object var1) {
if(this == var1) {
return true;
} else if(!(var1 instanceof Attribute)) {
return false;
} else {
Attribute var2 = (Attribute)var1;
return !this.b.equals(var2.b)?false:(this.a.length != var2.a.length?false:CryptoUtils.equalsBlock(DerCoder.encode(this.toASN1Object()), DerCoder.encode(var2.toASN1Object())));
}
}
public void decode(ASN1Object var1) throws CodingException {
this.b = (ObjectID)var1.getComponentAt(0);
SET var2 = (SET)var1.getComponentAt(1);
this.a = new ASN1Object[var2.countComponents()];
for(int var3 = 0; var3 < var2.countComponents(); ++var3) {
this.a[var3] = var2.getComponentAt(var3);
}
}
public static AttributeValue create(ObjectID var0) throws InstantiationException {
return (AttributeValue)d.create(e != null?e:(e = a("iaik.asn1.structures.AttributeValue")), var0, false);
}
public void addAttributeValue(AttributeValue var1) throws IllegalArgumentException, CodingException {
if(this.b.equals(var1.getAttributeType())) {
this.a = (ASN1Object[])Util.resizeArray(this.a, this.a.length + 1);
this.a[this.a.length - 1] = var1.toASN1Object();
} else {
throw new IllegalArgumentException("Cannot add AttributeValue: Invalid type!");
}
}
public Attribute(AttributeValue var1, boolean var2) throws CodingException {
this();
this.b = var1.getAttributeType();
this.a = new ASN1Object[]{var1.toASN1Object()};
this.c = var2;
}
public Attribute(AttributeValue var1) throws CodingException {
this(var1, false);
}
public Attribute(ObjectID var1, ASN1Object[] var2, boolean var3) {
this();
this.b = var1;
this.a = var2;
this.c = var3;
}
public Attribute(ObjectID var1, ASN1Object[] var2) {
this(var1, var2, false);
}
public Attribute(ASN1Object var1) throws CodingException {
this.decode(var1);
}
public Attribute() {
this.c = false;
}
static {
register(ExtensionRequest.oid, g != null?g:(g = a("iaik.pkcs.pkcs9.ExtensionRequest")));
register(ChallengePassword.oid, f != null?f:(f = a("iaik.pkcs.pkcs9.ChallengePassword")));
}
}