From: Kevin K. <ke...@ce...> - 2014-11-17 09:56:29
|
Hello Guys, I am currently using htmlunit to simulate scrapping of a web page that requires an ssl client certificate to be installed (https connection). This certificate has successfully been installed in my windows OS . On access of the given webpage via web browsers(chrome & IE), a prompt is issued to select a personal certificate that will be used . I would like to access the windows cert store preferably this personal certificate to authenticate and create a successful connection to my htmlunit client. I have managed to research on the SunMSCAPI with Windows-MY to read the store as shown in below code. Provider provider = Security.getProvider("SunMSCAPI"); KeyStore store = KeyStore.getInstance("Windows-MY", provider); store.load(null, null); Enumeration<?> aliases = store.aliases(); while (aliases.hasMoreElements()) { String alias = aliases.nextElement().toString(); if (alias.equals("mypersonalcert")) { Certificate[] signerKey = (Certificate[]) store .getCertificateChain(alias); Object entry = store.getKey(alias, null); System.out .println("cert aquired! got it"); } } How do I successfully integrate this to my htmlunit webconnection and web client instance for connection? Input will be highly appreciated. |