OpenSSL ile CRT ve KEY Dosyalarından PFX Sertifikası Oluşturma
Bu doküman, mevcut SSL sertifika dosyalarınızı (.crt, .key, .ca-bundle) kullanarak bir .pfx (PKCS#12) dosyasının nasıl oluşturulacağını adım adım açıklar.
Yer Tutucular
Kendi ortamınıza göre değiştirin:
HOSTNAME— çalışılan sunucunun host adıkullanici— Linux kullanıcı adıexample.com— sertifikanın ait olduğu alan adıstar-example-com-2026— wildcard sertifika dosya adı (*.example.com, 2026)My_CA_Bundle.ca-bundle— CA zincir sertifikası dosyası
Ortam Bilgileri
- İşletim Sistemi: Ubuntu
- OpenSSL versiyonu: 1.1.x veya üzeri
- Çalışma dizini:
/home/kullanici/star-example-com-2026
Gerekli Dosyalar
Aşağıdaki dosyaların aynı dizin altında bulunduğundan emin olun:
star-example-com-2026.key— özel anahtar dosyası (private key)star-example-com-2026.crt— sunucu SSL sertifikasıMy_CA_Bundle.ca-bundle— CA (Certificate Authority) zincir sertifikası
Alternatif olarak CA zinciri AAACertificateServices.crt, USERTrustRSAAAACA.crt ve SectigoRSAOrganizationValidationSecureServerCA.crt dosyalarından manuel olarak da oluşturulabilir.
Adım 1: (Opsiyonel) CA Zincirini Tek Dosyada Birleştir
Eğer My_CA_Bundle.ca-bundle dosyan yoksa, aşağıdaki komutla CA zincirini oluşturabilirsin:
cat USERTrustRSAAAACA.crt SectigoRSAOrganizationValidationSecureServerCA.crt AAACertificateServices.crt > ca-chain.crt
Adım 2: PFX Dosyasını Oluştur
openssl pkcs12 -export \
-out star-example-com-2026.pfx \
-inkey star-example-com-2026.key \
-in star-example-com-2026.crt \
-certfile My_CA_Bundle.ca-bundle
My_CA_Bundle.ca-bundle yerine manuel oluşturduğun ca-chain.crt dosyasını kullanacaksan -certfile ca-chain.crt şeklinde güncelle:
openssl pkcs12 -export \
-out star-example-com-2026.pfx \
-inkey star-example-com-2026.key \
-in star-example-com-2026.crt \
-certfile ca-chain.crt
Parola Belirleme
Komut çalıştığında senden bir Export Password isteyecek. Bu parola .pfx dosyasını korur ve başka sistemlere import ederken kullanılır. Parolayı unutma.
PFX Oluşumunu Doğrulama
PFX dosyasının içeriğini doğrulamak istersen (şifreyi girmen gerekir):
openssl pkcs12 -info -in star-example-com-2026.pfx
Oluşan Dosya
star-example-com-2026.pfx— tüm sertifika bileşenlerini içeren tek dosya (PKCS#12 formatında)
Bonus: PFX’den CRT ve KEY Oluşturma
openssl pkcs12 -in star-example-com.pfx -nocerts -out star-example-com.key -nodes
openssl pkcs12 -in star-example-com.pfx -clcerts -nokeys -out star-example-com.crt
Zincir (chain):
openssl pkcs12 -in star-example-com.pfx -cacerts -nokeys -out star-example-com-chain.crt
Not: CRT dosyası aynı zamanda CA root Authority dosyasını da içerir.