PKI(Public Key Infrastructure)
μ 보보μ μ λ¬Έκ°μ μμ€μ μλμ§λΌλ μΉ μ ν리μΌμ΄μ μμ μ¬μ©λλ 보μ κΈ°μ μ λν΄μ μ΄λμ λ μ΄ν΄νκ³ μμ΄μΌν©λλ€. μ΄ κΈμ SSL μΈμ¦μμ Mutual TLSμμ μΈκΈνκ±°λ λ€λ£¨μ΄λ³Έ X.509 μΈμ¦μμ ν¨κ» 곡κ°ν€ κΈ°λ° μΈμ¦ ꡬ쑰λΌκ³ νλ PKIμ κ΄λ ¨λ μ©μ΄μ κ°λ μ λν΄μ κ°λ¨νκ² μμλ΄ λλ€.
X.509 Certificate
A public key infrastructure (PKI) is a set of roles, policies, hardware, software and procedures needed to create, manage, distribute, use, store and revoke digital certificates and manage public-key encryption.
X.509λ RFC5280λ‘ μ μλμ΄μλ λμ§νΈ μΈμ¦μ(곡κ°ν€ μΈμ¦μ)μ νμ€ νμμ λλ€. λλΆλΆμ μΉ μ ν리μΌμ΄μ μ μ μ©νλ HTTPS νλ‘ν μ½μμ TLS νΈλμμ΄ν¬λ₯Ό μν΄μ μ¬μ©λλ κ°μ₯ μΌλ°μ μΈ μΈμ¦μ νμμ΄κΈ°λ νλ―μ΄ μ μΈκ³μ μΌλ‘ λμ§νΈ μΈμ¦μλΌ ν¨μ ITU-T X.509 νμ€ λ°©μμΌλ‘ μμ±λ X.509 μΈμ¦μλΌκ³ ν μ μμ΅λλ€. κ΅λ΄μμ μ¬μ©λλ 곡λμΈμ¦μ(곡μΈμΈμ¦μ)λ 곡κ°ν€ κΈ°λ° μΈμ¦ κΈ°μ μ νμ©ν΄μ λ§λ λμ§νΈ μΈμ¦μμ΄μ§λ§ νκ΅μμλ§ μ¬μ©ν μ μλ μΈμ¦μ νμμ΄λΌλ μ μ λλ€.
ubuntu@ubuntu:~/x509$ openssl x509 -in local.dev+1.pem -text -noout
Certificate:
Data:
Version: 3 (0x2)
Serial Number:
e5:29:9a:ba:66:...
Signature Algorithm: sha256WithRSAEncryption
Issuer: O = mkcert development CA, OU = ubuntu@ubuntu, CN = mkcert ubuntu@ubuntu
Validity
Not Before: Jul 12 21:55:43 2022 GMT
Not After : Oct 12 21:55:43 2024 GMT
Subject: O = mkcert development certificate, OU = ubuntu@ubuntu
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
RSA Public-Key: (2048 bit)
Modulus:
00:d8:c2:77:4f:4f:9d:1c:c2:70:b2:00:52:4f:e7:
...
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Key Usage: critical
Digital Signature, Key Encipherment
X509v3 Extended Key Usage:
TLS Web Server Authentication
X509v3 Authority Key Identifier:
keyid:3B:31:5D:2F:7C:D6:E6:E2:F5:9B:66:1D:E5:75:5C:11:C6:85:8C:6D
X509v3 Subject Alternative Name:
DNS:local.dev, DNS:localhost
Signature Algorithm: sha256WithRSAEncryption
43:e1:81:18:d5:04:ca:d4:73:68:85:4d:1d:d4:79:cb:02:0d:
...
μ μμλ λ‘컬 νΈμ€νΈμμ μ¬μ©ν μ μλ μ¬μ€ μΈμ¦μλ₯Ό λ§λλ μ€νμμ€ λκ΅¬μΈ mkcertλ₯Ό ν΅ν΄ λ§λ€μ΄μ§ X.509 μΈμ¦μμ λν μ 보λ₯Ό openssl λκ΅¬λ‘ μΈμ¦μμ ν¬ν¨λ μ 보λ₯Ό νμΈν΄λ³Έ κ²μ λλ€. μΈμ¦μμ ν¬ν¨λ μ μλ νλλ€μ RFC5280 λ¬Έμμ μ€λͺ λμ΄μλλ° λ°κΈμ(Issuer), μλͺ μκ³ λ¦¬μ¦(Signature Algorithm), μμ μ(Subject), μμ μμ 곡κ°ν€(Subject Public Key Info) κ·Έλ¦¬κ³ μ μμ νμΈν μ μλ λΆκ° μ 보(Extensions)μ λλ€.
HTTPS νλ‘ν μ½ ν΅μ μμ TLS νΈλμμ΄νΉ κ³Όμ μ€ ν΄λΌμ΄μΈνΈλ μλ²μμ μ 곡ν X.509 μΈμ¦μ μ 보λ₯Ό νμΈνμ¬ λΆκ° μ 보 μ€ SAN(X509v3 Subject Alternative Name)μ μ λ ₯λ μ 보λ₯Ό ν λλ‘ λΈλΌμ°μ μμ λλ©μΈμ΄λ IP μ£Όμμ λν μ μμ μΆκ°μ μΌλ‘ κ²μ¦ν©λλ€. μλ₯Ό λ€μ΄, μ μμμμλ localhostμ local.devλΌλ νΈμ€νΈλ₯Ό μ λ’°ν μ μλ€κ³ νλ¨ν μ μμ΅λλ€.
X.509 μΈμ¦μλ μμ κΈ°κ΄μμ μμ μμ 곡κ°ν€λ₯Ό μ μμλͺ ν κ²μΌλ‘ μνΈνκ° λͺ©μ μ΄ μλ 곡κ°ν€μ λν μμ μμ μ μμ κ²μ¦νκ³ μ ν¨μ μμ΅λλ€.
PEM Format
ubuntu@ubuntu:~/x509$ openssl x509 -in local.dev+1.pem
-----BEGIN CERTIFICATE-----
MIIEDDCCAnSgAwIBAgIRAOUpmrpmzWKOajX3U1ze1McwDQYJKoZIhvcNAQELBQAw
VzEeMBwGA1UEChMVbWtjZXJ0IGRldmVsb3BtZW50IENBMRYwFAYDVQQLDA11YnVu
dHVAdWJ1bnR1MR0wGwYDVQQDDBRta2NlcnQgdWJ1bnR1QHVidW50dTAeFw0yMjA3
MTIyMTU1NDNaFw0yNDEwMTIyMTU1NDNaMEExJzAlBgNVBAoTHm1rY2VydCBkZXZl
bG9wbWVudCBjZXJ0aWZpY2F0ZTEWMBQGA1UECwwNdWJ1bnR1QHVidW50dTCCASIw
DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANjCd09PnRzCcLIAUk/nr27i2uvz
tXSF1vbwUby3dPWQcZuR3cLRvIeNv6oOMLnf9uGbI/pjlRcCoZwk+ETUZtVrsFsv
NZGCir34QbXkNb96/M8HSM3ZC9soeijU8NqoWDjr4LGtU+FX8pOOHbsjJoiyIH7l
g76EpOUrasnVmx6T8xoUlye2si0A+VbV/J6tlJXKix0qidliIiBIY2HWktN+HBIY
bttuRwXOK22i7KPwT/jURgZlcAq5Lmfu9+pTs5ak2jXSaneWLkKF0/9RxMy2jGKf
dTwYqU4ZjbZz1zXs+UeI7hgsPqprhnVBkDAejNrXNJ1O390IbwtgboJ/V6cCAwEA
AaNpMGcwDgYDVR0PAQH/BAQDAgWgMBMGA1UdJQQMMAoGCCsGAQUFBwMBMB8GA1Ud
IwQYMBaAFDsxXS981ubi9ZtmHeV1XBHGhYxtMB8GA1UdEQQYMBaCCWxvY2FsLmRl
doIJbG9jYWxob3N0MA0GCSqGSIb3DQEBCwUAA4IBgQBD4YEY1QTK1HNohU0d1HnL
Ag3Pm9bUJxGWw2bOAO+0Dgdau3Fn+72JPz7ZYGX3Deny01TYDEoeno7VOY+gq2u0
F4L1SBNWdXhdxxfj/4JK3r1FpmgmEpPOVyrO2KMWgPlNu4JV8jUc/OIOeKYe8S9V
ddM7VyRjZSCNKsI4kneeu/fZFXLMtWS8lcj/hubQdGYXuSaSZHihpTPvCR2XP6z+
NbeDndqo4YemGIUS2eyp4MQCwlR910FUv3NNgk43iJw368ma8p/jigQeUx9reyYK
ijxd/rbwmg9k5Mks+CgK7pi0Bd8uJxD5i9KgitDBetjoPbw8xIazDUbhtPofs3y8
HTGqR4kszm4JZMh0310Ff3hkqjXwT1oVEMrBUUUZrSBjuUEy7bujgu1JBV1f/j5l
LzS5dMOM68x7my7YVSUG+hbjeB9w9eZWLx/YZ707ssvAfKVvWoyKrwwlZTQRs7mI
HRcM9stz0/k/ZQZH0IBerjuPJ93BKH0wRYxU33i3htQ=
-----END CERTIFICATE-----
μ κ²°κ³Όλ X.509 μΈμ¦μκ° μ€μ λ‘ νμΌμ μ μ₯λ ννλ₯Ό 보μ¬μ£Όκ³ μμ΅λλ€. μ΄μ κ°μ΄ ꡬμ±λλ λ°©μμ PEM(Privacy Enhanced Mail)μ΄λΌκ³ νλλ° X.509 μΈμ¦μλ₯Ό μ μ₯νλ κ°μ₯ μΌλ°μ μΈ νμμ λλ€. λ°μ΄λ리 λ°μ΄ν°λ‘ μ μ₯λλ DER(Distinguished Encoding Representation)λ‘λ μ μ₯ν μ μμΌλ μμ€ν κ° μμ νκ² μ λ¬λ μ μλλ‘ Base64λ‘ μΈμ½λ©λμ΄ μμ€ν€ μ½λννλ‘ λμ΄μλ PEM νμμ΄ μ νΈλλ κ² κ°μ΅λλ€.
Certificate Profiles
ubuntu@ubuntu:~/x509$ openssl s_client -showcerts -connect naver.com:443 </dev/null
ubuntu@ubuntu:~/x509$ openssl x509 -in naver.com.pem -text -noout
Certificate:
Data:
Version: 3 (0x2)
Serial Number:
07:f2:85:21:53:b1:50:67:e3:c6:77:aa:3a:83:be:dd
Signature Algorithm: sha256WithRSAEncryption
Issuer: C = US, O = DigiCert Inc, CN = DigiCert TLS RSA SHA256 2020 CA1
Validity
Not Before: May 23 00:00:00 2022 GMT
Not After : Jun 7 23:59:59 2023 GMT
Subject: C = KR, ST = Gyeonggi-do, L = Seongnam-si, O = NAVER Corp., CN = www.naver.net
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
RSA Public-Key: (2048 bit)
Modulus:
00...
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Authority Key Identifier:
keyid:B7:6B:A2:EA:A8:AA:84:8C:79:EA:B4:DA:0F:98:B2:C5:95:76:B9:F4
X509v3 Subject Key Identifier:
F5:3C:13:14:C9:7B:15:36:50:8C:3E:89:40:EE:2C:E0:22:2F:9E:61
X509v3 Subject Alternative Name:
DNS:www.naver.net, DNS:www.naver.asia, DNS:www.naver.co, DNS:www.naver.kr, DNS:www.naver.co.kr, DNS:naver.com, DNS:naver.net, DNS:naver.asia, DNS:naver.co, DNS:naver.kr, DNS:naver.co.kr
X509v3 Key Usage: critical
Digital Signature, Key Encipherment
X509v3 Extended Key Usage:
TLS Web Server Authentication, TLS Web Client Authentication
X509v3 CRL Distribution Points:
Full Name:
URI:http://crl3.digicert.com/DigiCertTLSRSASHA2562020CA1-4.crl
Full Name:
URI:http://crl4.digicert.com/DigiCertTLSRSASHA2562020CA1-4.crl
X509v3 Certificate Policies:
Policy: 2.23.140.1.2.2
CPS: http://www.digicert.com/CPS
Authority Information Access:
OCSP - URI:http://ocsp.digicert.com
CA Issuers - URI:http://cacerts.digicert.com/DigiCertTLSRSASHA2562020CA1-1.crt
...
Signature Algorithm: sha256WithRSAEncryption
2e...
λ€μ΄λ² μ¬μ΄νΈμ μλ² μΈμ¦μλ₯Ό μ λ¬λ°μ ν X.509 μΈμ¦μ μ 보λ₯Ό μ‘°νν΄λ³΄λ©΄ λ€μ΄λ²μ μΈμ¦μλ₯Ό λ°κΈν κΈ°κ΄μ DigiCert μ΄λ©° λ€μ΄λ² μΈμ¦μμ ν¬ν¨λλ 곡κ°ν€λ₯Ό sha256WithRSAEncryption μλͺ μκ³ λ¦¬μ¦μ μ¬μ©ν΄μ μ μ μλͺ μ ν κ²μ νμΈν μ μμ΅λλ€.
- μΈμ¦μ λ°κΈ κΈ°κ΄(Issuer)
- μΈμ¦μ λ§λ£ κΈ°ν(Validity)
- 곡κ°ν€ μμ μ(Subject)
- 곡κ°ν€(Subject Public Key Info)
- μλͺ μκ³ λ¦¬μ¦(Signature Algorithm)
- μμ μ λ체 μ΄λ¦(Subject Alternative Name)
PKCS
PKCS(Public key Cryptography Standard)λ 곡κ°ν€ κΈ°λ° μΈμ¦ ꡬ쑰μμ μμ νκ² μ 보λ₯Ό κ΅ννκΈ° μν νλ‘ν μ½μ λλ€.
PKCS#8
RFC5208λ‘ μ μλ PKCS#8μ 곡κ°ν€ κΈ°λ° μΈμ¦ ꡬ쑰μμ μ¬μ©λλ κ°μΈν€λ₯Ό νννκ³ μ μ₯νκΈ° μν νμ€μΌλ‘ μμ X.509 μΈμ¦μμ κ°μ΄ PEM νμμΌλ‘ μ μ₯ν©λλ€. μ§λ Mutual TLSμμλ μλ° μ ν리μΌμ΄μ μμ PEM νμμ ν΄λΌμ΄μΈνΈ μΈμ¦μμ κ°μΈν€λ₯Ό ν΅ν΄ ν€ μ€ν μ΄λ₯Ό λ§λλ κ³Όμ μμ PKCS8EncodedKeySpec μ΄λ κ²μ μ¬μ©νλ€λ κ²μ μ μ μμ΅λλ€.
ubuntu@ubuntu:~/x509$ openssl pkey -in local.dev+1-key.pem
-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDYwndPT50cwnCy
AFJP569u4trr87V0hdb28FG8t3T1kHGbkd3C0byHjb+qDjC53/bhmyP6Y5UXAqGc
JPhE1GbVa7BbLzWRgoq9+EG15DW/evzPB0jN2QvbKHoo1PDaqFg46+CxrVPhV/KT
jh27IyaIsiB+5YO+hKTlK2rJ1Zsek/MaFJcntrItAPlW1fyerZSVyosdKonZYiIg
SGNh1pLTfhwSGG7bbkcFzittouyj8E/41EYGZXAKuS5n7vfqU7OWpNo10mp3li5C
hdP/UcTMtoxin3U8GKlOGY22c9c17PlHiO4YLD6qa4Z1QZAwHoza1zSdTt/dCG8L
YG6Cf1enAgMBAAECggEAIehp2ZJOtY0FLBM4zR8lJmd+b6K0JAI72m1FnAvm0/NA
kmGDG1LL9ziJXwTRQoJykGBAhI7HZ84VkeOGot3HKGOsNtdvvc95/LW1Mcr9TXLj
0U8GaI0neaUfVvvYoZvsERt1DtZaZMnpPIPiyr9467FRvAgTT95YHTFphyFPHr0k
VlAd4qAbyIzOSiGmoBg2Krjk5dXW9Cg7YIxKNUXlxMHNlP3c9zxKyy7Cd3qcp4tF
zKxqiTXPEdOxw3b66P/2+RQWi6kCQfu2RINZLjzPBajjEYJ8/o8sVXDs1Bl6pPnp
YzMLjHapX8V+NuuG8r9O8Y28siO0NT+tpVnyJHUE4QKBgQDdTb7KJySyUYk+xySC
Pv3lpBucfnJDy7veWNdiu4KIMVtqnenPJATVE9ovdWFNNrr+1cLJG/uvM3AOSTLH
JRXHcFewm2ipxovgr6SKx65zevHbbVMcaDir3hdvh6h7qG/naURQlNz1xups68g8
9xvbBnFp/X4fTDto+QQUIR5hRQKBgQD6vlcYJUcG7rr6nOEacUtxvhE59qX5sWDC
AvrfP/IUjitsqiH9YRTkuUfYQXGQMMfpXCViZ/UVQEsiI4LMY3wM4pquWplZVn9C
eyrbgZn/QP2Bp1nExmL21HWGooBG6l2lxGM18lMIzY7vE5GMzGGkH8rRHqgkIAku
TIC5G/sl+wKBgQCGvXUyY87F+zrSzDEAVBYGIXrmN16exIaoA/Nvm7cH8PU13tui
UM3YZfPr/U2202HbEo88HxuIOos5R3vxIDU4bsAVOSnqZIZ50LcgAB/JE8v5y4BU
xWfrzJb8Qt5kG9O2U7NSVLCLvAazNoN+Cv4cxrl6zOpjZ+isKyE+mEOE+QKBgQC5
M1l09iOuFSp57OG+/CtzSaXDoFAbS05iPn055CtTz2Z3jnoogkpCXi+YpU3R6JXf
4TWjp5E4LxLPllcHy/tWMRF68mQNvnukiQCwvNsX09Lqrsb5NmbmVSqxVNlWh8i/
pXx53hBCkkGeiF+bFWKRLQJKz0/1zsu5LLxu/SHVfQKBgGuldPS/1zqt1eblPAeo
bBot1LMCxS8Bk6n1dMiWDM0+yANwh+tkA+MFyZTbdPjjf2e+RAXwUtsKLSvJha0E
XLEZPSQL7WDIleYVJ5oAX4nfHS4eNZzvxnL7bblcWtekrBNnHinKS+Cqd+ATLixL
nDpi0w+DTfQu93eKXg1NCYrg
-----END PRIVATE KEY-----
ubuntu@ubuntu:~/x509$ openssl pkey -in local.dev+1-key.pem -text -noout
RSA Private-Key: (2048 bit, 2 primes)
modulus:
00...
...
PKCS#12
RFC7292λ‘ μ μλ PKCS#12λ μΈμ¦μμ κ°μΈν€ λ± κ³΅κ°ν€ κΈ°λ° μΈμ¦ ꡬ쑰μμ μ¬μ©λλ λ€μν νλͺ©λ€μ νλλ‘ ν΅ν©νμ¬ κ΅ννκΈ° μν μ 보 κ΅νμ νμ€μ λλ€.
ubuntu@ubuntu:~/x509$ openssl pkcs12 -in local.dev+1.pkcs12
Enter Import Password: mambo
Bag Attributes
localKeyID: 16 CC 2D CE 9F D0 52 C9 72 97 90 DC EC AB DF 28 0B EA B6 AA
subject=O = mkcert development certificate, OU = ubuntu@ubuntu
issuer=O = mkcert development CA, OU = ubuntu@ubuntu, CN = mkcert ubuntu@ubuntu
-----BEGIN CERTIFICATE-----
MIIEDDCCAnSgAwIBAgIRAOUpmrpmzWKOajX3U1ze1McwDQYJKoZIhvcNAQELBQAw
VzEeMBwGA1UEChMVbWtjZXJ0IGRldmVsb3BtZW50IENBMRYwFAYDVQQLDA11YnVu
dHVAdWJ1bnR1MR0wGwYDVQQDDBRta2NlcnQgdWJ1bnR1QHVidW50dTAeFw0yMjA3
MTIyMTU1NDNaFw0yNDEwMTIyMTU1NDNaMEExJzAlBgNVBAoTHm1rY2VydCBkZXZl
bG9wbWVudCBjZXJ0aWZpY2F0ZTEWMBQGA1UECwwNdWJ1bnR1QHVidW50dTCCASIw
DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANjCd09PnRzCcLIAUk/nr27i2uvz
tXSF1vbwUby3dPWQcZuR3cLRvIeNv6oOMLnf9uGbI/pjlRcCoZwk+ETUZtVrsFsv
NZGCir34QbXkNb96/M8HSM3ZC9soeijU8NqoWDjr4LGtU+FX8pOOHbsjJoiyIH7l
g76EpOUrasnVmx6T8xoUlye2si0A+VbV/J6tlJXKix0qidliIiBIY2HWktN+HBIY
bttuRwXOK22i7KPwT/jURgZlcAq5Lmfu9+pTs5ak2jXSaneWLkKF0/9RxMy2jGKf
dTwYqU4ZjbZz1zXs+UeI7hgsPqprhnVBkDAejNrXNJ1O390IbwtgboJ/V6cCAwEA
AaNpMGcwDgYDVR0PAQH/BAQDAgWgMBMGA1UdJQQMMAoGCCsGAQUFBwMBMB8GA1Ud
IwQYMBaAFDsxXS981ubi9ZtmHeV1XBHGhYxtMB8GA1UdEQQYMBaCCWxvY2FsLmRl
doIJbG9jYWxob3N0MA0GCSqGSIb3DQEBCwUAA4IBgQBD4YEY1QTK1HNohU0d1HnL
Ag3Pm9bUJxGWw2bOAO+0Dgdau3Fn+72JPz7ZYGX3Deny01TYDEoeno7VOY+gq2u0
F4L1SBNWdXhdxxfj/4JK3r1FpmgmEpPOVyrO2KMWgPlNu4JV8jUc/OIOeKYe8S9V
ddM7VyRjZSCNKsI4kneeu/fZFXLMtWS8lcj/hubQdGYXuSaSZHihpTPvCR2XP6z+
NbeDndqo4YemGIUS2eyp4MQCwlR910FUv3NNgk43iJw368ma8p/jigQeUx9reyYK
ijxd/rbwmg9k5Mks+CgK7pi0Bd8uJxD5i9KgitDBetjoPbw8xIazDUbhtPofs3y8
HTGqR4kszm4JZMh0310Ff3hkqjXwT1oVEMrBUUUZrSBjuUEy7bujgu1JBV1f/j5l
LzS5dMOM68x7my7YVSUG+hbjeB9w9eZWLx/YZ707ssvAfKVvWoyKrwwlZTQRs7mI
HRcM9stz0/k/ZQZH0IBerjuPJ93BKH0wRYxU33i3htQ=
-----END CERTIFICATE-----
Bag Attributes
localKeyID: 16 CC 2D CE 9F D0 52 C9 72 97 90 DC EC AB DF 28 0B EA B6 AA
Key Attributes: <No Attributes>
Enter PEM pass phrase: mambo
Verifying - Enter PEM pass phrase: mambo
-----BEGIN ENCRYPTED PRIVATE KEY-----
MIIFHDBOBgkqhkiG9w0BBQ0wQTApBgkqhkiG9w0BBQwwHAQIUCWpIEy8DAECAggA
MAwGCCqGSIb3DQIJBQAwFAYIKoZIhvcNAwcECAwP9e11T4W6BIIEyP1XL6GHaVmq
cgu+jiWoeopRciYOLS0MWB8Yzb/8Rslyx1l1MAluW+QP30qCbVhhO6l7ulziGC0h
RNNNittmdSrZKPbNtch8ZY0G/dWoMY9VfjJSdndbWwXv8zulRXMYiXeVME8MsmG5
HPTZyc785dVpeCYaFt6muWw2ABnP97ShSLdIRAeY2G6HDLnEz3/hjbYfE2UFF68i
k/wEEtK5f48XxM+PuyDKk4b3+qFfqVSRS6QbdCnrKVQfGqeiWQKOdt/FQZ82/xIq
lu3kVuXPmEaN8W62MK1vCocjm/AXJ6l01gUqL00a6ntdTdsCXA6g0qpcwZDd6/1g
VgsEK0Y1mbzfq1YS52zw+obHp6nIJpA7Fnllf6irT3mSyEIzorIZ4z4As6CA91Em
M4DjFJ6FlLpmVIofe0JlzGxTZ1yueWLZjGf+3sEImikF6ndzh+dCV0ox73h6g8Vs
D79MHkaZfuBL0ZrxyGSOomRO9WhRrjUihlgILLtMHStWDDTp4F194SiD2T+xC25L
uvpfQAmLYYL+otb9n2cv1thik/MjZCDk5duYcRDLUJ3G23MaHk6DC13JaDk925zF
hbnFCt1PTzvWZ+HjE1GEFiDr88YJkyLdI7VKTsMC/bcfAE7SrpaqX0cLVjnmlIQK
5ScNYvB+PxCJj95YZsVpZ8cw9V/NlkWT1kpSX//G8Wl4YKW0vM25aBCca2hFqbCD
C3/6vqqx4z8D+r3K8KRVV/7y94JaMoHjrvd1fjUDOQfuilh3bgfCmhuFS8IV/HjB
bkuPY/O8O8abcb16wTMReKqahpmFsdOwIC/2gqoTQbKp2xbtY+gcvcObsWQRMcMH
mrHx2vMO4Tr4BKgNBxz4Gv5KAE/Pa2Gvqs0O5xsLNxF1kMUyT5CkrAuUayvysGHv
Y98p7ORHFKfA+tFOxgf7jBrs6/BpQmZHrbOU4v4WplpcbUe9e31l11n8BkQ/qhcO
rtsxqcYub3PRXwpm68LhDacKTdtyVv/j6yYba/RbfSn8ZwZAiwS6oW69qa/JCtEC
iw0058pNxHujA/A4Ceb7G9uFPhNb2UfgwzmID5tzxOhQype0vi02Vc1sMZHAsmII
iIpJUmh37Td1VkxUg+3FspeOmw00z4WNkrf1SMpFabpySw4BXcJMDIOxYhQI/ij6
mPglTjvJHF6eMw53l84MJIUHFkQDGTX2eLZBW91lDxVxmMkt74G7rD9j6pfm/Eo5
gezjc9DcX3ot1T6Gv0rk0ilF3Vfuw5+f46ZtZBQqYlFalKgYVpelidv2y5kC7gEn
fabH93l9GFHU4OKT1IESwPt4E0pJttVfTAwx3dBT/h8BgfN3bOqM1EdZF0/KIoc1
NLl1H2o/EZ94Jig25N3jqJ7w0riNE3dE891Fu715nfEjfSxIpMKC78FR/J9qTXgu
6sUwNgCs/DdVqruOjwFKupNgQcj7fwSJtnyQGY9fpZjAG+e5MiPxNFDjaoLu8M7k
5+CGelITcwbq2U8InZIpZTOCLif3zuHg0hkf3GXCsAapfQnmovR/xjtJBWEZVw+Z
2otgK9OruIMuEwxzxX2awqI5zDN2yBCnP62eEYoJ+HKM21i/hexMF4jIh9H+H99W
oFgNCNUwDw6RXPEUEqnTzQ==
-----END ENCRYPTED PRIVATE KEY-----
Convert PEM to PKCS#12
ubuntu@ubuntu:~/x509$ openssl pkcs12 -export -in local.dev+1.pem -inkey local.dev+1-key.pem -out local.dev+1.pkcs12
Enter Export Password: mambo
Verifying - Enter Export Password: mambo
Convert PKCS#12 to JKS
ubuntu@ubuntu:~/x509$ keytool -importkeystore -srckeystore local.dev+1.pkcs12 -srcstoretype PKCS12 -deststoretype JKS -destkeystore local.dev+1.jks
Importing keystore local.dev+1.pkcs12 to local.dev+1.jks...
Enter destination keystore password: mambo
Re-enter new password: mambo
Enter source keystore password: mambo
Entry for alias 1 successfully imported.
Import command completed: 1 entries successfully imported, 0 entries failed or cancelled
Warning:
The JKS keystore uses a proprietary format. It is recommended to migrate to PKCS12 which is an industry standard format using "keytool -importkeystore -srckeystore local.dev+1.jks -destkeystore local.dev+1.jks -deststoretype pkcs12".
Java KeyStore APIμμλ PKCS#12λ₯Ό κΈ°λ³Έ νμμΌλ‘ μ¬μ©νκ³ μμ΅λλ€. κ·Έλμ PKCS#12λ‘ λμ΄μλ νμΌμ κ·Έλλ‘ KeyStoreλ‘ λΆλ¬μ¬ μ μμΌλ―λ‘ κ΅³μ΄ JKS νμμ νμΌλ‘ λ³νν νμλ μμ΅λλ€. μ€νλ € λ§μ§λ§ κ²½κ³ λ¬Έκ΅¬μμ μλ €μ£Όλ κ²μ²λΌ JKS νμμΌλ‘ λμ΄μλ ν€μ€ν μ΄ νμΌμ PKCS#12λ‘ λ³ννλ λ°©λ²μ μλκ² μ’μ΅λλ€.
ubuntu@ubuntu:~/x509$ keytool -importkeystore -srckeystore local.dev+1.jks -destkeystore local.dev+1.jks -deststoretype pkcs12
Enter source keystore password: mambo
Entry for alias 1 successfully imported.
Import command completed: 1 entries successfully imported, 0 entries failed or cancelled
Warning:
Migrated "local.dev+1.jks" to PKCS12. The JKS keystore is backed up as "local.dev+1.jks.old".