@Test public void testPtCRL() throws IOException { try (InputStream fis = CRLParserTest.class.getResourceAsStream("/pt_crl_with_critical_extension.crl"); BufferedInputStream is = new BufferedInputStream(fis)) { CRLInfo handler = parser.retrieveInfo(is); assertEquals("1.2.840.113549.1.1.5", handler.getCertificateListSignatureAlgorithmOid()); assertNotNull(handler.getIssuer()); assertNotNull(handler.getThisUpdate()); assertNotNull(handler.getNextUpdate()); assertEquals("1.2.840.113549.1.1.5", handler.getTbsSignatureAlgorithmOid()); String expectedSignValueHex = "1D9C9811905A3836FD9BDEC6DE27ABC18BC3DA1DB17C182EEB453A9F45D1D123C94A8FA44E3560C371CF846260AFADB62ABAB68D894B4B756383EAD77E69DF45D5193DBD6081932F39CD15A8CB92E88F1F77E8D61BA0F9F4A5FF88FACC3E486077223D94591AB994489A85DCCEAFE02244C05B321FA4675D1681E60252EAD9B34BB0473E80900593FC89AA066A205CB93EDC9F9832A0E2B344349BE6469A9A1E769C97E027D69BE6833BCD78BF892F816C6F972421680A229252648D9FB2E337B5E200127C2DD6EE293FD7CB3CD18C66464D37D629A42D1C3132ED520DE999CB64A30D583545BA2F12A0F45DC3028A27C8817F0B687B1D9192B39EB040873A410B9F804BFA6F0E9B7A55CDA29B831B6110B855F4640B06A4BA4CBAEB7F5F696A3556AD6627DD8861F463BC22E14DADB33524E8AE26FE26E332C661D3FCD67DA094A91BC5439F755F89FC5FA55F82923DF38A8FBB90E86D69C2D9E9DE8531AE98C4A8886BCDF1C95FB5183200621803F07C9088722EF68E96B5D944DF072F875D8C48FB213E1A4A52155CEC88D2722D4D8B90E92602097B2A8A94A1EB96B2ECB796B8804C8A6702B5E9B53A356706059824F59B0FD7FE843EA5818A909B44A69480BB03826A5B43804B999B8318C35FC91065982C2F7816ED1EA80BD9C1471CA1E60E619426749E95AB2DD270FC9BE43437928622C5EAC6632FEAC1BF894E70C0"; byte[] signatureValue = handler.getSignatureValue(); assertArrayEquals(Utils.fromHex(expectedSignValueHex), signatureValue); } }
public CRLInfo retrieveInfo(InputStream s) throws IOException { if (!s.markSupported()) { throw new IllegalArgumentException("The InputStream MUST support mark/reset methods !"); } CRLInfo infos = new CRLInfo(); consumeTagIntro(s); consumeTagIntro(s); int tag = DERUtil.readTag(s); int tagNo = DERUtil.readTagNumber(s, tag); int length = DERUtil.readLength(s); if (tagNo == BERTags.INTEGER) { byte[] array = readNbBytes(s, length); if (LOG.isDebugEnabled()) { LOG.debug("TBSCertList -> version : {}", Hex.toHexString(array)); } infos.setVersion(rebuildASN1Integer(array).getValue().intValue() + 1); tag = DERUtil.readTag(s); tagNo = DERUtil.readTagNumber(s, tag); length = DERUtil.readLength(s); } if (tagNo == BERTags.SEQUENCE) { byte[] array = readNbBytes(s, length); if (LOG.isDebugEnabled()) { LOG.debug("TBSCertList -> signatureAlgorithm : {}", Hex.toHexString(array)); } AlgorithmIdentifier algoId = AlgorithmIdentifier.getInstance(rebuildASN1Sequence(array)); ASN1ObjectIdentifier oid = algoId.getAlgorithm(); infos.setCertificateListSignatureAlgorithmOid(oid.getId()); ASN1Encodable parameters = algoId.getParameters(); if (parameters != null && !DERNull.INSTANCE.equals(parameters)) { infos.setCertificateListSignatureAlgorithmParams(parameters.toASN1Primitive().getEncoded(ASN1Encoding.DER)); } tag = DERUtil.readTag(s); tagNo = DERUtil.readTagNumber(s, tag); length = DERUtil.readLength(s); } if (tagNo == BERTags.SEQUENCE) { byte[] array = readNbBytes(s, length); if (LOG.isDebugEnabled()) { LOG.debug("TBSCertList -> issuer : {}", Hex.toHexString(array)); } ASN1Sequence sequence = rebuildASN1Sequence(array); infos.setIssuer(new X500Principal(sequence.getEncoded())); tag = DERUtil.readTag(s); tagNo = DERUtil.readTagNumber(s, tag); length = DERUtil.readLength(s); } if (isDate(tagNo)) { byte[] array = readNbBytes(s, length); if (LOG.isDebugEnabled()) { LOG.debug("TBSCertList -> thisUpdate : {}", Hex.toHexString(array)); } Time time = rebuildASN1Time(tagNo, array); infos.setThisUpdate(time.getDate()); tag = DERUtil.readTag(s); tagNo = DERUtil.readTagNumber(s, tag); length = DERUtil.readLength(s); } if (isDate(tagNo)) { byte[] array = readNbBytes(s, length); if (LOG.isDebugEnabled()) { LOG.debug("TBSCertList -> nextUpdate : {}", Hex.toHexString(array)); } Time time = rebuildASN1Time(tagNo, array); infos.setNextUpdate(time.getDate()); tag = DERUtil.readTag(s); tagNo = DERUtil.readTagNumber(s, tag); length = DERUtil.readLength(s); } if (tagNo == BERTags.SEQUENCE) { if (length > 0) { s.mark(10); int intraTag = DERUtil.readTag(s); int intraTagNo = DERUtil.readTagNumber(s, intraTag); s.reset(); if (intraTagNo == BERTags.SEQUENCE) { skip(s, length); LOG.debug("TBSCertList -> revokedCertificates : skipped (length={})", length); tag = DERUtil.readTag(s); tagNo = DERUtil.readTagNumber(s, tag); length = DERUtil.readLength(s); } } else { LOG.debug("TBSCertList -> revokedCertificates : Empty sequence"); tag = DERUtil.readTag(s); tagNo = DERUtil.readTagNumber(s, tag); length = DERUtil.readLength(s); } } boolean isTagged = (tag & BERTags.TAGGED) != 0; if (isTagged) { byte[] array = readNbBytes(s, length); if (LOG.isDebugEnabled()) { LOG.debug("TBSCertList -> crlExtensions : {}", Hex.toHexString(array)); } ASN1Sequence sequenceExtensions = (ASN1Sequence) ASN1Primitive.fromByteArray(array); extractExtensions(sequenceExtensions, infos); tag = DERUtil.readTag(s); tagNo = DERUtil.readTagNumber(s, tag); length = DERUtil.readLength(s); } if (BERTags.SEQUENCE == tagNo) { byte[] array = readNbBytes(s, length); if (LOG.isDebugEnabled()) { LOG.debug("CertificateList -> signatureAlgorithm : {}", Hex.toHexString(array)); } AlgorithmIdentifier algoId = AlgorithmIdentifier.getInstance(rebuildASN1Sequence(array)); infos.setTbsSignatureAlgorithmOid(algoId.getAlgorithm().getId()); tag = DERUtil.readTag(s); tagNo = DERUtil.readTagNumber(s, tag); length = DERUtil.readLength(s); } if (BERTags.BIT_STRING == tagNo) { byte[] array = readNbBytes(s, length); if (LOG.isDebugEnabled()) { LOG.debug("CertificateList -> signatureValue : {}", Hex.toHexString(array)); } infos.setSignatureValue(rebuildASN1BitString(array).getOctets()); } return infos; }
CRLParser { public CRLInfo retrieveInfo(InputStream s) throws IOException { if (!s.markSupported()) { throw new IllegalArgumentException("The InputStream MUST support mark/reset methods !"); } CRLInfo infos = new CRLInfo(); consumeTagIntro(s); consumeTagIntro(s); int tag = DERUtil.readTag(s); int tagNo = DERUtil.readTagNumber(s, tag); int length = DERUtil.readLength(s); if (tagNo == BERTags.INTEGER) { byte[] array = readNbBytes(s, length); if (LOG.isDebugEnabled()) { LOG.debug("TBSCertList -> version : {}", Hex.toHexString(array)); } infos.setVersion(rebuildASN1Integer(array).getValue().intValue() + 1); tag = DERUtil.readTag(s); tagNo = DERUtil.readTagNumber(s, tag); length = DERUtil.readLength(s); } if (tagNo == BERTags.SEQUENCE) { byte[] array = readNbBytes(s, length); if (LOG.isDebugEnabled()) { LOG.debug("TBSCertList -> signatureAlgorithm : {}", Hex.toHexString(array)); } AlgorithmIdentifier algoId = AlgorithmIdentifier.getInstance(rebuildASN1Sequence(array)); ASN1ObjectIdentifier oid = algoId.getAlgorithm(); infos.setCertificateListSignatureAlgorithmOid(oid.getId()); ASN1Encodable parameters = algoId.getParameters(); if (parameters != null && !DERNull.INSTANCE.equals(parameters)) { infos.setCertificateListSignatureAlgorithmParams(parameters.toASN1Primitive().getEncoded(ASN1Encoding.DER)); } tag = DERUtil.readTag(s); tagNo = DERUtil.readTagNumber(s, tag); length = DERUtil.readLength(s); } if (tagNo == BERTags.SEQUENCE) { byte[] array = readNbBytes(s, length); if (LOG.isDebugEnabled()) { LOG.debug("TBSCertList -> issuer : {}", Hex.toHexString(array)); } ASN1Sequence sequence = rebuildASN1Sequence(array); infos.setIssuer(new X500Principal(sequence.getEncoded())); tag = DERUtil.readTag(s); tagNo = DERUtil.readTagNumber(s, tag); length = DERUtil.readLength(s); } if (isDate(tagNo)) { byte[] array = readNbBytes(s, length); if (LOG.isDebugEnabled()) { LOG.debug("TBSCertList -> thisUpdate : {}", Hex.toHexString(array)); } Time time = rebuildASN1Time(tagNo, array); infos.setThisUpdate(time.getDate()); tag = DERUtil.readTag(s); tagNo = DERUtil.readTagNumber(s, tag); length = DERUtil.readLength(s); } if (isDate(tagNo)) { byte[] array = readNbBytes(s, length); if (LOG.isDebugEnabled()) { LOG.debug("TBSCertList -> nextUpdate : {}", Hex.toHexString(array)); } Time time = rebuildASN1Time(tagNo, array); infos.setNextUpdate(time.getDate()); tag = DERUtil.readTag(s); tagNo = DERUtil.readTagNumber(s, tag); length = DERUtil.readLength(s); } if (tagNo == BERTags.SEQUENCE) { if (length > 0) { s.mark(10); int intraTag = DERUtil.readTag(s); int intraTagNo = DERUtil.readTagNumber(s, intraTag); s.reset(); if (intraTagNo == BERTags.SEQUENCE) { skip(s, length); LOG.debug("TBSCertList -> revokedCertificates : skipped (length={})", length); tag = DERUtil.readTag(s); tagNo = DERUtil.readTagNumber(s, tag); length = DERUtil.readLength(s); } } else { LOG.debug("TBSCertList -> revokedCertificates : Empty sequence"); tag = DERUtil.readTag(s); tagNo = DERUtil.readTagNumber(s, tag); length = DERUtil.readLength(s); } } boolean isTagged = (tag & BERTags.TAGGED) != 0; if (isTagged) { byte[] array = readNbBytes(s, length); if (LOG.isDebugEnabled()) { LOG.debug("TBSCertList -> crlExtensions : {}", Hex.toHexString(array)); } ASN1Sequence sequenceExtensions = (ASN1Sequence) ASN1Primitive.fromByteArray(array); extractExtensions(sequenceExtensions, infos); tag = DERUtil.readTag(s); tagNo = DERUtil.readTagNumber(s, tag); length = DERUtil.readLength(s); } if (BERTags.SEQUENCE == tagNo) { byte[] array = readNbBytes(s, length); if (LOG.isDebugEnabled()) { LOG.debug("CertificateList -> signatureAlgorithm : {}", Hex.toHexString(array)); } AlgorithmIdentifier algoId = AlgorithmIdentifier.getInstance(rebuildASN1Sequence(array)); infos.setTbsSignatureAlgorithmOid(algoId.getAlgorithm().getId()); tag = DERUtil.readTag(s); tagNo = DERUtil.readTagNumber(s, tag); length = DERUtil.readLength(s); } if (BERTags.BIT_STRING == tagNo) { byte[] array = readNbBytes(s, length); if (LOG.isDebugEnabled()) { LOG.debug("CertificateList -> signatureValue : {}", Hex.toHexString(array)); } infos.setSignatureValue(rebuildASN1BitString(array).getOctets()); } return infos; } }
CRLParser { public CRLInfo retrieveInfo(InputStream s) throws IOException { if (!s.markSupported()) { throw new IllegalArgumentException("The InputStream MUST support mark/reset methods !"); } CRLInfo infos = new CRLInfo(); consumeTagIntro(s); consumeTagIntro(s); int tag = DERUtil.readTag(s); int tagNo = DERUtil.readTagNumber(s, tag); int length = DERUtil.readLength(s); if (tagNo == BERTags.INTEGER) { byte[] array = readNbBytes(s, length); if (LOG.isDebugEnabled()) { LOG.debug("TBSCertList -> version : {}", Hex.toHexString(array)); } infos.setVersion(rebuildASN1Integer(array).getValue().intValue() + 1); tag = DERUtil.readTag(s); tagNo = DERUtil.readTagNumber(s, tag); length = DERUtil.readLength(s); } if (tagNo == BERTags.SEQUENCE) { byte[] array = readNbBytes(s, length); if (LOG.isDebugEnabled()) { LOG.debug("TBSCertList -> signatureAlgorithm : {}", Hex.toHexString(array)); } AlgorithmIdentifier algoId = AlgorithmIdentifier.getInstance(rebuildASN1Sequence(array)); ASN1ObjectIdentifier oid = algoId.getAlgorithm(); infos.setCertificateListSignatureAlgorithmOid(oid.getId()); ASN1Encodable parameters = algoId.getParameters(); if (parameters != null && !DERNull.INSTANCE.equals(parameters)) { infos.setCertificateListSignatureAlgorithmParams(parameters.toASN1Primitive().getEncoded(ASN1Encoding.DER)); } tag = DERUtil.readTag(s); tagNo = DERUtil.readTagNumber(s, tag); length = DERUtil.readLength(s); } if (tagNo == BERTags.SEQUENCE) { byte[] array = readNbBytes(s, length); if (LOG.isDebugEnabled()) { LOG.debug("TBSCertList -> issuer : {}", Hex.toHexString(array)); } ASN1Sequence sequence = rebuildASN1Sequence(array); infos.setIssuer(new X500Principal(sequence.getEncoded())); tag = DERUtil.readTag(s); tagNo = DERUtil.readTagNumber(s, tag); length = DERUtil.readLength(s); } if (isDate(tagNo)) { byte[] array = readNbBytes(s, length); if (LOG.isDebugEnabled()) { LOG.debug("TBSCertList -> thisUpdate : {}", Hex.toHexString(array)); } Time time = rebuildASN1Time(tagNo, array); infos.setThisUpdate(time.getDate()); tag = DERUtil.readTag(s); tagNo = DERUtil.readTagNumber(s, tag); length = DERUtil.readLength(s); } if (isDate(tagNo)) { byte[] array = readNbBytes(s, length); if (LOG.isDebugEnabled()) { LOG.debug("TBSCertList -> nextUpdate : {}", Hex.toHexString(array)); } Time time = rebuildASN1Time(tagNo, array); infos.setNextUpdate(time.getDate()); tag = DERUtil.readTag(s); tagNo = DERUtil.readTagNumber(s, tag); length = DERUtil.readLength(s); } if (tagNo == BERTags.SEQUENCE) { if (length > 0) { s.mark(10); int intraTag = DERUtil.readTag(s); int intraTagNo = DERUtil.readTagNumber(s, intraTag); s.reset(); if (intraTagNo == BERTags.SEQUENCE) { skip(s, length); LOG.debug("TBSCertList -> revokedCertificates : skipped (length={})", length); tag = DERUtil.readTag(s); tagNo = DERUtil.readTagNumber(s, tag); length = DERUtil.readLength(s); } } else { LOG.debug("TBSCertList -> revokedCertificates : Empty sequence"); tag = DERUtil.readTag(s); tagNo = DERUtil.readTagNumber(s, tag); length = DERUtil.readLength(s); } } boolean isTagged = (tag & BERTags.TAGGED) != 0; if (isTagged) { byte[] array = readNbBytes(s, length); if (LOG.isDebugEnabled()) { LOG.debug("TBSCertList -> crlExtensions : {}", Hex.toHexString(array)); } ASN1Sequence sequenceExtensions = (ASN1Sequence) ASN1Primitive.fromByteArray(array); extractExtensions(sequenceExtensions, infos); tag = DERUtil.readTag(s); tagNo = DERUtil.readTagNumber(s, tag); length = DERUtil.readLength(s); } if (BERTags.SEQUENCE == tagNo) { byte[] array = readNbBytes(s, length); if (LOG.isDebugEnabled()) { LOG.debug("CertificateList -> signatureAlgorithm : {}", Hex.toHexString(array)); } AlgorithmIdentifier algoId = AlgorithmIdentifier.getInstance(rebuildASN1Sequence(array)); infos.setTbsSignatureAlgorithmOid(algoId.getAlgorithm().getId()); tag = DERUtil.readTag(s); tagNo = DERUtil.readTagNumber(s, tag); length = DERUtil.readLength(s); } if (BERTags.BIT_STRING == tagNo) { byte[] array = readNbBytes(s, length); if (LOG.isDebugEnabled()) { LOG.debug("CertificateList -> signatureValue : {}", Hex.toHexString(array)); } infos.setSignatureValue(rebuildASN1BitString(array).getOctets()); } return infos; }  }
CRLParser { public CRLInfo retrieveInfo(InputStream s) throws IOException { if (!s.markSupported()) { throw new IllegalArgumentException("The InputStream MUST support mark/reset methods !"); } CRLInfo infos = new CRLInfo(); consumeTagIntro(s); consumeTagIntro(s); int tag = DERUtil.readTag(s); int tagNo = DERUtil.readTagNumber(s, tag); int length = DERUtil.readLength(s); if (tagNo == BERTags.INTEGER) { byte[] array = readNbBytes(s, length); if (LOG.isDebugEnabled()) { LOG.debug("TBSCertList -> version : {}", Hex.toHexString(array)); } infos.setVersion(rebuildASN1Integer(array).getValue().intValue() + 1); tag = DERUtil.readTag(s); tagNo = DERUtil.readTagNumber(s, tag); length = DERUtil.readLength(s); } if (tagNo == BERTags.SEQUENCE) { byte[] array = readNbBytes(s, length); if (LOG.isDebugEnabled()) { LOG.debug("TBSCertList -> signatureAlgorithm : {}", Hex.toHexString(array)); } AlgorithmIdentifier algoId = AlgorithmIdentifier.getInstance(rebuildASN1Sequence(array)); ASN1ObjectIdentifier oid = algoId.getAlgorithm(); infos.setCertificateListSignatureAlgorithmOid(oid.getId()); ASN1Encodable parameters = algoId.getParameters(); if (parameters != null && !DERNull.INSTANCE.equals(parameters)) { infos.setCertificateListSignatureAlgorithmParams(parameters.toASN1Primitive().getEncoded(ASN1Encoding.DER)); } tag = DERUtil.readTag(s); tagNo = DERUtil.readTagNumber(s, tag); length = DERUtil.readLength(s); } if (tagNo == BERTags.SEQUENCE) { byte[] array = readNbBytes(s, length); if (LOG.isDebugEnabled()) { LOG.debug("TBSCertList -> issuer : {}", Hex.toHexString(array)); } ASN1Sequence sequence = rebuildASN1Sequence(array); infos.setIssuer(new X500Principal(sequence.getEncoded())); tag = DERUtil.readTag(s); tagNo = DERUtil.readTagNumber(s, tag); length = DERUtil.readLength(s); } if (isDate(tagNo)) { byte[] array = readNbBytes(s, length); if (LOG.isDebugEnabled()) { LOG.debug("TBSCertList -> thisUpdate : {}", Hex.toHexString(array)); } Time time = rebuildASN1Time(tagNo, array); infos.setThisUpdate(time.getDate()); tag = DERUtil.readTag(s); tagNo = DERUtil.readTagNumber(s, tag); length = DERUtil.readLength(s); } if (isDate(tagNo)) { byte[] array = readNbBytes(s, length); if (LOG.isDebugEnabled()) { LOG.debug("TBSCertList -> nextUpdate : {}", Hex.toHexString(array)); } Time time = rebuildASN1Time(tagNo, array); infos.setNextUpdate(time.getDate()); tag = DERUtil.readTag(s); tagNo = DERUtil.readTagNumber(s, tag); length = DERUtil.readLength(s); } if (tagNo == BERTags.SEQUENCE) { if (length > 0) { s.mark(10); int intraTag = DERUtil.readTag(s); int intraTagNo = DERUtil.readTagNumber(s, intraTag); s.reset(); if (intraTagNo == BERTags.SEQUENCE) { skip(s, length); LOG.debug("TBSCertList -> revokedCertificates : skipped (length={})", length); tag = DERUtil.readTag(s); tagNo = DERUtil.readTagNumber(s, tag); length = DERUtil.readLength(s); } } else { LOG.debug("TBSCertList -> revokedCertificates : Empty sequence"); tag = DERUtil.readTag(s); tagNo = DERUtil.readTagNumber(s, tag); length = DERUtil.readLength(s); } } boolean isTagged = (tag & BERTags.TAGGED) != 0; if (isTagged) { byte[] array = readNbBytes(s, length); if (LOG.isDebugEnabled()) { LOG.debug("TBSCertList -> crlExtensions : {}", Hex.toHexString(array)); } ASN1Sequence sequenceExtensions = (ASN1Sequence) ASN1Primitive.fromByteArray(array); extractExtensions(sequenceExtensions, infos); tag = DERUtil.readTag(s); tagNo = DERUtil.readTagNumber(s, tag); length = DERUtil.readLength(s); } if (BERTags.SEQUENCE == tagNo) { byte[] array = readNbBytes(s, length); if (LOG.isDebugEnabled()) { LOG.debug("CertificateList -> signatureAlgorithm : {}", Hex.toHexString(array)); } AlgorithmIdentifier algoId = AlgorithmIdentifier.getInstance(rebuildASN1Sequence(array)); infos.setTbsSignatureAlgorithmOid(algoId.getAlgorithm().getId()); tag = DERUtil.readTag(s); tagNo = DERUtil.readTagNumber(s, tag); length = DERUtil.readLength(s); } if (BERTags.BIT_STRING == tagNo) { byte[] array = readNbBytes(s, length); if (LOG.isDebugEnabled()) { LOG.debug("CertificateList -> signatureValue : {}", Hex.toHexString(array)); } infos.setSignatureValue(rebuildASN1BitString(array).getOctets()); } return infos; }  void getSignedData(BinaryFilteringInputStream is); X509CRLEntry retrieveRevocationInfo(InputStream s, BigInteger serialNumber); CRLInfo retrieveInfo(InputStream s); }
CRLParser { public CRLInfo retrieveInfo(InputStream s) throws IOException { if (!s.markSupported()) { throw new IllegalArgumentException("The InputStream MUST support mark/reset methods !"); } CRLInfo infos = new CRLInfo(); consumeTagIntro(s); consumeTagIntro(s); int tag = DERUtil.readTag(s); int tagNo = DERUtil.readTagNumber(s, tag); int length = DERUtil.readLength(s); if (tagNo == BERTags.INTEGER) { byte[] array = readNbBytes(s, length); if (LOG.isDebugEnabled()) { LOG.debug("TBSCertList -> version : {}", Hex.toHexString(array)); } infos.setVersion(rebuildASN1Integer(array).getValue().intValue() + 1); tag = DERUtil.readTag(s); tagNo = DERUtil.readTagNumber(s, tag); length = DERUtil.readLength(s); } if (tagNo == BERTags.SEQUENCE) { byte[] array = readNbBytes(s, length); if (LOG.isDebugEnabled()) { LOG.debug("TBSCertList -> signatureAlgorithm : {}", Hex.toHexString(array)); } AlgorithmIdentifier algoId = AlgorithmIdentifier.getInstance(rebuildASN1Sequence(array)); ASN1ObjectIdentifier oid = algoId.getAlgorithm(); infos.setCertificateListSignatureAlgorithmOid(oid.getId()); ASN1Encodable parameters = algoId.getParameters(); if (parameters != null && !DERNull.INSTANCE.equals(parameters)) { infos.setCertificateListSignatureAlgorithmParams(parameters.toASN1Primitive().getEncoded(ASN1Encoding.DER)); } tag = DERUtil.readTag(s); tagNo = DERUtil.readTagNumber(s, tag); length = DERUtil.readLength(s); } if (tagNo == BERTags.SEQUENCE) { byte[] array = readNbBytes(s, length); if (LOG.isDebugEnabled()) { LOG.debug("TBSCertList -> issuer : {}", Hex.toHexString(array)); } ASN1Sequence sequence = rebuildASN1Sequence(array); infos.setIssuer(new X500Principal(sequence.getEncoded())); tag = DERUtil.readTag(s); tagNo = DERUtil.readTagNumber(s, tag); length = DERUtil.readLength(s); } if (isDate(tagNo)) { byte[] array = readNbBytes(s, length); if (LOG.isDebugEnabled()) { LOG.debug("TBSCertList -> thisUpdate : {}", Hex.toHexString(array)); } Time time = rebuildASN1Time(tagNo, array); infos.setThisUpdate(time.getDate()); tag = DERUtil.readTag(s); tagNo = DERUtil.readTagNumber(s, tag); length = DERUtil.readLength(s); } if (isDate(tagNo)) { byte[] array = readNbBytes(s, length); if (LOG.isDebugEnabled()) { LOG.debug("TBSCertList -> nextUpdate : {}", Hex.toHexString(array)); } Time time = rebuildASN1Time(tagNo, array); infos.setNextUpdate(time.getDate()); tag = DERUtil.readTag(s); tagNo = DERUtil.readTagNumber(s, tag); length = DERUtil.readLength(s); } if (tagNo == BERTags.SEQUENCE) { if (length > 0) { s.mark(10); int intraTag = DERUtil.readTag(s); int intraTagNo = DERUtil.readTagNumber(s, intraTag); s.reset(); if (intraTagNo == BERTags.SEQUENCE) { skip(s, length); LOG.debug("TBSCertList -> revokedCertificates : skipped (length={})", length); tag = DERUtil.readTag(s); tagNo = DERUtil.readTagNumber(s, tag); length = DERUtil.readLength(s); } } else { LOG.debug("TBSCertList -> revokedCertificates : Empty sequence"); tag = DERUtil.readTag(s); tagNo = DERUtil.readTagNumber(s, tag); length = DERUtil.readLength(s); } } boolean isTagged = (tag & BERTags.TAGGED) != 0; if (isTagged) { byte[] array = readNbBytes(s, length); if (LOG.isDebugEnabled()) { LOG.debug("TBSCertList -> crlExtensions : {}", Hex.toHexString(array)); } ASN1Sequence sequenceExtensions = (ASN1Sequence) ASN1Primitive.fromByteArray(array); extractExtensions(sequenceExtensions, infos); tag = DERUtil.readTag(s); tagNo = DERUtil.readTagNumber(s, tag); length = DERUtil.readLength(s); } if (BERTags.SEQUENCE == tagNo) { byte[] array = readNbBytes(s, length); if (LOG.isDebugEnabled()) { LOG.debug("CertificateList -> signatureAlgorithm : {}", Hex.toHexString(array)); } AlgorithmIdentifier algoId = AlgorithmIdentifier.getInstance(rebuildASN1Sequence(array)); infos.setTbsSignatureAlgorithmOid(algoId.getAlgorithm().getId()); tag = DERUtil.readTag(s); tagNo = DERUtil.readTagNumber(s, tag); length = DERUtil.readLength(s); } if (BERTags.BIT_STRING == tagNo) { byte[] array = readNbBytes(s, length); if (LOG.isDebugEnabled()) { LOG.debug("CertificateList -> signatureValue : {}", Hex.toHexString(array)); } infos.setSignatureValue(rebuildASN1BitString(array).getOctets()); } return infos; }  void getSignedData(BinaryFilteringInputStream is); X509CRLEntry retrieveRevocationInfo(InputStream s, BigInteger serialNumber); CRLInfo retrieveInfo(InputStream s);  }