Search This Blog

Wednesday, October 17, 2012

How to check certificate validity using keytool command

keytool -list -v -keystore $WLSDOMAIN/certs/appTrustKeyStore.jks -storepass <<password>> | egrep "Alias|Valid"

Other Useful commands:
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

11 comments:

  1. excellent...thanks

    ReplyDelete
    Replies
    1. My Work: How To Check Certificate Validity Using Keytool Command >>>>> Download Now

      >>>>> Download Full

      My Work: How To Check Certificate Validity Using Keytool Command >>>>> Download LINK

      >>>>> Download Now

      My Work: How To Check Certificate Validity Using Keytool Command >>>>> Download Full

      >>>>> Download LINK ub

      Delete
  2. I generated a self signed cert using: keytool -genkey -noprompt -keyalg RSA -alias myinstance -validity 180 -keystore -storepass -keypass -dname CN=hostname

    However, when i use the command you suggested, keytool -list -v -keystore -storepass <> | egrep "Alias|Valid" it doesn't display anything.

    Am I missing something?

    ReplyDelete
    Replies
    1. Never mind. Figured it out.
      keytool -list -v prints the validity of the certs in verbose mode.

      Delete
  3. How to renew the validity of the self-signed certificate ? Kindly share the steps or commands,
    Thank you

    ReplyDelete
  4. You should really credit the source for this information, since you copied it verbatim from here:

    https://www.sslshopper.com/article-most-common-java-keytool-keystore-commands.html

    ReplyDelete
  5. Steve Porcaro, Steve Porcaro, Steve Porcaro, and the History Behind
    The band's most recent titanium trim hair cutter reviews album, “The Last gold titanium alloy Tour,” was released on November 16, 2015 at microtouch titanium trim the Wynn gr5 titanium Las titanium wood stoves Vegas. Porcaro, Steve Porcaro, and the History Behind it,

    ReplyDelete
  6. My Work: How To Check Certificate Validity Using Keytool Command >>>>> Download Now

    >>>>> Download Full

    My Work: How To Check Certificate Validity Using Keytool Command >>>>> Download LINK

    >>>>> Download Now

    My Work: How To Check Certificate Validity Using Keytool Command >>>>> Download Full

    >>>>> Download LINK

    ReplyDelete