public static List<OpenSSLX509Certificate> fromPkcs7DerInputStream(InputStream is)
            throws ParsingException {
        OpenSSLBIOInputStream bis = new OpenSSLBIOInputStream(is, true);

        final long[] certRefs;
        try {
            certRefs = NativeCrypto.d2i_PKCS7_bio(bis.getBioContext(), NativeCrypto.PKCS7_CERTS);
        } catch (Exception e) {
            throw new ParsingException(e);
        } finally {
            bis.release();
        }

        if (certRefs == null) {
            // To avoid returning a immutable list in only one path, we create an
            // empty list here instead of using Collections.emptyList()
            return new ArrayList<>();
        }

        final List<OpenSSLX509Certificate> certs = new ArrayList<>(
                certRefs.length);
        for (long certRef : certRefs) {
            if (certRef == 0) {
                continue;
            }
            certs.add(new OpenSSLX509Certificate(certRef));
        }
        return certs;
    }
An implementation of {@link X509Certificate} based on BoringSSL.
common/src/main/java/org/conscrypt/OpenSSLX509Certificate.java