Skip to content

MariaDB SQL request to list certificates expiration dates #434

Answered by chris2511
XOF83 asked this question in Q&A
Discussion options

You must be logged in to vote

The expiry date is not stored explicitly in the database. You need to extract the certificate and pipe it through openssl.

$ sqlite3 xca.xdb "SELECT cert FROM view_certs where id=42" | base64 -d | openssl x509 -inform der -noout -enddate
notAfter=May 22 16:08:00 2026 GMT

Alternatively you could use the XCA commandline to export the certificate information in an index file:

$ xca --database=youruser@10.1.0.1/QMYSQL3:yourdbname --index=xca-index.txt

The index is used and specified by OpenSSL and documented here. It contains among others the serial, subject and expiry date.

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@XOF83
Comment options

Answer selected by chris2511
Comment options

You must be logged in to vote
1 reply
@AnonATXDO
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants
Converted from issue

This discussion was converted from issue #298 on May 24, 2023 20:50.