java - How to add a client side pkcs12 certificate to Postman Chrome, W7 ? -


i try test 'strange' request have provide basic authentication , client side certificate.

i try check postman chrome did not understand how link certificate chrome personal certificate request.

i saw discussion : https://github.com/a85/postman-chrome-extension/issues/482 mac keystore , can't transpose w7/chrome.

here java code set should same job postman understand want postman do. use post write

        inputstream = context.getresources().getassets().open("certificatefile.p12");         keystore keystore = keystore.getinstance("pkcs12");         bufferedinputstream bis = new bufferedinputstream(is);         string password ="xxxxx";         keystore.load(bis, password.tochararray()); // password pkcs#12 password. if there no password, pass null         // init ssl context         keymanagerfactory kmf = keymanagerfactory.getinstance("x509");         kmf.init(keystore, password.tochararray());         keymanager[] keymanagers = kmf.getkeymanagers();         sslcontext sslcontext = sslcontext.getinstance("tls");         sslcontext.init(keymanagers, null, null);         httpsurlconnection urlconnection = null;          string strurl = "theurlitrytohit";         url = new url(strurl);         urlconnection = (httpsurlconnection) url.openconnection();         if(urlconnection instanceof httpsurlconnection) {             ((httpsurlconnection)urlconnection)             .setsslsocketfactory(sslcontext.getsocketfactory());         }         urlconnection.setrequestmethod("get");         string basicauth = "basic " + base64.encodetostring("pseudo:password".getbytes(), base64.no_wrap);         urlconnection.setrequestproperty ("authorization", basicauth); 

i having similar issue , got working. private key , cert stored in .pem file, first needed put them in format windows use. did following command:

openssl pkcs12 -inkey mycertandkey.pem -in mycert.crt -export -out mycertandkey.pfx 

i did in linux should work in windows well, if have openssl installed.

run certmgr.msc in windows. right-click 'personal' folder , select 'all tasks' -> 'import...' , choose .pfx file. enter passphrase , import in 'personal' folder.

once that's done, you'll need close running chrome windows. open postman in new window. when attempt connect url, time should ask confirm use of client cert. once confirmed, should able make calls url on.


Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -