CRL (Certificate Revocation List)

A Certificate Revocation List (CRL) is a list of digital certificates that have been revoked by the issuing Certificate Authority (CA) before their scheduled expiration date and should no longer be trusted. CRLs are an essential part of the Public Key Infrastructure (PKI) to ensure that invalid certificates are not used.

Creating a CRL

To manage CRLs, you need to have a CA set up with OpenSSL. Below are the steps to create and manage a CRL.

Step 1: Initialize the CA Environment

Ensure you have a CA directory structure, usually including directories like certs, crl, newcerts, and files like index.txt and serial.

Example CA directory structure:

mkdir -p /root/ca/{certs,crl,newcerts}
touch /root/ca/index.txt
echo 1000 > /root/ca/serial

Step 2: Create the CA Configuration File

Example openssl.cnf for the CA:

[ ca ]
default_ca = CA_default

[ CA_default ]
dir               = /root/ca
certs             = $dir/certs
crl_dir           = $dir/crl
database          = $dir/index.txt
new_certs_dir     = $dir/newcerts
certificate       = $dir/cacert.pem
serial            = $dir/serial
crlnumber         = $dir/crlnumber
crl               = $dir/crl.pem
private_key       = $dir/private/cakey.pem
RANDFILE          = $dir/private/.rand
default_days      = 365
default_crl_days  = 30
default_md        = sha256
preserve          = no
policy            = policy_strict

[ policy_strict ]
countryName             = match
stateOrProvinceName     = match
organizationName        = match
organizationalUnitName  = optional
commonName              = supplied
emailAddress            = optional

[ req ]
default_bits        = 2048
default_keyfile     = privkey.pem
distinguished_name  = req_distinguished_name
attributes          = req_attributes
x509_extensions     = v3_ca

[ req_distinguished_name ]
countryName                     = Country Name (2 letter code)
stateOrProvinceName             = State or Province Name (full name)
localityName                    = Locality Name (eg, city)
organizationName                = Organization Name (eg, company)
commonName                      = Common Name (eg, YOUR name)
emailAddress                    = Email Address

[ req_attributes ]
challengePassword               = A challenge password
challengePassword_min           = 4
challengePassword_max           = 20

[ v3_ca ]
subjectKeyIdentifier            = hash
authorityKeyIdentifier          = keyid:always,issuer:always
basicConstraints                = critical, CA:true

Step 3: Generate the CA Certificate

Generate a self-signed CA certificate if you do not have one already:

openssl req -new -x509 -key private/cakey.pem -out cacert.pem -config openssl.cnf

Step 4: Revoke a Certificate

To revoke a certificate, use the following command:

openssl ca -config openssl.cnf -revoke /path/to/certificate.pem

Step 5: Generate the CRL

After revoking certificates, generate the CRL:

openssl ca -config openssl.cnf -gencrl -out /root/ca/crl/crl.pem

Viewing a CRL

To view the contents of a CRL:

openssl crl -in /root/ca/crl/crl.pem -noout -text

This command displays the CRL details in a human-readable format, allowing you to verify the list of revoked certificates.

Updating a CRL

CRLs need to be updated regularly to include newly revoked certificates. Use the same openssl ca -gencrl command to regenerate the CRL file.

Use Cases

Ensuring Revoked Certificates are Not Trusted: CRLs are used by clients and servers to ensure that certificates which have been revoked are no longer trusted for secure communications.

Maintaining Security in PKI: Regularly updating and distributing CRLs helps maintain the integrity and trustworthiness of a PKI environment.

Automating CRL Management: Automating the CRL generation and distribution process ensures that revoked certificates are promptly recognized and dealt with, enhancing overall security.

Conclusion

Certificate Revocation Lists are a critical component of maintaining the security and integrity of a PKI environment. By understanding how to create, view, and update CRLs, administrators can ensure that revoked certificates are not trusted, thus preventing potential security breaches. Proper CRL management is essential for any organization that relies on digital certificates for secure communication.

Last updated