Hướng dẫn tạo certificate SSL trên ubuntu (file key, pem)

Hướng dẫn tạo certificate SSL trên ubuntu (file key, pem)

(Xem thêm: Hướng dẫn tạo certificate SSL trên Windows (file key, pem))

Với server chạy bằng Java bạn cần chuyển file pem, private key sang p.12 (PKCS#12)

Tạo file .key

openssl genrsa -out {ten_file}.key {do_dai_key}

Ví dụ:

openssl genrsa -out cert.key 2048

Hướng dẫn tạo certificate SSL trên ubuntu (file key, pem)

Tạo file .pem từ file .key

Cú pháp:

openssl req -x509 -new -nodes -key {ten_file.key} -sha256 -days 1825 -out {ten_file.pem}

Ví dụ:

openssl req -x509 -new -nodes -key cert.key -sha256 -days 1825 -out cert.pem

Sau đó nhập các thông tin của certificate như  email, name…

Hướng dẫn tạo certificate SSL trên ubuntu (file key, pem)

Bạn cũng có thể tạo file .crt, chỉ cần đổi đuôi .pem thành đuôi .crt là được

 

Demo:

Đây là thông tin SSL Certificate hiển thị trên trình duyệt khi mình dùng 2 file trên apply cho website của mình:

Hướng dẫn tạo certificate SSL trên ubuntu (file key, pem)

(Xem thêm: Cấu hình HTTPs cho Server NGINX)

Hướng dẫn tạo certificate SSL trên ubuntu (file key, pem)

Okay, Done!

References:

stackjava.com