private static byte[] generatePublicKeyDigest(PublicKey pubKey) {
        SubjectPublicKeyInfo spki = SubjectPublicKeyInfo.getInstance(pubKey.getEncoded());
        MessageDigest sha1digest;
        try {
            sha1digest = MessageDigest.getInstance("SHA-1");
        } catch (NoSuchAlgorithmException e) {
            throw new RuntimeException("SHA-1 not available");
        }
        return sha1digest.digest(spki.getPublicKeyData().getBytes());
    }
Generates a type 1 key identifier according to RFC 3280 4.2.1.2.
common/src/test/java/org/conscrypt/java/security/cert/CertificateFactoryTest.java