gnutls_certificate_set_x509_key_mem2 - Linux


Overview

The gnutls_certificate_set_x509_key_mem2 function sets the private key data in DER encoded format for an existing certificate in a credentials object.

Syntax

gnutls_certificate_set_x509_key_mem2(gnutls_certificate_credentials_t cert,
                                        gnutls_x509_privkey_t key, size_t key_length)

Parameters

  • cert: The credentials object which will contain the private key.
  • key: A DER encoded private key.
  • key_length: The length of the private key in bytes.

Options/Flags

This function does not take any options or flags.

Examples

gnutls_certificate_credentials_t credentials;
gnutls_certificate_set_x509_key_mem2(credentials, key, key_length);

Common Issues

If the key is not in the correct format, an error will be returned.

Integration

This function can be combined with other GnuTLS functions to create a complete TLS/SSL stack.

Related Commands

  • gnutls_certificate_set_x509_key
  • gnutls_x509_privkey_init
  • gnutls_x509_privkey_deinit