Public Static voidMain (string[] args)throwsException {String path= "D://111.pfx"; InputStream in=NewFileInputStream (NewFile (path)); Bytearrayoutputstream out=NewBytearrayoutputstream (); KeyStore KeyStore= Keystore.getinstance ("PKCS12"); Keystore.load (In,"111". ToCharArray ()); Keystore.store (out,"111". ToCharArray ()); Base64encoder b=NewBase64encoder (); System.out.println (B.encode (Out.tobytearray ())); }
If you know the alias in PFX, you can also get the private key and the certificate.
Results
miijigibazcccnwgcsqgsib3dqehaacccm0eggjjmiiixtcca1igcsqgsib3dqehaacca0meggm/MIIDOZCCAZCGCYQGSIB3DQEMCGECOIICTJCCARIWHAYKKOZIHVCNAQWBAZAOBAHIPQQRMBCG+QICB9AEGGKQAHOSV1H6DMPTIK61JA5VRKTFTSX5NG4SL/fdck2w501j28w3/WGTCLASQILJDUHMVGIRPP+4/H3MV6PYD150ODOM0EGWNLHPYCGNDPZZXN79YIHTQDTIR9AKIVOA8GJOUSKAEBWXT4VJS4C2ZPXTXY11ZSFFSW+dq/vworujfavnybw+Mxwslynqxc45bfmfnr0vnbqwwf2vvz12zr4hqpiivaud/ynlwplghwc0ivwsuid1wmvyj07zcutp2p+zgxw/2ujeyyadtt2xsn1shm4d8gffpl5otbl1nbh1stwf00clum7vjkjitgq9s/NAVCSJESM0NEF1Z8P2OMZNQUO4MREKVXLZKH3BE7FXX8HNOMDTGZNZNFRK5XS4JEKSSQJZFUYHG+1eevwcdauf+ha7jhnhsvkbyug6ocgo4vmekryeubxiney8qrvks7pehfjtywjugqhvfq1besz9riwgqk1bxjffh88jerazdjw2uc6ytu0g0jdfluyme2mp2rwhynx3hz 9A0A8/xieoctytv4y+cruloe+qjyqt6en7qqsjvi1w5bbmzclpsfjihj9yrqidaqt/4AU2YVQBUSORRYKSNJKGBQZNMTRJIHRCORXN9B50MOSJ0KSMMRDFPBO5JS1N3YZKVOXB0J1W1XTRSUN8YKNP7I8IHTPHUG1QN/gys78keduenfseoz1desz14ngmgdxm1y0zpu6k/WDNAXZBNPOJYGSJVH5B0KKFJ1GZM0K7HWXAFK8ROCW+JZAJNUQKIQRKDFAVF7FA6NHQNB08TVEBF70XOAYPU9UYCOBLLO7DCNFDZZC40NAJTSGA5MUHU4LLSF+Paqejrhtczzjj9vnbwrkmonwj0sixbjbxbgkqhkig9w0bcrqxsh5iagiaoabmadyaoaazadiazqatadiazqaxadialqa0aguamqbhac0aoqayagianaat Adkanwa1adiamaa1adcazga3agyamwa5mbmgcsqgsib3dqejftegbaqbaaaamiifawyjkozihvcnaqcgoiifxdccbvgcaqawggvrbgkqhkig9w0bbwewkaykk OZIHVCNAQWBBJAABBTHDDMGI6ZZNF8I9MNRTHWKEMMFHWICBACAGGUYR4ZG8WAJVW+epwg0jtzf8bg7ndml0javbfli/kiv4band88rfhlki+fxhmthln1soxypwphf6x2x6ac5yfldxin6u6giye032cbeyio2g/Dloudlmvbsywggqrryanp0jnueikmyi9jcynhyir59ocen6ygvakneckzlmqwr6x7pdkxns5nznu+/ydss/Jfijbyfmf4cqcj2e9vsh6qlcqqzyrkonusny8rdmpvbem97nlpnmar6iazedc7ad8hz7enfqnju4oajh9gskofi4u17yjj0hmnrb7otwkbn4yevjcepka IU5IQEAT2PUCPMOQ6ZJDUVUEYKEUCIIBD+5riixgdg6pw+WFOYL1B9X33D6W8JEIMZHFHM5AEGTV4WHXJ+6dkustlwevpl0twvsgxwi5s4ylapyfuwakxgwj6ngrs4guj6qxsz69uzg1jxoys3y4zc4mxynuooa/mbolzhv6n5umri6ami67d6q+nb6qrsmuyffsg8bmzhpukc3suickwdjk5quyplv84d+Eqed1tx8ccey7f7wcbvhzpoy8z3qjlivvtgfj3fcdpxb56upmc1xpogs4lysekp6a2vgt7hy/Pizriv2wm86x3q7ocegkefdydutrv0funtojdfbtvdnfitl2lwd96mzibottgpxyno6u0b6tbx9rixwx8xvqs9tnpdbzstsrqc8vaaso+mjxna1yhkt2zscsortisyp4/kjzhymp5ii2w+MO6VGN3YTVSPATNBQTDHLQH6N0BME1JLQX0B0WTGEE50HSMDCWPZNCC/ldgeo1dv1p+ltf5pbxodvbbfkr2h/n8jyoegl8mztjbipxb7zrpadvb2kxp3aovwt/3l+coqwaj3xpunvd/492yd2czacawqam7nicwzql8wibdgbtuvasotusrxbdtnyhvoz+yr2g63fidc8qy4+y/Nflg4znjlcfzyvbukyzy23g6t6yq+1cvc/0cuw0dfml4ogvf3jnftuwmgla4borq/xvr1iuu/lzutl003fowaosfckbacc4/1IWISynvhrL/vxrqu1sibdekcsfh8bhvg48hpkfyauovymhplodtu09j6vsre9km8wet17u148ai/Mhdjuvwk3lyxgzmwyftty/6cdayw9if/LUOHAVLW23LGCJWBY1YUPKU4HIBKWDBIPSCUQRMKGCWZ2FOEDWXMD8QQD6CAMQZNVBADNAQ2AZFOJ8IOVDMPWCG/fselumd6bzr0sgyb7lx/cvqxmxgsslx5z8pd1ilbcdpbr84q+sgjgtc8cacsbo6aidk/mgfbszfqxy+Blvp804wmqprfkxol3npnjmbtrartpzm94czf79mefdg1diw1gp7jdmywtvfj9hhlchjfgjmmjn03va/o7yf+4q2qrv4ye/jmvzn54b3ze+PB4NL/iyefc3umkpf7vmhh2fxes3ubpqfotdrho++clenewgbaxxwsvp75zgk4w0y/IASUQZQKT4W25BWPFUQJANRCM9CLJJ/htzqxw031s2wtm2haj/8dcdcj1flyqyx6+PFCKQHP4YUMIR9MCCYDMTAT8RHRNN9PO5P3ODHWT+7d3kgw3dqcm4navhvxfwvsszfjbpolpamfvl0f6p6ml0zqsu7uxdhuk+wskwbo2nrtnem4p12xeojwichtagf57/j9xycz+5W6LU6X5R6KYIFS4DOFZWUKV3G9UVE0BNVNQA0WPTAHMAKGBSSOAWIABQAEFL97G3FRHDWJGP+ocrma+Jmeijbsbbslvnfariq1ga0dr2yhu3tzzqpl7qicbaa=
JAVA-PFX file conversion to 16 binary content