Red Hat Application Migration Toolkit
package iaik.x509.extensions;
import iaik.asn1.ASN;
import iaik.asn1.ASN1Object;
import iaik.asn1.CodingException;
import iaik.asn1.ObjectID;
import iaik.asn1.structures.Attribute;
import iaik.x509.V3Extension;
import iaik.x509.X509ExtensionException;
public class SubjectDirectoryAttributes extends V3Extension {
// $FF: synthetic field
static Class a;
Attribute[] b;
public static final ObjectID oid = new ObjectID("2.5.29.9", "SubjectDirectoryAttributes");
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();
for(int var2 = 0; var2 < this.b.length; ++var2) {
var1.append(this.b[var2]);
}
var1.setLength(var1.length() - 1);
return var1.toString();
}
public ASN1Object toASN1Object() throws X509ExtensionException {
if(this.b != null && this.b.length != 0) {
try {
return ASN.createSequenceOf(this.b);
} catch (CodingException var2) {
throw new X509ExtensionException(var2.toString());
}
} else {
throw new X509ExtensionException("Cannot create SubjectDirectoryAttributes extension with no attributes!");
}
}
public void setAttributes(Attribute[] var1) {
this.b = var1;
}
public void init(ASN1Object var1) throws X509ExtensionException {
try {
this.b = (Attribute[])ASN.parseSequenceOf(var1, a != null?a:(a = a("iaik.asn1.structures.Attribute")));
} catch (CodingException var3) {
throw new X509ExtensionException(var3.getMessage());
}
if(this.b == null || this.b.length == 0) {
throw new X509ExtensionException("Invalid SubjectDirectoryAttributes extension: no attributes!");
}
}
public int hashCode() {
return oid.hashCode();
}
public ObjectID getObjectID() {
return oid;
}
public Attribute[] getAttributes() {
return this.b;
}
public Attribute getAttribute(ObjectID var1) {
if(this.b == null) {
return null;
} else {
for(int var2 = 0; var2 < this.b.length; ++var2) {
if(this.b[var2].getType().equals(var1)) {
return this.b[var2];
}
}
return null;
}
}
public SubjectDirectoryAttributes(Attribute[] var1) {
this.b = var1;
}
public SubjectDirectoryAttributes() {
}
}