Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8366609
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:57:24+00:00 2026-06-09T12:57:24+00:00

is there a way to read the common name from a .pem file in

  • 0

is there a way to read the common name from a .pem file in my shell?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T12:57:26+00:00Added an answer on June 9, 2026 at 12:57 pm

    First off, the .pem extension only refers to the type of encoding used in the file.

    The common name would be a feature of the Subject or Issuer of a certificate, and can be recognised by the lines

    $ grep CERTIFICATE f.pem
    -----BEGIN CERTIFICATE-----
    -----END CERTIFICATE-----
    

    and lots of base64 encoded text in between.

    If the .pem file contains an x509 certificate,
    this should do the trick:

    openssl x509 -in cacert.pem -noout -text
    

    This will dump the whole certificate. The openssl x509
    command has several options to suppress the fields you don’t want to see. You find those explained in the man page, under TEXT OPTIONS

    You can also choose to get shown just the ‘Subject’ of the certificate:

    openssl x509 -in cacert.pem -noout -subject
    

    Example:

    Let’s capture the certificate of stackoverflow.com straight from the server

    $ : | openssl s_client -connect stackoverflow.com:443 > f.pem 2>& 1 &&
          openssl x509 -in f.pem -noout -subject 2>& 1
    

    Outputs:

    Subject: CN = *.stackexchange.com
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way to read off from an [external] xml (an xml file
Is there any way to read whole lines from a socket in Erlang, or
Is there any way to read a file using sharpsvn................
Is there any way to read a TIFF file using AIR ? Looks like
Is there any way to read a file line by line in javascript, specifically
In C#/.NET (on Windows) is there a way to read a growing file using
On a Windows PC, is there a way to read the raw bytes from
Since there is currently no universal way to read live data from an audio
Is there a way to read a ByteBuffer with a BufferedReader without having to
Is there any way to read the asp.net Import directives at runtime? I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.