Wednesday, 12 June 2013

Scala code snippet and Windows Keystore

Can become very handy ;-)
import org.ws.common.TLogger
import java.security.KeyStore

object KS extends TLogger {
  def main(args: Array[String]): Unit = {
    info("KS")
    
    val ks = KeyStore.getInstance("Windows-MY")
    ks.load(null, null)
    val aliases = ks.aliases
    while(aliases.hasMoreElements) {
      val alias = aliases.nextElement
      val certificate = ks.getCertificate(alias)
      info(s"Alias: $alias, certificate: $certificate")
    }
  }
}

No comments:

Blog Archive