How to utilize keytool programmatically?

淺唱寂寞╮ 提交于 2019-12-10 10:51:17

问题


It seems to me that there are hardly any good tools out there that help webapp deployers secure their environment. I feel like a lot of deployment grief comes in because the admin hasn't been properly tooled to ignore the intricacies and of TLS/SSL. I once had the good luck of seeing a really good UI management that was intuitive, for an admin of any level, in either websphere or weblogic (i forget) but nothing like that is available today out in the open source community. I would like to put together something for tomcat one day so I'm experimenting and trying to figure out how "not to re-invent" the wheel but it just seems like I can't get my hands on the source code for keytool ... and the class itself is final I think ... so extending it would be out of the question. Does anyone know why SUN made it so hard to do good and intutive security?

Real Question: Are there ways that you know of where someone can programmatically utilize keytool to its fullest?


回答1:


You can use java's KeyStore api to do what keytool does, programmatically. Over the years both the KeyStore api and keytool command line tool have evolved. You can refer to the KeyStore api docs here:

Java 7 KeyStore

Java 8 KeyStore

Java 9 KeyStore

If you are curious on how keytool does it, a quick google search yielded this link, which contains its code.



来源:https://stackoverflow.com/questions/5051195/how-to-utilize-keytool-programmatically

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!