{"id":5326,"date":"2016-01-26T15:06:53","date_gmt":"2016-01-26T20:06:53","guid":{"rendered":"http:\/\/appcrawler.com\/wordpress\/?p=5326"},"modified":"2016-01-26T15:06:53","modified_gmt":"2016-01-26T20:06:53","slug":"verifying-an-ssl-certificate-expiration-with-java","status":"publish","type":"post","link":"http:\/\/appcrawler.com\/wordpress\/2016\/01\/26\/verifying-an-ssl-certificate-expiration-with-java\/","title":{"rendered":"Verifying an SSL certificate expiration with java"},"content":{"rendered":"<p>We came up with this as a one-off to alert us when a certificate was close to expiration (we were burned one too many times)&#8230;<\/p>\n<pre>\r\nimport java.net.*;\r\nimport java.security.cert.*;\r\nimport javax.net.ssl.*;\r\n\r\npublic class GetCertDates {\r\n  public static void main(String [] args) throws Exception {\r\n    URL url = new URL(args[0]);\r\n    HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();\r\n    conn.getResponseCode();\r\n    Certificate[] certificates = conn.getServerCertificates();\r\n    for (Certificate cert:certificates) {\r\n      X509Certificate c = (X509Certificate)cert;\r\n      System.out.println(c.getNotAfter());\r\n    }\r\n    conn.disconnect();\r\n  }\r\n}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>We came up with this as a one-off to alert us when a certificate was close to expiration (we were burned one too many times)&#8230; import java.net.*; import java.security.cert.*; import javax.net.ssl.*; public class GetCertDates { public static void main(String []&hellip;<\/p>\n<p class=\"more-link-p\"><a class=\"more-link\" href=\"http:\/\/appcrawler.com\/wordpress\/2016\/01\/26\/verifying-an-ssl-certificate-expiration-with-java\/\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"footnotes":""},"categories":[25,66],"tags":[],"_links":{"self":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/5326"}],"collection":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/comments?post=5326"}],"version-history":[{"count":5,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/5326\/revisions"}],"predecessor-version":[{"id":5364,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/5326\/revisions\/5364"}],"wp:attachment":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/media?parent=5326"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/categories?post=5326"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/tags?post=5326"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}