LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-30-2021, 11:43 AM   #1
JockVSJock
Senior Member
 
Registered: Jan 2004
Posts: 1,420
Blog Entries: 4

Rep: Reputation: 164Reputation: 164
Question Any way to validate a .pem file?


Is there a way to validate a .pem file that was created in a container? This is on RHEL8 (not an container). The container is Nexus.

When trying to validate with openssl command, get the following error:

Code:
[user_a@host_a host_a-nexus.enclave.pem]$ openssl verify host_a-nexus.enclave.pem 
unable to load certificate
139658552366912:error:0909006C:PEM routines:get_name:no start line:crypto/pem/pem_lib.c:745:Expecting: TRUSTED CERTIFICATE
 
Old 09-30-2021, 12:13 PM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,140

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
Pems are used for different functions. The first line of the pem should give the purpose, for example: -----BEGIN CERTIFICATE----- for a cert file. What you get determines how to validate it.

For this cert file, I can unpack it with:

Code:
openssl x509 -in foo.pem -noout -text

Last edited by smallpond; 09-30-2021 at 12:17 PM.
 
Old 09-30-2021, 05:20 PM   #3
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
Once you have successfully decompressed a certificate file into text, as smallpond has demonstrated, you should be able to examine it. What bothers me about your original post is that the software seems to be saying that it cannot find a line of text in the text-version content. Can you perhaps post the actual content, of course cutting-out the Base64 lines of (irrelevant to us) crypto material?
 
Old 10-01-2021, 07:23 AM   #4
JockVSJock
Senior Member
 
Registered: Jan 2004
Posts: 1,420

Original Poster
Blog Entries: 4

Rep: Reputation: 164Reputation: 164
Quote:
Originally Posted by smallpond View Post
Pems are used for different functions. The first line of the pem should give the purpose, for example: -----BEGIN CERTIFICATE----- for a cert file. What you get determines how to validate it.

For this cert file, I can unpack it with:

Code:
openssl x509 -in foo.pem -noout -text
Code:
[user_a@host_a nexus_certs_creation]$ openssl x509 -in host_a.enclave.pem -noout -text
unable to load certificate
140290648704832:error:0909006C:PEM routines:get_name:no start line:crypto/pem/pem_lib.c:745:Expecting: TRUSTED CERTIFICATE
Odd...same error as before with openssl verify command. Is it something in the way I'm generating the cert? There is a "-" character in the alias and file name. Would this make a difference?
 
Old 10-01-2021, 07:25 AM   #5
JockVSJock
Senior Member
 
Registered: Jan 2004
Posts: 1,420

Original Poster
Blog Entries: 4

Rep: Reputation: 164Reputation: 164
Quote:
Originally Posted by sundialsvcs View Post
Can you perhaps post the actual content, of course cutting-out the Base64 lines of (irrelevant to us) crypto material?
I'm no keytool/keystore expert.

Are you referring to the commands that I'm using to generate the .pem file?
 
Old 10-01-2021, 07:51 AM   #6
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,140

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
In a bash shell, I can examine the pem file like this:

Code:
more /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem
# ACCVRAIZ1
-----BEGIN CERTIFICATE-----
MIIH0zCCBbugAwIBAgIIXsO3pkN/pOAwDQYJKoZIhvcNAQEFBQAwQjESMBAGA1UE
AwwJQUNDVlJBSVoxMRAwDgYDVQQLDAdQS0lBQ0NWMQ0wCwYDVQQKDARBQ0NWMQsw

It shows the top line is an optional comment, the second line is the PEM purpose (CERTIFICATE), and the rest is the binary data encoded as text. Can you show the same for your file? You can leave out the binary data.
 
Old 10-04-2021, 01:36 PM   #7
JockVSJock
Senior Member
 
Registered: Jan 2004
Posts: 1,420

Original Poster
Blog Entries: 4

Rep: Reputation: 164Reputation: 164
So I don't have anything above BEGIN NEW CERTIFICATE REQUEST:

Code:
-----BEGIN NEW CERTIFICATE REQUEST-----
***** Binary content here *****
-----END NEW CERTIFICATE REQUEST-----
Is that bad or a problem with the .pem when generating it?

Last edited by JockVSJock; 10-04-2021 at 02:54 PM.
 
  


Reply

Tags
container, pem



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
SSL certificate existing pem file aot2002 Linux - Server 0 10-11-2007 11:48 PM
In courier-imap imapd.pem file is not been able to create manish_2479 Linux - Networking 1 10-03-2007 06:25 PM
qmail-smtpd-auth+requireauth validate any password arnaldostones Linux - Software 0 09-27-2004 11:08 AM
unable to create imapd.pem file manish_2479 Linux - Networking 0 09-13-2004 03:55 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:02 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration