Difference between revisions of "OpenSSL: Tutorial Simple"

From OnnoWiki
Jump to navigation Jump to search
 
(28 intermediate revisions by the same user not shown)
Line 138: Line 138:
 
Perintah openssl req akan mengambil konfigurasi dari bagian [req] dari file konfigurasi.
 
Perintah openssl req akan mengambil konfigurasi dari bagian [req] dari file konfigurasi.
  
===2.4 Create CA certificate===
+
Untuk belajar kita bisa menggunakan passphrase 123456
  
 +
===Create CA certificate===
 +
 +
cd /usr/local/src/stefanholek-pki-example-1-afc585fd9f5e
 
  openssl ca \
 
  openssl ca \
 
     -config etc/root-ca.conf \
 
     -config etc/root-ca.conf \
Line 146: Line 149:
 
     -extensions signing_ca_ext
 
     -extensions signing_ca_ext
  
With the openssl ca command we issue a certificate based on the CSR. The command takes its configuration from the [ca] section of the configuration file. Note that it is the root CA that issues the signing CA certificate! Note also that we attach a different set of extensions.
+
Perintah openssl ca akan meng-issue certificate berbasis pada CSR.
 +
Perintah tersebut akan mengambil konfigurasi dari bagian [ca] dari file konfigurasi.
 +
Perlu di catat:
 +
* root CA yang akan meng-issue signing CA certificate!
 +
* kita attach set extension yang berbeda
  
==3. Operate Signing CA==
+
==Operate Signing CA==
  
===3.1 Create email request===
+
===Create email request===
  
 +
cd /usr/local/src/stefanholek-pki-example-1-afc585fd9f5e
 
  openssl req -new \
 
  openssl req -new \
 
     -config etc/email.conf \
 
     -config etc/email.conf \
Line 157: Line 165:
 
     -keyout certs/fred.key
 
     -keyout certs/fred.key
  
With the openssl req -new command we create the private key and CSR for an email-protection certificate. We use a request configuration file specifically prepared for the task. When prompted enter these DN components: DC=org, DC=simple, O=Simple Inc, CN=Fred Flintstone, emailAddress=fred@simple.org. Leave other fields empty.
 
  
===3.2 Create email certificate===
+
Perintah openssl req -new akan membuat private key dan CSR untuk email-protection certificate.
 +
Kita menggunakan request configuration file untuk menyiapkan tugas tersebut.
 +
Jika ditanyakan komponen DN berikut, isi dengan
 +
 
 +
# Domain Component        (eg, com)      []:org
 +
# Domain Component        (eg, company)  []:simple
 +
# Domain Component        (eg, pki)      []:
 +
# Organization Name        (eg, company)  []:Simple Inc
 +
# Organizational Unit Name (eg, section)  []:
 +
# Common Name              (eg, full name) []:Fred Flintstone
 +
# Email Address            (eg, name@fqdn) []:fred@simple.org
 +
 
 +
biarkan yang lain kosong
  
 +
===Create email certificate===
 +
 +
cd /usr/local/src/stefanholek-pki-example-1-afc585fd9f5e
 
  openssl ca \
 
  openssl ca \
 
     -config etc/signing-ca.conf \
 
     -config etc/signing-ca.conf \
Line 167: Line 189:
 
     -extensions email_ext
 
     -extensions email_ext
  
We use the signing CA to issue the email-protection certificate. The certificate type is defined by the extensions we attach. A copy of the certificate is saved in the certificate archive under the name ca/signing-ca/01.pem (01 being the certificate serial number in hex.)
+
Kita menggunakan signing CA untuk issue email-protection certificate.
 +
Type certificate di definisikan oleh extensions yang di attach.
 +
Copy certificate di simpan di arsip certificate dengan nama ca/signing-ca/01.pem (01 sebagai nomor seri certificate dalam hex.)
  
===3.3 Create TLS server request===
+
===Create TLS server request===
  
 +
cd /usr/local/src/stefanholek-pki-example-1-afc585fd9f5e
 
  SAN=DNS:www.simple.org \
 
  SAN=DNS:www.simple.org \
 
  openssl req -new \
 
  openssl req -new \
Line 177: Line 202:
 
     -keyout certs/simple.org.key
 
     -keyout certs/simple.org.key
  
Next we create the private key and CSR for a TLS-server certificate using another request configuration file. When prompted enter these DN components: DC=org, DC=simple, O=Simple Inc, CN=www.simple.org. Note that the subjectAltName must be specified as environment variable. Note also that server keys typically have no passphrase.
+
Membuat private key dan CSR untuk TLS-server certificate menggunakan request configuration file yang lain.
 +
Saat ditanya DN components:
  
===3.4 Create TLS server certificate===
+
* DC=org
 +
* DC=simple
 +
* O=Simple Inc
 +
* CN=www.simple.org
  
 +
Catatan:
 +
* subjectAltName (SAN) harus di spesifikasi sebagai environment variable.
 +
* server keys biasanya tidak mempunyai passphrase.
 +
 +
===Create TLS server certificate===
 +
 +
cd /usr/local/src/stefanholek-pki-example-1-afc585fd9f5e
 
  openssl ca \
 
  openssl ca \
 
     -config etc/signing-ca.conf \
 
     -config etc/signing-ca.conf \
Line 187: Line 223:
 
     -extensions server_ext
 
     -extensions server_ext
  
We use the signing CA to issue the server certificate. The certificate type is defined by the extensions we attach. A copy of the certificate is saved in the certificate archive under the name ca/signing-ca/02.pem.
+
Gunakan signing CA untuk issue server certificate.
 +
Tipe certificate di definisikan oleh extensions yang di attach.
 +
Copy certificate di simplan di arsip certificate di bawah nama ca/signing-ca/02.pem.
  
===3.5 Revoke certificate===
+
===Revoke certificate===
  
 +
cd /usr/local/src/stefanholek-pki-example-1-afc585fd9f5e
 
  openssl ca \
 
  openssl ca \
 
     -config etc/signing-ca.conf \
 
     -config etc/signing-ca.conf \
Line 196: Line 235:
 
     -crl_reason superseded
 
     -crl_reason superseded
  
Certain events, like certificate replacement or loss of private key, require a certificate to be revoked before its scheduled expiration date. The openssl ca -revoke command marks a certificate as revoked in the CA database. It will from then on be included in CRLs issued by the CA. The above command revokes the certificate with serial number 01 (hex).
 
  
===3.6 Create CRL===
+
Untuk keadaan tertantu, seperti perubahan certificate atau kehilangan private key, akan membutuhkan pencabutan certificate sebelum tanggal expirenya.
 +
Perintah openssl ca -revoke menandai sebuah cerificate sebagai di cabut di CA database.
 +
Untuk selanjutnya akan mengikutkan dalam CRL yang di isu oleh CA.
 +
Perintah di atas akan mencabut certificate dengan nomor serial 01 (hex).
 +
 
 +
===Create CRL===
  
 +
cd /usr/local/src/stefanholek-pki-example-1-afc585fd9f5e
 
  openssl ca -gencrl \
 
  openssl ca -gencrl \
 
     -config etc/signing-ca.conf \
 
     -config etc/signing-ca.conf \
 
     -out crl/signing-ca.crl
 
     -out crl/signing-ca.crl
  
The openssl ca -gencrl command creates a certificate revocation list (CRL). The CRL contains all revoked, not-yet-expired certificates from the CA database. A new CRL must be issued at regular intervals.
+
Perintah openssl ca -gencrl membuat certificate revocation list (CRL).
 +
CRL berisi semua certificate yang statusnya revoked, not-yet-expired dari CA database.
 +
CRL baru harus di issue pada interval yang periodik.
  
==4. Output Formats==
+
==Output Format==
  
===4.1 Create DER certificate===
+
===Create DER certificate===
  
 +
cd /usr/local/src/stefanholek-pki-example-1-afc585fd9f5e
 
  openssl x509 \
 
  openssl x509 \
 
     -in certs/fred.crt \
 
     -in certs/fred.crt \
Line 215: Line 262:
 
     -outform der
 
     -outform der
  
