Skip to content

Instantly share code, notes, and snippets.

@loverdos
Created September 13, 2010 15:42
Show Gist options
  • Save loverdos/577480 to your computer and use it in GitHub Desktop.
Save loverdos/577480 to your computer and use it in GitHub Desktop.
// expecting the https:// url on the command line
import java.net.URL
val url = new URL(args(0))
val con = url.openConnection()
con.connect()
val certs = con.asInstanceOf[javax.net.ssl.HttpsURLConnection].getServerCertificates
certs.zipWithIndex.foreach { case (cert, index) =>
println("Certificate #: " + index)
println("Certificate Java Class: " + cert.getClass.getName)
println("Certificate Data ( starting from next line)")
println(cert)
println("#######################################################")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment