9 Aralık 2022 Cuma

openssl req aracı İle Certificate Signing Requests (CSR) Üretmek

Giriş
Certificate Signing Requests (CSR) yaratmak içindir. CSR tiplerinden bazıları şöyle.
- PKCS #10 : Public-Key Cryptography Standards #10 CSR, RSA's CSR format.
- SPKAC : Signed Public Key and Challenge (SPKAC), Netscape's CSR format.
Bu araç PKCS#10 tipinden CSR üretir. Açıklaması şöyle.
PKCS#10 certificate request and certificate generating utility.
1. Önce elimizde bir private key olmalı
2. Bu private key "openssl req ..." ile CSR haline dönüştürülür

Seçenekler
key : private key dosyası belirtilir.
newkey
 :seçeneği ile kullanılacak algoritma belirtilir. Genellikle rsa:1024 , rsa:2048 , rsa:4096 seçilir.
nodes : Açıklaması şöyle. Private key dosyasının şifrelenmemesini sağlar.
The option -nodes is not the English word "nodes", but rather is "no DES". When given as an argument, it means OpenSSL will not encrypt the private key in a PKCS#12 file.
keyout :seçeneği ile private key dosyası belirtilir.
out : seçeneği ile CSR dosyası belirtilir.

Private Key Dosyası Zaten Varsa
Bu durumda -key ile private key dosyası belirtilir.

Örnek
Önce bir Private key yaratırız. Şöyle yaparız
$ openssl genrsa -out rohan.key 2048
Daha sonra CSR yaratmak için şöyle yaparız
$ openssl req -new -key rohan.key -out rohan.csr -sub "/CN=rohan/0=marketingweb"

$ ll
... rohan.csr
... rohan.key
Örnek
Şöyle yaparız
openssl req -new -key <private-key-file.key> -out <CSR-file.csr>
Örnek
Şöyle yaparız
openssl req -new -key <pem_file>.pem -out <out-csr-file>.pem 
  -subj "/CN=admin/O=prod/O=dev/O=uat"
Açıklaması şöyle
This would create a CSR (Certificate Signing Request) for the username admin, belonging to three groups: prod, dev and uat
Private Key Dosyası Yoksa
-key belirtilmez ve private key dosyası da üretilir.

Örnek
Şöyle yaparız
openssl req -new \
    -newkey rsa:4096 \
    -nodes \
    -keyout host.key \
    -out host.csr \
    -subj '/CN=TestHost/C=US/ST=CA/L=SF/O=Test'

Hiç yorum yok:

Yorum Gönder