I would recommend you to get an overview of PKI and Certificates before generating or revoking certificates. In this article I will share the steps to revoke certificate from keystone and generate CRL. The first certificate that we issued with our CA in our last article was simply a test certificate to make sure that the CA is working properly. We can see that the certificate was issued properly, but it’s a certificate that we don’t actually want anybody to be able to use, so we will need to revoke the certificate.


Revoke a certificate

Revoking a certificate is a simple process. All you need is a copy of the certificate to be revoked. Even if you don’t keep a copy of all of the certificates that you’ve issued, the CA infrastructure we created does. We can obtain a copy of the certificate that way, but it’s much easier to keep a copy of your own and name the file something meaningful since the CA simply names the file containing the certificates it issues with each certificate’s serial number.

In my last article I had generated an additional private key which I can use to demonstrate this article

[[email protected] CA]# cp newcerts/01.pem testcert.pem
[[email protected] CA]# openssl ca -revoke testcert.pem
Using configuration from /etc/pki/tls/openssl.cnf
Enter pass phrase for /etc/pki/CA/private/cakey.pem:
Revoking Certificate 01.
Data Base Updated

The command-line tool prompts us for a passphrase. The passphrase it is looking for is the passphrase that protects the CA’s private key. Although the key is not actually used for any signing as part of the certificate revocation process, it is required to validate the certificate as the CA’s own and as a security measure to ensure that only someone authorized to use the CA can revoke a certificate that it has issued.

No change is made to the certificate at all. In fact, the only noticeable change is to the CA’s database to indicate that the certificate has been revoked.


Generate CRL using openssl

CRL stands for Certificate Revocation List. A CRL contains a list of all of the revoked certificates a CA has issued that have yet to expire. When a certificate is revoked, the CA declares that the certificate should no longer be trusted.

Remember that once a certificate has been issued, it cannot be modified. It’s presumably out in the wild and there’s no way to ensure that every copy of the certificate in existence can be updated. This is where CRLs become relevant

[[email protected] CA]# openssl ca -gencrl -out exampleca.crl
Using configuration from /etc/pki/tls/openssl.cnf
Enter pass phrase for /etc/pki/CA/private/cakey.pem:
[[email protected] CA]# openssl crl -in exampleca.crl -text -noout
Certificate Revocation List (CRL):
        Version 1 (0x0)
    Signature Algorithm: sha256WithRSAEncryption
        Issuer: /C=IN/ST=Karnataka/L=bangalore/O=Golinuxcloud/OU=TEST/CN=Example/[email protected]
        Last Update: Apr 17 04:37:17 2019 GMT
        Next Update: May 17 04:37:17 2019 GMT
Revoked Certificates:
    Serial Number: 01
        Revocation Date: Apr 17 04:26:14 2019 GMT
    Signature Algorithm: sha256WithRSAEncryption

When we get a text dump of the CRL, we can see the algorithm that was used to sign it, the CA that issued it, when it was issued, when the next list will be issued, and a list of all of the certificates that it contains. We can also use the crl command to verify the signature on the CRL.


Network Security with OpenSSL


Lastly I hope the steps from the article to revoke certificate and generate CRL using openssl on Linux was helpful. So, let me know your suggestions and feedback using the comment section..

Leave a Reply

Your email address will not be published. Required fields are marked *