### Question:
PemUtils { static byte[] generateThumbprintBytes(String[] certChain, String encoding) throws NoSuchAlgorithmException { return MessageDigest.getInstance(encoding).digest(pemToDer(certChain[0])); } private  PemUtils(); static X509Certificate decodeCertificate(String cert); static PublicKey decodePublicKey(String pem); static PrivateKey decodePrivateKey(String pem); static String encodeKey(Key key); static String encodeCertificate(Certificate certificate); static byte[] pemToDer(String pem); static String removeBeginEnd(String pem); static String generateThumbprint(String[] certChain, String encoding);  }### Answer:
@Test public void testGenerateThumbprintBytesSha1() throws NoSuchAlgorithmException { String[] test = new String[] {"abcdefg"}; byte[] digest = PemUtils.generateThumbprintBytes(test, "SHA-1"); assertEquals(20, digest.length); }
@Test public void testGenerateThumbprintBytesSha256() throws NoSuchAlgorithmException { String[] test = new String[] {"abcdefg"}; byte[] digest = PemUtils.generateThumbprintBytes(test, "SHA-256"); assertEquals(32, digest.length); }