• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer

Mister PKI

SSL Certificates * SSL Tools * Certificate Decoder

  • PKI Training
  • OpenSSL
  • Keytool
  • PKI Tools
    • Apereo CAS
    • SAML
    • OpenID Connect
  • Get expert help

keytool printcert – How to print a certificate with Java keytool

February 11, 2020 by Mister PKI Leave a Comment

What is Java keytool?

The Java keytool is a command-line utility used to manage keystores in different formats containing keys and certificates. You can use the java keytool printcert command to print and view a certificate on a server or in a file. In many respects, the java keytool is a competing utility with openssl for keystore, key, and certificate management.

Why use the Java keytool to print certs (keytool -printcert), print CRLs (keytool -printcrl), or print CSRs (keytool -printcsr)?

You may want to print a certificate to see the PEM encoding in a human-readable format. The same for a certificate signing request or certificate revocation list. You may also wish to view the chain of certificates be returned on a server in which case you will use the -sslserver option.

What keytool command do I use to print a certificate in PEM format?

Use this command to print a certificate from a file:

keytool -printcert \
> -rfc \
> -file example.crt \
> -v

Use this command to print a certificate from a server:

keytool -printcert \
> -rfc \
> -sslserver example.com:443 \
> -v

-rfc – Print the certificate in PEM format.

-file – The filename of the certificate. Note that -file and -sslserver are to be used separately and not in the same command.

-sslserver – The host and port of the server. Note that -file and -sslserver are to be used separately and not in the same command.

-v – Verbose.

keytool printcert
keytool printcert

What keytool command do I use to print a Certificate Signing Request (CSR)?

keytool -printcertreq \
> -file example.csr \
> -v

See the above options section for a description of each flag.

What keytool command do I use to print a Certificate Revocation List (CRL)?

keytool -printcrl \
> -file example.crl \
> -v

See the above options section for a description of each flag.

Here are the official keytool docs to dive further into how to print a certificate, print a Certificate Revocation List or CRL, or print a Certificate Signing Request or CSR with java keytool. https://docs.oracle.com/javase/10/tools/keytool.htm#GUID-5990A2E4-78E3-47B7-AE75-6D1826259549__DISPLAYDATA-507D2B01

Read all of our blog content.

keytool

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Popular Posts

PKCS12

openssl s_client

Keytool

Keytool list

ECDSA vs RSA

OpenSSL

PKCS7

Certificate Decoder

PKI for DevOps Engineers – Free Training Series

PKI for DevOps Training Hub

Lesson 1 – How TLS and PKI Work

Lesson 2 – Understanding X.509 Certificates

Lesson 3 – Certificate Chains Explained

Lesson 4 – Debug TLS with OpenSSL

Lesson 5 – Verify Certificate Chains

Lesson 6 – Creating CSRs with OpenSSL

Lesson 7 – Working with PKCS12 Certificates

Lesson 8 – Java Keystores and keytool

Lesson 9 – Certificate Expiration Monitoring

Lesson 10 – Automating Certificate Renewal

Lesson 11 – Common TLS Errors

Lesson 12 – PKI Architecture for DevOps

Recent Posts

  • Apache mod_auth_cas: Protect Web Applications with Apereo CAS and Docker
  • Apache mod_auth_mellon: Configure SAML SSO & Docker
  • Configure OpenID Connect (OIDC) in Apereo CAS 7.3 and 8
  • Certificate Ownership Is an Operating Model Problem, Not a Tooling Problem
  • OpenSSL dgst: Create Checksums and Verify Digital Signatures

Footer

  • Twitter
  • YouTube
Mister PKI

Practical security engineering for the systems that establish trust.

Learn OpenSSL Keytool Free training
Work together PKI consulting CAS consulting Sponsored contributions
Site About Support Mister PKI Cookie policy Search
© 2026 Mister PKI Secure systems. Clear guidance.