iPXE
Functions
certmgmt.h File Reference

Certificate management. More...

#include <ipxe/x509.h>

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
void certstat (struct x509_certificate *cert)
 Display status of a certificate.

Detailed Description

Certificate management.

Definition in file certmgmt.h.


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )
void certstat ( struct x509_certificate cert)

Display status of a certificate.

Parameters:
certX.509 certificate

Definition at line 44 of file certmgmt.c.

References base16_encoded_len(), digest, digest_algorithm::digestsize, x509_certificate::flags, printf(), sha1_algorithm, x509_fingerprint(), X509_FL_EXPLICIT, X509_FL_PERMANENT, x509_is_valid(), and x509_name().

                                                {
        struct digest_algorithm *digest = &sha1_algorithm;
        uint8_t fingerprint[ digest->digestsize ];
        char buf[ base16_encoded_len ( sizeof ( fingerprint ) ) + 1 /* NUL */ ];

        /* Generate fingerprint */
        x509_fingerprint ( cert, digest, fingerprint );
        base16_encode ( fingerprint, sizeof ( fingerprint ),
                        buf, sizeof ( buf ) );

        /* Print certificate status */
        printf ( "%s : %s", x509_name ( cert ), buf );
        if ( cert->flags & X509_FL_PERMANENT )
                printf ( " [PERMANENT]" );
        if ( cert->flags & X509_FL_EXPLICIT )
                printf ( " [EXPLICIT]" );
        if ( x509_is_valid ( cert ) )
                printf ( " [VALIDATED]" );
        printf ( "\n" );
}