gnutls_compress_certificate_get_selected_method - Linux


Overview

The gnutls_compress_certificate_get_selected_method function returns the selected compression method for the specified certificate. This information is useful when verifying certificates that use compression algorithms.

Syntax

#include <gnutls/gnutls.h>

gnutls_compression_method_t gnutls_compress_certificate_get_selected_method(gnutls_certificate_credentials_t credentials);

Options/Flags

None.

Examples

#include <gnutls/gnutls.h>

gnutls_certificate_credentials_t credentials;
gnutls_compression_method_t method;

gnutls_certificate_credentials_init(&credentials);

// Attempt to load a certificate file
if (gnutls_certificate_credentials_set_file(credentials, "certificate.pem", GNUTLS_CRD_FILETYPE_PEM) == 0) {
  // Get the selected compression method
  method = gnutls_compress_certificate_get_selected_method(credentials);
  
  // TODO: Check the returned value of method
}

Common Issues

If the specified certificate does not use compression, this function will return GNUTLS_COMP_NONE.

Integration

This function can be used in conjunction with other GNUTLS functions to verify certificates and validate compression algorithms.

Related Commands