### Question:
CertUtils { public static String confirmationMethodHashS256(String certificateAsPem) { if (org.apache.commons.lang.StringUtils.isBlank(certificateAsPem)) { return ""; } try { certificateAsPem = org.apache.commons.lang.StringUtils.remove(certificateAsPem, "-----BEGIN CERTIFICATE-----"); certificateAsPem = org.apache.commons.lang.StringUtils.remove(certificateAsPem, "-----END CERTIFICATE-----"); certificateAsPem = StringUtils.replace(certificateAsPem, "\n", ""); return Base64Util.base64urlencode(DigestUtils.sha256(Base64.decode(certificateAsPem))); } catch (Exception e) { log.error("Failed to hash certificate: " + certificateAsPem, e); return ""; } } private  CertUtils(); static X509Certificate x509CertificateFromBytes(byte[] cert); static X509Certificate x509CertificateFromPem(String pem); static String confirmationMethodHashS256(String certificateAsPem); @NotNull static String getCN(@Nullable X509Certificate cert);  }### Answer:
@Test public void s256() { Assert.assertEquals("A4DtL2JmUMhAsvJj5tKyn64SqzmuXbMrJa0n761y5v0", CertUtils.confirmationMethodHashS256(TEST_PEM_1)); Assert.assertEquals("A4DtL2JmUMhAsvJj5tKyn64SqzmuXbMrJa0n761y5v0", CertUtils.confirmationMethodHashS256(TEST_PEM_2)); Assert.assertEquals("A4DtL2JmUMhAsvJj5tKyn64SqzmuXbMrJa0n761y5v0", CertUtils.confirmationMethodHashS256(TEST_PEM_3)); }