public AttributeCertificateInfo( ASN1Sequence seq) { this.version = DERInteger.getInstance(seq.getObjectAt(0)); this.holder = Holder.getInstance(seq.getObjectAt(1)); this.issuer = AttCertIssuer.getInstance(seq.getObjectAt(2)); this.signature = AlgorithmIdentifier.getInstance(seq.getObjectAt(3)); this.serialNumber = DERInteger.getInstance(seq.getObjectAt(4)); this.attrCertValidityPeriod = AttCertValidityPeriod.getInstance(seq.getObjectAt(5)); this.attributes = ASN1Sequence.getInstance(seq.getObjectAt(6)); for (int i = 7; i < seq.size(); i++) { ASN1Encodable obj = (ASN1Encodable)seq.getObjectAt(i); if (obj is DERBitString) { this.issuerUniqueID = DERBitString.getInstance(seq.getObjectAt(i)); } else if (obj is ASN1Sequence || obj is X509Extensions) { this.extensions = X509Extensions.getInstance(seq.getObjectAt(i)); } } }
public AttributeCertificateInfo generateAttributeCertificateInfo() { if ((serialNumber == null) || (signature == null) || (issuer == null) || (startDate == null) || (endDate == null) || (holder == null) || (attributes == null)) { throw new Exception("not all mandatory fields set in V2 AttributeCertificateInfo generator"); } ASN1EncodableVector v = new ASN1EncodableVector(); v.add(version); v.add(holder); v.add(issuer); v.add(signature); v.add(serialNumber); // // before and after dates => AttCertValidityPeriod // AttCertValidityPeriod validity = new AttCertValidityPeriod(startDate, endDate); v.add(validity); // Attributes v.add(new DERSequence(attributes)); if (issuerUniqueID != null) { v.add(issuerUniqueID); } if (extensions != null) { v.add(extensions); } return(new AttributeCertificateInfo(new DERSequence(v))); }