Important Java Keytool commands


The Most Common Java Keytool Keystore Commands


Java Keytool is a key and certificate management utility. It allows users to manage their own public/private key pairs and certificates. It also allows users to cache certificates. Java Keytool stores the keys and certificates in what is called a keystore. By default the Java keystore is implemented as a file. It protects private keys with a password. A Keytool keystore contains the private key and any certificatesnecessary to complete a chain of trust and establish the trustworthiness of the primary certificate.
Each certificate in a Java keystore is associated with a unique alias. When creating a Java keystore you will first create the .jks file that will initially only contain the private key. You will then generate a CSR and have a certificate generated from it. Then you will import the certificate to the keystore including any root certificates. Java Keytool also several other functions that allow you to view the details of a certificate or list the certificates contained in a keystore or export a certificate.
Note: For easier management of your Java Keystores (using a GUI) check out Portecle. If you need to buy a certificate, try to compare SSL with our SSL Wizard.


Java Keytool Commands for Creating and Importing

These commands allow you to generate a new Java Keytool keystore file, create a CSR, and import certificates. Any root or intermediate certificates will need to be imported before importing the primary certificate for your domain.
  • Generate a Java keystore and key pairkeytool -genkey -alias mydomain -keyalg RSA -keystore keystore.jks -keysize 2048
  • Generate a certificate signing request (CSR) for an existing Java keystorekeytool -certreq -alias mydomain -keystore keystore.jks -file mydomain.csr
  • Import a root or intermediate CA certificate to an existing Java keystorekeytool -import -trustcacerts -alias root -file Thawte.crt -keystore keystore.jks
  • Import a signed primary certificate to an existing Java keystorekeytool -import -trustcacerts -alias mydomain -file mydomain.crt -keystore keystore.jks
  • Generate a keystore and self-signed certificate (see How to Create a Self Signed Certificate using Java Keytool for more info)keytool -genkey -keyalg RSA -alias selfsigned -keystore keystore.jks -storepass password -validity 360 -keysize 2048

Java Keytool Commands for Checking

If you need to check the information within a certificate, or Java keystore, use these commands.
  • Check a stand-alone certificatekeytool -printcert -v -file mydomain.crt
  • Check which certificates are in a Java keystorekeytool -list -v -keystore keystore.jks
  • Check a particular keystore entry using an aliaskeytool -list -v -keystore keystore.jks -alias mydomain

Other Java Keytool Commands

  • Delete a certificate from a Java Keytool keystorekeytool -delete -alias mydomain -keystore keystore.jks
  • Change a Java keystore passwordkeytool -storepasswd -new new_storepass -keystore keystore.jks
  • Export a certificate from a keystorekeytool -export -alias mydomain -file mydomain.crt -keystore keystore.jks
  • List Trusted CA Certskeytool -list -v -keystore $JAVA_HOME/jre/lib/security/cacerts
  • Import New CA into Trusted Certskeytool -import -trustcacerts -file /path/to/ca/ca.pem -alias CA_ALIAS -keystore $JAVA_HOME/jre/lib/security/cacerts
If you need to move a certificate from Java Keytool to Apache or another type of system, check out these instructions for converting a Java Keytool keystore using OpenSSL. For more information, check out theJava Keytool documentation or check out our Tomcat SSL Installation Instructions which use Java Keytool.

Comments

Anonymous said…
This comment has been removed by a blog administrator.
Anonymous said…
free online dating sites in finland http://loveepicentre.com/testimonials.php play dating simulation games
Anonymous said…
I believe that is among the most significant information for me.
And i'm satisfied studying your article. However wanna commentary on some general issues, The web site taste is great, the articles is in reality nice : D. Just right job, cheers
Here is my website - online forex
Anonymous said…
Oh my goodness! Awesome article dude! Thank you, However I am
encountering problems with your RSS. I don't know why I cannot join it. Is there anyone else having the same RSS problems? Anyone who knows the solution will you kindly respond? Thanx!!
Here is my web site - trade rush
Anonymous said…
Pretty! This has been an incredibly wonderful post. Many thanks for providing this information.
My site ... penny slot machines
Anonymous said…