All published certificates must be in DER format [RFC 2585#section-3]. Also see Appendix A: MIME Types.
+
Semua published certificates harus dalam DER format [RFC 2585#section-3].
  
===4.2 Create DER CRL===
+
===Create DER CRL===
  
 +
cd /usr/local/src/stefanholek-pki-example-1-afc585fd9f5e
 
  openssl crl \
 
  openssl crl \
 
     -in crl/signing-ca.crl \
 
     -in crl/signing-ca.crl \
Line 224: Line 272:
 
     -outform der
 
     -outform der
  
All published CRLs must be in DER format [RFC 2585#section-3]. Also see Appendix A: MIME Types.
+
Semua published CRL harus dalam DER format [RFC 2585#section-3]
  
===4.3 Create PKCS#7 bundle===
+
===Create PKCS#7 bundle===
  
 +
cd /usr/local/src/stefanholek-pki-example-1-afc585fd9f5e
 
  openssl crl2pkcs7 -nocrl \
 
  openssl crl2pkcs7 -nocrl \
 
     -certfile ca/signing-ca.crt \
 
     -certfile ca/signing-ca.crt \
Line 234: Line 283:
 
     -outform der
 
     -outform der
  
PKCS#7 is used to bundle two or more certificates. The format would also allow for CRLs but they are not used in practice.
+
PKCS#7 digunakan untuk mem-bundel dua atau lebih certificate.
 +
Format bisa digunakan untuk CRL tapi tidak digunakan di lapangan / operasional.
  
===4.4 Create PKCS#12 bundle===
+
===Create PKCS#12 bundle===
  
 +
cd /usr/local/src/stefanholek-pki-example-1-afc585fd9f5e
 
  openssl pkcs12 -export \
 
  openssl pkcs12 -export \
 
     -name "Fred Flintstone" \
 
     -name "Fred Flintstone" \
Line 244: Line 295:
 
     -out certs/fred.p12
 
     -out certs/fred.p12
  
PKCS#12 is used to bundle a certificate and its private key. Additional certificates may be added, typically the certificates comprising the chain up to the Root CA.
+
PKCS#12 digunakan untuk mem-bundel sebuah certificate dengan private key. Tambahan certificate dapat dilakukan, biasanya certificate yang merupakan mata rantai ke Root CA.
  
===4.5 Create PEM bundle===
+
===Create PEM bundle===
  
 +
cd /usr/local/src/stefanholek-pki-example-1-afc585fd9f5e
 
  cat ca/signing-ca.crt ca/root-ca.crt > \
 
  cat ca/signing-ca.crt ca/root-ca.crt > \
 
     ca/signing-ca-chain.pem
 
     ca/signing-ca-chain.pem
  
 +
cd /usr/local/src/stefanholek-pki-example-1-afc585fd9f5e
 
  cat certs/fred.key certs/fred.crt > \
 
  cat certs/fred.key certs/fred.crt > \
 
     certs/fred.pem
 
     certs/fred.pem
  
PEM bundles are created by concatenating other PEM-formatted files. The most common forms are “cert chain”, “key + cert”, and “key + cert chain”. PEM bundles are supported by OpenSSL and most software based on it (e.g. Apache mod_ssl and stunnel.)
+
PEM bundel dibuat dengan cara meng-concatenate file PEM lainnya.
 +
Yang banyak digunakan adalah “cert chain”, “key + cert”, dan “key + cert chain”.
 +
PEM bundle didukung oleh OpenSSL dan kebanyakan software pengikutnya (seperti apache mod_ssl dan stunnel).
  
==5. View Results==
+
==View Results==
  
===5.1 View request===
+
===View request===
  
 +
cd /usr/local/src/stefanholek-pki-example-1-afc585fd9f5e
 
  openssl req \
 
  openssl req \
 
     -in certs/fred.csr \
 
     -in certs/fred.csr \
Line 265: Line 321:
 
     -text
 
     -text
  
The openssl req command can be used to display the contents of CSR files. The -noout and -text options select a human-readable output format.
+
Perintah openssl req dapat digunakan untuk melihat isi dari file CSR .
 +
Opsi -noout dan -text akan menghasilkan format yang bisa di baca oleh manusiat.
  
===5.2 View certificate===
+
===View certificate===
  
 +
cd /usr/local/src/stefanholek-pki-example-1-afc585fd9f5e
 
  openssl x509 \
 
  openssl x509 \
 
     -in certs/fred.crt \
 
     -in certs/fred.crt \
Line 274: Line 332:
 
     -text
 
     -text
  
The openssl x509 command can be used to display the contents of certificate files. The -noout and -text options have the same purpose as before.
+
Perintah openssl x509 dapat digunakan untuk menampilkan isi file certificate.
 +
Opsi -noout dan -text mempunya fungsi yang sama dengan di atas.
  
===5.3 View CRL===
+
===View CRL===
  
 +
cd /usr/local/src/stefanholek-pki-example-1-afc585fd9f5e
 
  openssl crl \
 
  openssl crl \
 
     -in crl/signing-ca.crl \
 
     -in crl/signing-ca.crl \
Line 284: Line 344:
 
     -text
 
     -text
  
The openssl crl command can be used to view the contents of CRL files. Note that we specify -inform der because we have already converted the CRL in step 4.2.
+
Perintah openssl crl digunakan untuk melihat isi file CRL.
 +
Perhatikan bahwa kita menggunakan -inform der karena kita sudah mengkonversi CRL di step di atas.
  
===5.4 View PKCS#7 bundle===
+
===View PKCS#7 bundle===
  
 +
cd /usr/local/src/stefanholek-pki-example-1-afc585fd9f5e
 
  openssl pkcs7 \
 
  openssl pkcs7 \
 
     -in ca/signing-ca-chain.p7c \
 
     -in ca/signing-ca-chain.p7c \
Line 295: Line 357:
 
     -print_certs
 
     -print_certs
  
The openssl pkcs7 command can be used to display the contents of PKCS#7 bundles.
+
Perintah openssl pkcs7 dapat digunakan untuk menampilkan isi bundel PKCS#7 .
  
===5.5 View PKCS#12 bundle===
+
===View PKCS#12 bundle===
  
 +
cd /usr/local/src/stefanholek-pki-example-1-afc585fd9f5e
 
  openssl pkcs12 \
 
  openssl pkcs12 \
 
     -in certs/fred.p12 \
 
     -in certs/fred.p12 \
Line 304: Line 367:
 
     -info
 
     -info
  
The openssl pkcs12 command can be used to display the contents of PKCS#12 bundles.
+
Perintah openssl pkcs12 dapat digunakan untuk menampilkan isi PKCS#12
  
 
==References==
 
==References==

Latest revision as of 16:23, 7 June 2017

sumber: http://pki-tutorial.readthedocs.io/en/latest/simple/


Pada kesempatan ini kita akan belajar Simple PKI dengan satu root CA dan satu signing CA


Overview

Asumsinya sebuah organisasi dengan nama Simple Inc, mengggunakan domain simple.org. Organisasi ini menjalan sebuah PKI kecil untuk mengamankan semua email dan traffic intranet-nya.

SimplePKILayout.png

Untuk membuat PKI,

  • Pertama-tama, kita membuat Simple Root CA dengan CA certificate-nya.
  • Kita menggunakan root CA untuk membuat Simple Signing CA.
  • Setelah CA beroperasi, kita bisa menbuat email-protection certificate untuk pegawai, misalnya, Fred Flintstone.
  • Setelah CA beroperasi, kita bisa membuat TLS-server certificate untuk webserver di www.simple.org.
  • Terakhir, kita akan melihat format output yang perlu di dukung CA dan melihat isi file yan kita buat.

Semua perintah siap di copy / paste ke terminal (CLI). Semua perintah ini adalah operasi yang akan di lakukan pada sebuah PKI.

Persiapan

To get started, fetch the Simple PKI example files and change into the new directory:

sudo su
cd /usr/local/src
git clone https://bitbucket.org/stefanholek/pki-example-1
cd pki-example-1


Atau download dari

https://bitbucket.org/stefanholek/pki-example-1/downloads/
mv /home/onno/stefanholek-pki-example-1-afc585fd9f5e.zip /usr/local/src/
apt install unzip
unzip stefanholek-pki-example-1-afc585fd9f5e.zip

File Konfigurasi

Kita akan memakai satu file konfigurasi per CA

  • Root CA Configuration File - stefanholek-pki-example-1-afc585fd9f5e/etc/root-ca.conf
  • Signing CA Configuration File - stefanholek-pki-example-1-afc585fd9f5e/etc/signing-ca.conf

Dan satu file konfigurasi untuk setiap tipe CSR

  • Email Certificate Request Configuration File - stefanholek-pki-example-1-afc585fd9f5e/etc/email.conf
  • TLS Server Certificate Request Configuration File - stefanholek-pki-example-1-afc585fd9f5e/etc/server.conf

Untuk belajar kita akan menggunakan root

/usr/local/src/stefanholek-pki-example-1-afc585fd9f5e

Create Root CA

Create directories

cd  /usr/local/src/stefanholek-pki-example-1-afc585fd9f5e
mkdir -p ca/root-ca/private ca/root-ca/db crl certs
chmod 700 ca/root-ca/private
  • directory ca tempat menyimpan resource CA
  • directory crl tempat menyimpan CRL
  • directory certs tempat menyimpan certificate user


Create database

cd /usr/local/src/stefanholek-pki-example-1-afc585fd9f5e
cp /dev/null ca/root-ca/db/root-ca.db
cp /dev/null ca/root-ca/db/root-ca.db.attr
echo 01 > ca/root-ca/db/root-ca.crt.srl
echo 01 > ca/root-ca/db/root-ca.crl.srl

File database harus ada sebelum perintah openssl ca dapat digunakan.

Create CA request

cd /usr/local/src/stefanholek-pki-example-1-afc585fd9f5e
openssl req -new \
    -config etc/root-ca.conf \
    -out ca/root-ca.csr \
    -keyout ca/root-ca/private/root-ca.key

Perintah openssl req -new akan membuat private key dan certificate signing request (CSR) untuk root CA. Anda akan ditanya passphrase untuk memproteksi private key. Perintah openssl req akan mengambil konfigurasi dari bagian [req] dari file konfigurasi.

Untuk belajar password yang digunakan bisa 123456.

Create CA certificate

cd /usr/local/src/stefanholek-pki-example-1-afc585fd9f5e
openssl ca -selfsign \
    -config etc/root-ca.conf \
    -in ca/root-ca.csr \
    -out ca/root-ca.crt \
    -extensions root_ca_ext

Perintah openssl ca kita dapat meng-issue root CA certificate berdasarkan CSR. Root certificate merupakan self-signed dan akan menjadi titik awal dari semua hubungan trust / kepercayaan di PKI. Perintah openssl ca akan mengambil konfigurasi dari bagian [ca] di file konfigurasi.

Create Signing CA

Create directories

cd /usr/local/src/stefanholek-pki-example-1-afc585fd9f5e
mkdir -p ca/signing-ca/private ca/signing-ca/db crl certs
chmod 700 ca/signing-ca/private
  • Directory ca menyimpan semua sumber daya CA
  • Directory crl tempat menyimpan CRL
  • Directory certs menyimpan semua user certificate

Create database

cd /usr/local/src/stefanholek-pki-example-1-afc585fd9f5e
cp /dev/null ca/signing-ca/db/signing-ca.db
cp /dev/null ca/signing-ca/db/signing-ca.db.attr
echo 01 > ca/signing-ca/db/signing-ca.crt.srl
echo 01 > ca/signing-ca/db/signing-ca.crl.srl

Create CA request

cd /usr/local/src/stefanholek-pki-example-1-afc585fd9f5e
openssl req -new \
    -config etc/signing-ca.conf \
    -out ca/signing-ca.csr \
    -keyout ca/signing-ca/private/signing-ca.key

Perintah openssl req -new akan membuat private key dan CSR untuk signing CA. Kita akan ditanyakan password untuk memproteksi private key. Perintah openssl req akan mengambil konfigurasi dari bagian [req] dari file konfigurasi.

Untuk belajar kita bisa menggunakan passphrase 123456

Create CA certificate

cd /usr/local/src/stefanholek-pki-example-1-afc585fd9f5e
openssl ca \
    -config etc/root-ca.conf \
    -in ca/signing-ca.csr \
    -out ca/signing-ca.crt \
    -extensions signing_ca_ext

Perintah openssl ca akan meng-issue certificate berbasis pada CSR. Perintah tersebut akan mengambil konfigurasi dari bagian [ca] dari file konfigurasi. Perlu di catat:

  • root CA yang akan meng-issue signing CA certificate!
  • kita attach set extension yang berbeda

Operate Signing CA

Create email request

cd /usr/local/src/stefanholek-pki-example-1-afc585fd9f5e
openssl req -new \
    -config etc/email.conf \
    -out certs/fred.csr \
    -keyout certs/fred.key


Perintah openssl req -new akan membuat private key dan CSR untuk email-protection certificate. Kita menggunakan request configuration file untuk menyiapkan tugas tersebut. Jika ditanyakan komponen DN berikut, isi dengan

  1. Domain Component (eg, com) []:org
  2. Domain Component (eg, company) []:simple
  3. Domain Component (eg, pki) []:
  4. Organization Name (eg, company) []:Simple Inc
  5. Organizational Unit Name (eg, section) []:
  6. Common Name (eg, full name) []:Fred Flintstone
  7. Email Address (eg, name@fqdn) []:fred@simple.org

biarkan yang lain kosong

Create email certificate

cd /usr/local/src/stefanholek-pki-example-1-afc585fd9f5e
openssl ca \
    -config etc/signing-ca.conf \
    -in certs/fred.csr \
    -out certs/fred.crt \
    -extensions email_ext

Kita menggunakan signing CA untuk issue email-protection certificate. Type certificate di definisikan oleh extensions yang di attach. Copy certificate di simpan di arsip certificate dengan nama ca/signing-ca/01.pem (01 sebagai nomor seri certificate dalam hex.)

Create TLS server request

cd /usr/local/src/stefanholek-pki-example-1-afc585fd9f5e
SAN=DNS:www.simple.org \
openssl req -new \
    -config etc/server.conf \
    -out certs/simple.org.csr \
    -keyout certs/simple.org.key

Membuat private key dan CSR untuk TLS-server certificate menggunakan request configuration file yang lain. Saat ditanya DN components:

  • DC=org
  • DC=simple
  • O=Simple Inc
  • CN=www.simple.org

Catatan:

  • subjectAltName (SAN) harus di spesifikasi sebagai environment variable.
  • server keys biasanya tidak mempunyai passphrase.

Create TLS server certificate

cd /usr/local/src/stefanholek-pki-example-1-afc585fd9f5e
openssl ca \
    -config etc/signing-ca.conf \
    -in certs/simple.org.csr \
    -out certs/simple.org.crt \
    -extensions server_ext

Gunakan signing CA untuk issue server certificate. Tipe certificate di definisikan oleh extensions yang di attach. Copy certificate di simplan di arsip certificate di bawah nama ca/signing-ca/02.pem.

Revoke certificate

cd /usr/local/src/stefanholek-pki-example-1-afc585fd9f5e
openssl ca \
    -config etc/signing-ca.conf \
    -revoke ca/signing-ca/01.pem \
    -crl_reason superseded


Untuk keadaan tertantu, seperti perubahan certificate atau kehilangan private key, akan membutuhkan pencabutan certificate sebelum tanggal expirenya. Perintah openssl ca -revoke menandai sebuah cerificate sebagai di cabut di CA database. Untuk selanjutnya akan mengikutkan dalam CRL yang di isu oleh CA. Perintah di atas akan mencabut certificate dengan nomor serial 01 (hex).

Create CRL

cd /usr/local/src/stefanholek-pki-example-1-afc585fd9f5e
openssl ca -gencrl \
    -config etc/signing-ca.conf \
    -out crl/signing-ca.crl

Perintah openssl ca -gencrl membuat certificate revocation list (CRL). CRL berisi semua certificate yang statusnya revoked, not-yet-expired dari CA database. CRL baru harus di issue pada interval yang periodik.

Output Format

Create DER certificate

cd /usr/local/src/stefanholek-pki-example-1-afc585fd9f5e
openssl x509 \
    -in certs/fred.crt \
    -out certs/fred.cer \
    -outform der

Semua published certificates harus dalam DER format [RFC 2585#section-3].

Create DER CRL

cd /usr/local/src/stefanholek-pki-example-1-afc585fd9f5e
openssl crl \
    -in crl/signing-ca.crl \
    -out crl/signing-ca.crl \
    -outform der

Semua published CRL harus dalam DER format [RFC 2585#section-3]

Create PKCS#7 bundle

cd /usr/local/src/stefanholek-pki-example-1-afc585fd9f5e
openssl crl2pkcs7 -nocrl \
    -certfile ca/signing-ca.crt \
    -certfile ca/root-ca.crt \
    -out ca/signing-ca-chain.p7c \
    -outform der

PKCS#7 digunakan untuk mem-bundel dua atau lebih certificate. Format bisa digunakan untuk CRL tapi tidak digunakan di lapangan / operasional.

Create PKCS#12 bundle

cd /usr/local/src/stefanholek-pki-example-1-afc585fd9f5e
openssl pkcs12 -export \
    -name "Fred Flintstone" \
    -inkey certs/fred.key \
    -in certs/fred.crt \
    -out certs/fred.p12

PKCS#12 digunakan untuk mem-bundel sebuah certificate dengan private key. Tambahan certificate dapat dilakukan, biasanya certificate yang merupakan mata rantai ke Root CA.

Create PEM bundle

cd /usr/local/src/stefanholek-pki-example-1-afc585fd9f5e
cat ca/signing-ca.crt ca/root-ca.crt > \
    ca/signing-ca-chain.pem
cd /usr/local/src/stefanholek-pki-example-1-afc585fd9f5e
cat certs/fred.key certs/fred.crt > \
    certs/fred.pem

PEM bundel dibuat dengan cara meng-concatenate file PEM lainnya. Yang banyak digunakan adalah “cert chain”, “key + cert”, dan “key + cert chain”. PEM bundle didukung oleh OpenSSL dan kebanyakan software pengikutnya (seperti apache mod_ssl dan stunnel).

View Results

View request

cd /usr/local/src/stefanholek-pki-example-1-afc585fd9f5e
openssl req \
    -in certs/fred.csr \
    -noout \
    -text

Perintah openssl req dapat digunakan untuk melihat isi dari file CSR . Opsi -noout dan -text akan menghasilkan format yang bisa di baca oleh manusiat.

View certificate

cd /usr/local/src/stefanholek-pki-example-1-afc585fd9f5e
openssl x509 \
    -in certs/fred.crt \
    -noout \
    -text

Perintah openssl x509 dapat digunakan untuk menampilkan isi file certificate. Opsi -noout dan -text mempunya fungsi yang sama dengan di atas.

View CRL

cd /usr/local/src/stefanholek-pki-example-1-afc585fd9f5e
openssl crl \
    -in crl/signing-ca.crl \
    -inform der \
    -noout \
    -text

Perintah openssl crl digunakan untuk melihat isi file CRL. Perhatikan bahwa kita menggunakan -inform der karena kita sudah mengkonversi CRL di step di atas.

View PKCS#7 bundle

cd /usr/local/src/stefanholek-pki-example-1-afc585fd9f5e
openssl pkcs7 \
    -in ca/signing-ca-chain.p7c \
    -inform der \
    -noout \
    -text \
    -print_certs

Perintah openssl pkcs7 dapat digunakan untuk menampilkan isi bundel PKCS#7 .

View PKCS#12 bundle

cd /usr/local/src/stefanholek-pki-example-1-afc585fd9f5e
openssl pkcs12 \
    -in certs/fred.p12 \
    -nodes \
    -info

Perintah openssl pkcs12 dapat digunakan untuk menampilkan isi PKCS#12

References

Referensi