Main Menu

Search

Wednesday, September 4, 2024

LINUX: OPENSSL Command To Check the Validity and Expiration Of Certificate (Certs)

Below command can be used.

sudo openssl x509 -in <cert> --text

Below is sample output of above command.

sudo openssl x509 -in apiserver.crt --text
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number: XXXXXXX (XXXXXXX)
        Signature Algorithm: sha256WithRSAEncryption
        Issuer: CN = kubernetes
        Validity
            Not Before: Jul 26 16:04:29 2024 GMT
            Not After : Jul 26 16:09:29 2025 GMT
        Subject: CN = kube-apiserver
        Subject Public Key Info:
            Public Key Algorithm: rsaEncryption
                RSA Public-Key: (2048 bit)
                Modulus:
                    XXXXXXX
                Exponent: 65537 (0x10001)
        X509v3 extensions:
            X509v3 Key Usage: critical
                Digital Signature, Key Encipherment
            X509v3 Extended Key Usage: 
                TLS Web Server Authentication
            X509v3 Basic Constraints: critical
                CA:FALSE
            X509v3 Authority Key Identifier: 
                XXXXXXX
            X509v3 Subject Alternative Name: 
                XXXXXXX
    Signature Algorithm: sha256WithRSAEncryption
        XXXXXXX
-----BEGIN CERTIFICATE-----
        XXXXXXX
-----END CERTIFICATE-----

No comments:

Post a Comment