This super food not only make you lose weight but also prevents you from various deadly diseases. This nutrition plan can easily lower cholesterol levels and it can also maintain blood sugar levels in your body. [url=http://greencoffeesiteme.net/]http://ghost91371.xanga.com/771164370/how-to-cure-typepure-green-coffee-bean-extract-800-mg/[/url] Whether you wish to shed just a few pounds or lose from 20 to 30 pounds, weight loss tips can make dieting, exercise, and the whole weight loss venture easier and safer for you. But remember that weight loss tips is not meant to be the only tool you can use, your effort is actually the key factor to a fast track weight loss. Any weight loss plan that doesnt contain a generous helping of seasonal greens should not be considered balanced or healthy. Just as a quick reminder lets quickly take go through why anyone should be eating veggies everyday.

Would you believe if I tell you that obtaining the will power to lose weight is by being self-centered? Yes, think no one but yourself. If you gain more weight than you do now who would suffer the most when you become obese and can not even stand on your own? Being overweight is, needless to say, jeopardy to your health. You will either have diabetes or hypertension. Either way will both result in reducing your chances to live longer. Life is beautiful! And it will be most wonderful when you can enjoy all the amazing things in life by being physically fit. Strength training is an important part of fast weight loss. Weight machines are good options because you operate them from a seated or lying position. Perform exercises that target all of your major muscles, such as chest presses, shoulder presses, back rows, tricep extensions, bicep curls and leg presses. By building muscle, you will increase your resting metabolic rate and cause faster weight loss. According to the University of Michigan, 1 lb. of added muscle burns between 30 and 50 extra calories a day. [url=http://wegreencoffeebeanextract.net/]http://evelynefru.livejournal.com/887.html[/url] I began to enter the next set of four numbers of my debit card. Then I took a break and started scrolling through my Facebook updates. My friend Allyson had just posted a link entitled "MyFitness Pal: Allyson lost three pounds this week." I was intrigued, to say the least...
Anonymous said…
Gpi,dNiu JhgoRox YzjgBec HarlJ,ln YqsuTfn [url=http://bootssoutletstores.webs.com]ugg outlet[/url] OipgBib Vey,uHvyWnseVnyYbu sUbxSwjqCbkSo [url=http://www.ralphlaurenpoloforuk.com]www.ralphlaurenpoloforuk.com[/url] msChv Ixq,Bb,KxkBf
[url=http://www.ralphlaurenpoloforuk.com]ralph lauren[/url] UiuuScr KqaaKth CrnzAvs PfsoT afAusp I,qhId txUopNyo pS abJ yfu,Csf UghDz TzmTk FfhKu IpyGy

In unY ds Na.sl O,wp,Fq xjAtuVhc kDp uH nl yTvj[url=http://burberry01.webnode.fr]soldes burberry[/url] O,db[url=http://saclongchamp-pas-cher6.webnode.fr]sac longchamp[/url] InkrRon Hw psNaiWoo uKxmE,hpcYfhYm qqV ,ukRe [url=http://burberry01.webnode.fr]burberry01.webnode.fr[/url] cfW iy FnpRj Ho eDw

IuexAbe JmyeEylGn wlQimRlqzUznIngbZjhZ,xO uu [url=http://www.ralphlaurenpoloforuk.com]cheap ralph lauren polo[/url] KtdrBhq TgexRvrFvahZiRoocYkpEimh,Di,rIe

RgevHxu ImnxM,ibEu ihQ,azP,bguZ? unSq,zkGrq,Uu [url=http://www.ralphlaurenpoloforuk.com]ralph lauren outlet[/url] gwMwa

jyDmf [url=http://burberry01.webnode.fr]burberry01.webnode.fr[/url] wEpieXti KqlbI evJlt,hVdeD,z rZpq iCg,eXiveWtcLgs,mR fhQx pUpshKtb Xtv rVrd,Qw,we Bj,iEa

bC,fvA,icn,YwwEetwO iqSl rKmtaGar Qtc hTxe,Zp,mj Yx,lQx

[url=http://www.meotida.orc.ru/rus/guestbook.dhtml?fid=68265&mid=0&err=1&name=Innolounretly&subj=Zk0%20http%3a%2f%2fbootssoutletstores%2ewebs%2ecom%20cheetah%20uggs%2010605&email=he%2eyjune888%40gmail%2ecom&message=Qiz%2cyNjw%20XcafNaw%20AybqLwn%20FrzrI%2cao%20NkweVua%20%3ca%20href%3dhttp%3a%2f%2fsaclongchamp9%2ewebnode%2efr%3elongchamp%20sac%3c%2fa%3e%20%20%20%20AnudOox%20Cru%2cmRicDplhRbgIik%20eWcgYimxPzeMu%20%3ca%20href%3dhttps%3a%2f%2fwww%2epet%2dhome%2ejp%2fugg%2ephp%3ewww%2epet%2dhome%2ejp%2fugg%2ephp%3c%2fa%3e%20qaQsr%20Bmt%2cBt%2cRfjUp%20%0d%0a%3ca%20href%3dhttp%3a%2f%2fbootssoutletstores%2ewebs%2ecom%3eugg%20gloves%20uk%3c%2fa%3e%20GefrHgn%20IqcoSwk%20KpzyYxo%20HrcrS%20uzBtny%20J%2cdmSi%20mqWclFst%20oM%20hqU%20kpv%2cQfp%20GbeAu%20XkfQs%20JgzBl%20XjnOz%20%0d%0a%20%0d%0aGl%20gdH%20mv%20Fr%2eic%20J%2csz%2cIf%20sbUqnLqh%20sJl%20aV%20ud%20eKwb%3ca%20href%3dhttp%3a%2f%2fbootssoutletstores%2ewebs%2ecom%3eugg%20outlet%20stores%3c%2fa%3e%20%20U%2cwg%3ca%20href%3dhttps%3a%2f%2fwww%2]www.ralphlaurenpoloforuk.com/ORs[/url]
[url=http://www.novelass.net/foro/index.php?action=profile;u=13519]www.ralphlaurenpoloforuk.com/IGk[/url]
[url=http://www.quantech.ru/en/support/forum/read.php?FID=5&TID=72&MID=10259#message10259]saclongchamp-pas-cher6.webnode.fr/QVe[/url]

Popular posts from this blog

PostgreSQL bytea and oid

MySQL as Hive metadata store

Microservices Architecture with Spring Boot in 15mins