Certificates and Encodings

At its core an X.509 certificate is a digital document that has been encoded and/or digitally signed according to RFC 5280.

In fact, the term X.509 certificate usually refers to the IETF’s PKIX Certificate and CRL Profile of the X.509 v3 certificate standard, as specified in RFC 5280, commonly referred to as PKIX for Public Key Infrastructure (X.509).

X509 File Extensions

The first thing we have to understand is what each type of file extension is.   There is a lot of confusion about what DER, PEM, CRT, and CER are and many have incorrectly said that they are all interchangeable.  While in certain cases some can be interchanged the best practice is to identify how your certificate is encoded and then label it correctly.  Correctly labeled certificates will be much easier to manipulat

Encodings (also used as extensions)

  • .DER = The DER extension is used for binary DER encoded certificates. These files may also bear the CER or the CRT extension.   Proper English usage would be “I have a DER encoded certificate” not “I have a DER certificate”.
  • .PEM = The PEM extension is used for different types of X.509v3 files which contain ASCII (Base64) armored data prefixed with a “—– BEGIN …” line.

Common Extensions

  • .CRT = The CRT extension is used for certificates. The certificates may be encoded as binary DER or as ASCII PEM. The CER and CRT extensions are nearly synonymous.  Most common among *nix systems
  • CER = alternate form of .crt (Microsoft Convention) You can use MS to convert .crt to .cer (.both DER encoded .cer, or base64[PEM] encoded .cer)  The .cer file extension is also recognized by IE as a command to run a MS cryptoAPI command (specifically rundll32.exe cryptext.dll,CryptExtOpenCER) which displays a dialogue for importing and/or viewing certificate contents.
  • .KEY = The KEY extension is used both for public and private PKCS#8 keys. The keys may be encoded as binary DER or as ASCII PEM.

The only time CRT and CER can safely be interchanged is when the encoding type can be identical.  (ie  PEM encoded CRT = PEM encoded CER)

Common OpenSSL Certificate Manipulations

There are four basic types of certificate manipulations. View, Transform, Combination , and Extraction

View

Even though PEM encoded certificates are ASCII they are not human readable.  Here are some commands that will let you output the contents of a certificate in human readable form;

View PEM encoded certificate

Use the command that has the extension of your certificate replacing cert.xxx with the name of your certificate

openssl x509 -in cert.pem -text -noout
openssl x509 -in cert.cer -text -noout
openssl x509 -in cert.crt -text -noout

If you get the folowing error it means that you are trying to view a DER encoded certifciate and need to use the commands in the “View DER encoded certificate  below”

unable to load certificate
12626:error:0906D06C:PEM routines:PEM_read_bio:no start line:pem_lib.c:647:Expecting: TRUSTED CERTIFICATE

View DER encoded Certificate

openssl x509 -in certificate.der -inform der -text -noout

If you get the following error it means that you are trying to view a PEM encoded certificate with a command meant for DER encoded certs. Use a command in the “View PEM encoded certificate above

unable to load certificate
13978:error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag:tasn_dec.c:1306:
13978:error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 error:tasn_dec.c:380:Type=X509

Transform

Transforms can take one type of encoded certificate to another. (ie. PEM To DER conversion)

PEM to DER

openssl x509 -in cert.crt -outform der -out cert.der

DER to PEM

openssl x509 -in cert.crt -inform der -outform pem -out cert.pem

Combination

In some cases it is advantageous to combine multiple pieces of the X.509 infrastructure into a single file.  One common example would be to combine both the private key and public key into the same certificate.

The easiest way to combine certs keys and chains is to convert each to a PEM encoded certificate then simple copy the contents of each file into a new file.   This is suitable for combining files to use in applications like Apache.

Extraction

Some certs will come in a combined form.  Where one file can contain any one of: Certificate, Private Key, Public Key, Signed Certificate, Certificate Authority (CA), and/or Authority Chain.

번호 제목 글쓴이 날짜 조회 수
공지 [계속 추가중] SBOM 용어 정의 황제낙엽 2025.04.10 21564
공지 [계속 추가중] Keycloak 용어 및 설정 옵션 정의 황제낙엽 2024.02.02 20405
146 SPDX 2.3, 계속 써도 되나요? — 3.0으로 넘어갈 때를 판단하는 실무 기준 황제낙엽 2026.08.11 55
145 같은 OSS 지만 여러 버전을 등록해야 하는 경우 황제낙엽 2026.04.24 1972
144 [FOSSLight Dependency Scanner] Android Project 의 Dependency Scan 을 위한 Android SDK 설치와 설정 황제낙엽 2026.04.23 1843
143 FOSSLight Hub 의 REST API 이용 (v2) 황제낙엽 2026.03.19 2500
142 [FOSSLight/검토용] 개발그룹의 sbom-info.yaml 분석 및 피드백 절차 황제낙엽 2026.03.16 1982
141 [FOSSLight/관리용] Project Identification 진행에서 최종 SBOM SPDX 문서 추출 황제낙엽 2026.02.09 1917
140 [FOSSLight] 'Download Location' 컬럼 값에 'Different from DB' 라는 푸른색 메세지가 출력 file 황제낙엽 2026.02.06 3613
139 [FOSSLight] Project Identification 진행시의 신규 OSS 등록 처리 방법 황제낙엽 2026.02.06 3750
138 [FOSSLight Hub] License 정보를 직접 등록시 필요한 항목 목록 황제낙엽 2026.02.06 3579
137 [FOSSLight Hub] Open Source 정보를 직접 등록시 필요한 항목 목록 황제낙엽 2026.02.06 3352
136 [OSS] Microsoft.Web.WebView2 황제낙엽 2026.02.06 3352
135 [FOSSLight] fosslight 프로젝트의 'Pre-Review' > 'Open Source' 팝업창의 세 버튼에 대한 용도 황제낙엽 2026.02.06 3572
134 [FOSSLight/검토용] prechecker convert 결과 Hub 등록후 Identification 처리 file 황제낙엽 2026.02.05 3289
133 python venv 설치, fosslight source scanner , binary scanner 설치, 버전 확인 황제낙엽 2026.02.02 3508
132 SPDX 템플릿 다운로드 및 온라인 변환기 황제낙엽 2026.01.22 3870
131 SBOM(Software Bill of Materials) 및 소프트웨어 공급망 보안 관련 주요 정부 기관 및 단체 황제낙엽 2026.01.22 3605
130 [FOSSLight] online guide link 황제낙엽 2026.01.14 1844
129 identification 에서 출력하는 warning, error 메세지 황제낙엽 2025.12.29 1427
128 sbom-info.yaml 을 이용한 dependency scan excel 작성 file 황제낙엽 2025.12.29 3578
127 binary scan 결과물에 대해 취약점이 없는데 왜 SBOM에 넣어야 하나? 황제낙엽 2025.12.17 3484