gnutls_certificate_free_keys - Linux


The gnutls_certificate_free_keys command in Linux is used to free the private and public keys associated with a TLS/SSL certificate. This is useful when you want to revoke the certificate or when you no longer need it.


gnutls_certificate_free_keys cert


-S (optional):

  • If set, only the secret key will be freed. The public key will remain untouched and can be accessed using gnutls_certificate_get_public_key().


To free the keys for a certificate with a name my_cert.pem:

gnutls_certificate_free_keys my_cert.pem

To free only the secret key:

gnutls_certificate_free_keys -S my_cert.pem

Common Issues

If the command fails, it may be due to one of the following reasons:

  • The certificate does not have any keys associated with it.
  • The certificate is not valid or has expired.
  • The user does not have sufficient permissions to free the keys.


gnutls_certificate_free_keys can be used in conjunction with other GnuTLS commands to manage certificates. For example, you can use the gnutls_certificate_import() command to import a certificate and then use gnutls_certificate_free_keys() to free the keys when you no longer need them.

Related Commands

  • gnutls_certificate_import()
  • gnutls_certificate_get_public_key()
  • gnutls_certificate_free()