use of org.bouncycastle.asn1.x509.TBSCertList in project robovm by robovm.
the class CertUtils method generateCRLStructure.
private static CertificateList generateCRLStructure(TBSCertList tbsCertList, AlgorithmIdentifier sigAlgId, byte[] signature) {
ASN1EncodableVector v = new ASN1EncodableVector();
v.add(tbsCertList);
v.add(sigAlgId);
v.add(new DERBitString(signature));
return CertificateList.getInstance(new DERSequence(v));
}
use of org.bouncycastle.asn1.x509.TBSCertList in project robovm by robovm.
the class CertificateList method toASN1Primitive.
public ASN1Primitive toASN1Primitive() {
ASN1EncodableVector v = new ASN1EncodableVector();
v.add(tbsCertList);
v.add(sigAlgId);
v.add(sig);
return new DERSequence(v);
}
use of org.bouncycastle.asn1.x509.TBSCertList in project XobotOS by xamarin.
the class X509CRLImpl method retrieveEntries.
/*
* Retrieves the crl entries (TBSCertList.RevokedCertificate objects)
* from the TBSCertList structure and converts them to the
* X509CRLEntryImpl objects
*/
private void retrieveEntries() {
entriesRetrieved = true;
List rcerts = tbsCertList.getRevokedCertificates();
if (rcerts == null) {
return;
}
entriesSize = rcerts.size();
entries = new ArrayList(entriesSize);
// null means that revoked certificate issuer is the same as CRL issuer
X500Principal rcertIssuer = null;
for (int i = 0; i < entriesSize; i++) {
TBSCertList.RevokedCertificate rcert = (TBSCertList.RevokedCertificate) rcerts.get(i);
X500Principal iss = rcert.getIssuer();
if (iss != null) {
// certificate issuer differs from CRL issuer
// and CRL is indirect.
rcertIssuer = iss;
isIndirectCRL = true;
// remember how many leading revoked certificates in the
// list are issued by the same issuer as issuer of CRL
// (these certificates are first in the list)
nonIndirectEntriesSize = i;
}
entries.add(new X509CRLEntryImpl(rcert, rcertIssuer));
}
}
use of org.bouncycastle.asn1.x509.TBSCertList in project XobotOS by xamarin.
the class CertificateList method toASN1Object.
public DERObject toASN1Object() {
ASN1EncodableVector v = new ASN1EncodableVector();
v.add(tbsCertList);
v.add(sigAlgId);
v.add(sig);
return new DERSequence(v);
}
use of org.bouncycastle.asn1.x509.TBSCertList in project candlepin by candlepin.
the class X509CRLStreamWriter method writeNewTime.
/**
* Write a UTCTime or GeneralizedTime to an output stream.
*
* @param out
* @param newTime
* @param originalLength
* @throws IOException
*/
protected void writeNewTime(OutputStream out, ASN1Object newTime, int originalLength) throws IOException {
byte[] newEncodedTime = newTime.getEncoded();
InputStream timeIn = null;
try {
timeIn = new ByteArrayInputStream(newEncodedTime);
int newTag = readTag(timeIn, null);
readTagNumber(timeIn, newTag, null);
int newLength = readLength(timeIn, null);
/* If the length changes, it's going to create a discrepancy with the length
* reported in the TBSCertList sequence. The length could change with the addition
* or removal of time zone information for example. */
if (newLength != originalLength) {
throw new IllegalStateException("Length of generated time does not match " + "the original length. DER corruption would result.");
}
} finally {
IOUtils.closeQuietly(timeIn);
}
writeBytes(out, newEncodedTime);
}
Aggregations