sitelink1 http://info.ssl.com/article.aspx?id=12149 
sitelink2  
sitelink3  
sitelink4  
extra_vars5  
extra_vars6  

 

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.

번호 제목 sitelink1 글쓴이 날짜 조회 수
공지 [계속 추가중] SBOM 용어 정의   황제낙엽 2025.04.10 96
공지 [계속 추가중] Keycloak 용어 및 설정 옵션 정의   황제낙엽 2024.02.02 654
58 Spring Authorization Server 관련 포스트 목록과 인프런 강의   황제낙엽 2023.12.07 113
57 [POST/2023.05.22] OAuth 2.1 Authorization Server (Spring Security) 구축 후기 file https://tech.kakaopay.com/post/spring-oa...-practice/  황제낙엽 2023.12.03 162
56 OAuth 와 JWT 내용 정리 (개념 정의 및 적용 전략) file https://seungwoolog.tistory.com/95  황제낙엽 2023.12.03 174
55 [Copilot, Bard] oauth claim 의 의미   황제낙엽 2023.12.02 116
54 [reference links] windows + let's encrypt https://www.win-acme.com/manual/advanced-use/  황제낙엽 2023.03.23 37588
53 WIN-ACME https://www.win-acme.com/  황제낙엽 2022.09.17 122
52 Apache Log4j 2 보안 업데이트 권고 https://www.boho.or.kr/data/secNoticeVie...ence=36389  황제낙엽 2021.12.13 137
51 [Let's Encrypt] certbot 을 이용한 인증서 갱신 실패 기록 https://certbot.eff.org/instructions?ws=other&os=windows  황제낙엽 2021.07.03 149
50 DNS TXT Record 적용 후 조회 명령어 (windows 와 web url)   황제낙엽 2021.07.01 112
49 SSL 인증서 파일 포맷 종류 - crt, cer, csr, pem, der, pfx, p12, jks, key https://www.securesign.kr/guides/kb/54  황제낙엽 2020.07.20 167
48 certbot docker 를 이용한 인증서 발급 및 갱신(Let's Encrypt-DNS를 통해 도메인 인증) file https://lynlab.co.kr/blog/72  황제낙엽 2020.07.14 529
47 Certbot이란 https://lynlab.co.kr/blog/72  황제낙엽 2020.07.14 209
46 Let's Encrypt + Ubuntu 19.10 + Apache 2.4.41 secret https://blogger.pe.kr/824?category=144027  황제낙엽 2020.06.29 1
45 무료 SSL/TLS 인증서 Let's Encrypt(Linux+Apache) secret https://letsencrypt.org/docs/rate-limits/  황제낙엽 2020.04.05 17
44 SNI 기반 HTTPS 사이트 차단 file https://blog.naver.com/aepkoreanet/221465526990  황제낙엽 2020.03.04 172
43 사설인증서 공인인증서 구분 방법 file   황제낙엽 2019.07.16 189
42 Convert Certificate Format SSL 인증서 변환 가이드 https://www.securesign.kr/guides/SSL-Cer...ert-Format  황제낙엽 2019.03.29 200
41 *.key와 *.crt를 PKCS#12(*.pfx, *.p12)로 형식으로 변환하기 https://www.eznbiz.co.kr/help/qna/content/3  황제낙엽 2019.03.29 220
» HOWTO: DER vs. CRT vs. CER vs. PEM Certificates and How To Convert Them http://info.ssl.com/article.aspx?id=12149  황제낙엽 2019.03.29 876
39 How to convert a certificate file from .crt to .cer? file https://www.sonicwall.com/support/knowle...597576961/  황제낙엽 2019.03.29 3280