public static CertificateEntry createForPrecertificate(OpenSSLX509Certificate leaf,
            OpenSSLX509Certificate issuer) throws CertificateException {
        try {
            if (!leaf.getNonCriticalExtensionOIDs().contains(Constants.X509_SCT_LIST_OID)) {
                throw new CertificateException("Certificate does not contain embedded signed timestamps");
            }

            byte[] tbs = leaf.getTBSCertificateWithoutExtension(Constants.X509_SCT_LIST_OID);

            byte[] issuerKey = issuer.getPublicKey().getEncoded();
            MessageDigest md = MessageDigest.getInstance("SHA-256");
            md.update(issuerKey);
            byte[] issuerKeyHash = md.digest();

            return createForPrecertificate(tbs, issuerKeyHash);
        } catch (NoSuchAlgorithmException e) {
            // SHA-256 is guaranteed to be available
            throw new RuntimeException(e);
        }
    }
Creates a CertificateEntry with type PRECERT_ENTRY

@throws IllegalArgumentException if issuerKeyHash isn't 32 bytes
common/src/main/java/org/conscrypt/ct/CertificateEntry.java