ASN1Sequence seq = (ASN1Sequence) aIn.readObject();
dump = ASN1Dump.dumpAsString(seq);
AttributeCertificate obj = new AttributeCertificate(seq);
AttributeCertificateInfo acInfo = obj.getAcinfo();
// Version
if (!(acInfo.getVersion().equals(new DERInteger(1)))
&& (!(acInfo.getVersion().equals(new DERInteger(2)))))
{
return new SimpleTestResult(false,
"failed AC Version test for id " + id);
}
// Holder
Holder h = acInfo.getHolder();
if (h == null)
{
return new SimpleTestResult(false,
"failed AC Holder test, it's null, for id " + id);
}
// Issuer
AttCertIssuer aci = acInfo.getIssuer();
if (aci == null)
{
return new SimpleTestResult(false,
"failed AC Issuer test, it's null, for id " + id);
}
// Signature
AlgorithmIdentifier sig = acInfo.getSignature();
if (sig == null)
{
return new SimpleTestResult(false,
"failed AC Signature test for id " + id);
}
// Serial
DERInteger serial = acInfo.getSerialNumber();
// Validity
AttCertValidityPeriod validity = acInfo.getAttrCertValidityPeriod();
if (validity == null)
{
return new SimpleTestResult(false,
"failed AC AttCertValidityPeriod test for id " + id);
}
// Attributes
ASN1Sequence attribSeq = acInfo.getAttributes();
Attribute att[] = new Attribute[attribSeq.size()];
for (int i = 0; i < attribSeq.size(); i++)
{
att[i] = Attribute.getInstance(attribSeq.getObjectAt(i));
}
// IssuerUniqueId
// TODO, how to best test?
// X509 Extensions
X509Extensions ext = acInfo.getExtensions();
if (ext != null)
{
Enumeration en = ext.oids();
while (en.hasMoreElements())
{