gnutls: GnuTLS API Reference Manual

## gnutls gnutls |

## Functions

#define | GNUTLS_CLIENT
#define | GNUTLS_DATAGRAM
#define | GNUTLS_DEFAULT_HANDSHAKE_TIMEOUT
#define | GNUTLS_HB_LOCAL_ALLOWED_TO_SEND
#define | GNUTLS_HB_PEER_ALLOWED_TO_SEND
#define | GNUTLS_HB_PEER_NOT_ALLOWED_TO_SEND
#define | GNUTLS_NONBLOCK
#define | GNUTLS_NO_EXTENSIONS
gnutls_alert_description_t | gnutls_alert_get ()
const char * | gnutls_alert_get_name ()
const char * | gnutls_alert_get_strname ()
int | gnutls_alert_send ()
int | gnutls_alert_send_appropriate ()
void * | (*gnutls_alloc_function) ()
int | gnutls_anon_allocate_client_credentials ()
int | gnutls_anon_allocate_server_credentials ()
void | gnutls_anon_free_client_credentials ()
void | gnutls_anon_free_server_credentials ()
void | gnutls_anon_set_params_function ()
void | gnutls_anon_set_server_dh_params ()
void | gnutls_anon_set_server_params_function ()
void | (*gnutls_audit_log_func) ()
int | gnutls_bye ()
void * | (*gnutls_calloc_function) ()
time_t | gnutls_certificate_activation_time_peers ()
int | gnutls_certificate_allocate_credentials ()
int | gnutls_certificate_client_get_request_status ()
time_t | gnutls_certificate_expiration_time_peers ()
void | gnutls_certificate_free_ca_names ()
void | gnutls_certificate_free_cas ()
void | gnutls_certificate_free_credentials ()
void | gnutls_certificate_free_crls ()
void | gnutls_certificate_free_keys ()
int | gnutls_certificate_get_issuer ()
const gnutls_datum_t * | gnutls_certificate_get_ours ()
const gnutls_datum_t * | gnutls_certificate_get_peers ()
int | gnutls_certificate_get_peers_subkey_id ()
void | gnutls_certificate_send_x509_rdn_sequence ()
void | gnutls_certificate_server_set_request ()
void | gnutls_certificate_set_dh_params ()
int | gnutls_certificate_set_ocsp_status_request_file ()
void | gnutls_certificate_set_ocsp_status_request_function ()
void | gnutls_certificate_set_params_function ()
void | gnutls_certificate_set_pin_function ()
void | gnutls_certificate_set_retrieve_function ()
void | gnutls_certificate_set_verify_flags ()
void | gnutls_certificate_set_verify_function ()
void | gnutls_certificate_set_verify_limits ()
int | gnutls_certificate_set_x509_crl ()
int | gnutls_certificate_set_x509_crl_file ()
int | gnutls_certificate_set_x509_crl_mem ()
int | gnutls_certificate_set_x509_key ()
int | gnutls_certificate_set_x509_key_file ()
int | gnutls_certificate_set_x509_key_mem ()
int | gnutls_certificate_set_x509_simple_pkcs12_file ()
int | gnutls_certificate_set_x509_simple_pkcs12_mem ()
int | gnutls_certificate_set_x509_system_trust ()
int | gnutls_certificate_set_x509_trust ()
int | gnutls_certificate_set_x509_trust_file ()
int | gnutls_certificate_set_x509_trust_mem ()
gnutls_certificate_type_t | gnutls_certificate_type_get ()
gnutls_certificate_type_t | gnutls_certificate_type_get_id ()
const char * | gnutls_certificate_type_get_name ()
const gnutls_certificate_type_t * | gnutls_certificate_type_list ()
int | gnutls_certificate_verification_status_print ()
int | gnutls_certificate_verify_peers2 ()
int | gnutls_certificate_verify_peers3 ()
const char * | gnutls_check_version ()
gnutls_cipher_algorithm_t | gnutls_cipher_get ()
gnutls_cipher_algorithm_t | gnutls_cipher_get_id ()
size_t | gnutls_cipher_get_key_size ()
const char * | gnutls_cipher_get_name ()
const gnutls_cipher_algorithm_t * | gnutls_cipher_list ()
const char * | gnutls_cipher_suite_get_name ()
const char * | gnutls_cipher_suite_info ()
gnutls_compression_method_t | gnutls_compression_get ()
gnutls_compression_method_t | gnutls_compression_get_id ()
const char * | gnutls_compression_get_name ()
const gnutls_compression_method_t * | gnutls_compression_list ()
void | gnutls_credentials_clear ()
int | gnutls_credentials_set ()
int | gnutls_db_check_entry ()
void * | gnutls_db_get_ptr ()
int | (*gnutls_db_remove_func) ()
void | gnutls_db_remove_session ()
gnutls_datum_t | (*gnutls_db_retr_func) ()
void | gnutls_db_set_cache_expiration ()
void | gnutls_db_set_ptr ()
void | gnutls_db_set_remove_function ()
void | gnutls_db_set_retrieve_function ()
void | gnutls_db_set_store_function ()
int | (*gnutls_db_store_func) ()
void | gnutls_deinit ()
int | gnutls_dh_get_group ()
int | gnutls_dh_get_peers_public_bits ()
int | gnutls_dh_get_prime_bits ()
int | gnutls_dh_get_pubkey ()
int | gnutls_dh_get_secret_bits ()
int | gnutls_dh_params_cpy ()
void | gnutls_dh_params_deinit ()
int | gnutls_dh_params_export2_pkcs3 ()
int | gnutls_dh_params_export_pkcs3 ()
int | gnutls_dh_params_export_raw ()
int | gnutls_dh_params_generate2 ()
int | gnutls_dh_params_import_pkcs3 ()
int | gnutls_dh_params_import_raw ()
int | gnutls_dh_params_init ()
void | gnutls_dh_set_prime_bits ()
gnutls_ecc_curve_t | gnutls_ecc_curve_get ()
const char * | gnutls_ecc_curve_get_name ()
int | gnutls_ecc_curve_get_size ()
const gnutls_ecc_curve_t * | gnutls_ecc_curve_list ()
int | (*gnutls_errno_func) ()
int | gnutls_error_is_fatal ()
int | gnutls_error_to_alert ()
int | gnutls_fingerprint ()
void | (*gnutls_free_function) ()
void | gnutls_global_deinit ()
int | gnutls_global_init ()
void | gnutls_global_set_audit_log_function ()
void | gnutls_global_set_log_function ()
void | gnutls_global_set_log_level ()
void | gnutls_global_set_mem_functions ()
void | gnutls_global_set_mutex ()
void | gnutls_global_set_time_function ()
int | gnutls_handshake ()
gnutls_handshake_description_t | gnutls_handshake_get_last_in ()
gnutls_handshake_description_t | gnutls_handshake_get_last_out ()
int | (*gnutls_handshake_post_client_hello_func) ()
void | gnutls_handshake_set_max_packet_length ()
void | gnutls_handshake_set_post_client_hello_function ()
void | gnutls_handshake_set_private_extensions ()
void | gnutls_handshake_set_timeout ()
int | gnutls_heartbeat_allowed ()
void | gnutls_heartbeat_enable ()
unsigned int | gnutls_heartbeat_get_timeout ()
int | gnutls_heartbeat_ping ()
int | gnutls_heartbeat_pong ()
void | gnutls_heartbeat_set_timeouts ()
int | gnutls_hex2bin ()
int | gnutls_hex_decode ()
int | gnutls_hex_encode ()
int | gnutls_init ()
int | (*gnutls_is_secure_function) ()
int | gnutls_key_generate ()
gnutls_kx_algorithm_t | gnutls_kx_get ()
gnutls_kx_algorithm_t | gnutls_kx_get_id ()
const char * | gnutls_kx_get_name ()
const gnutls_kx_algorithm_t * | gnutls_kx_list ()
int | gnutls_load_file ()
void | (*gnutls_log_func) ()
gnutls_mac_algorithm_t | gnutls_mac_get ()
gnutls_mac_algorithm_t | gnutls_mac_get_id ()
size_t | gnutls_mac_get_key_size ()
const char * | gnutls_mac_get_name ()
const gnutls_mac_algorithm_t * | gnutls_mac_list ()
int | gnutls_ocsp_status_request_enable_client ()
int | gnutls_ocsp_status_request_get ()
int | gnutls_ocsp_status_request_is_checked ()
void | gnutls_openpgp_send_cert ()
int | gnutls_pem_base64_decode ()
int | gnutls_pem_base64_encode ()
void | gnutls_perror ()
int | (*gnutls_pin_callback_t) ()
const char * | gnutls_pk_algorithm_get_name ()
gnutls_sec_param_t | gnutls_pk_bits_to_sec_param ()
gnutls_pk_algorithm_t | gnutls_pk_get_id ()
const char * | gnutls_pk_get_name ()
const gnutls_pk_algorithm_t * | gnutls_pk_list ()
gnutls_sign_algorithm_t | gnutls_pk_to_sign ()
int | gnutls_prf ()
int | gnutls_prf_raw ()
int | gnutls_priority_certificate_type_list ()
int | gnutls_priority_compression_list ()
void | gnutls_priority_deinit ()
int | gnutls_priority_ecc_curve_list ()
int | gnutls_priority_get_cipher_suite_index ()
int | gnutls_priority_init ()
int | gnutls_priority_protocol_list ()
int | gnutls_priority_set ()
int | gnutls_priority_set_direct ()
int | gnutls_priority_sign_list ()
gnutls_protocol_t | gnutls_protocol_get_id ()
const char * | gnutls_protocol_get_name ()
gnutls_protocol_t | gnutls_protocol_get_version ()
const gnutls_protocol_t * | gnutls_protocol_list ()
int | gnutls_psk_allocate_client_credentials ()
int | gnutls_psk_allocate_server_credentials ()
const char * | gnutls_psk_client_get_hint ()
void | gnutls_psk_free_client_credentials ()
void | gnutls_psk_free_server_credentials ()
const char * | gnutls_psk_server_get_username ()
int | gnutls_psk_set_client_credentials ()
void | gnutls_psk_set_client_credentials_function ()
void | gnutls_psk_set_params_function ()
int | gnutls_psk_set_server_credentials_file ()
void | gnutls_psk_set_server_credentials_function ()
int | gnutls_psk_set_server_credentials_hint ()
void | gnutls_psk_set_server_dh_params ()
void | gnutls_psk_set_server_params_function ()
ssize_t | (*gnutls_pull_func) ()
int | (*gnutls_pull_timeout_func) ()
ssize_t | (*gnutls_push_func) ()
int | gnutls_random_art ()
void * | (*gnutls_realloc_function) ()
size_t | gnutls_record_check_pending ()
void | gnutls_record_disable_padding ()
int | gnutls_record_get_direction ()
size_t | gnutls_record_get_max_size ()
ssize_t | gnutls_record_recv ()
ssize_t | gnutls_record_recv_seq ()
ssize_t | gnutls_record_send ()
ssize_t | gnutls_record_set_max_size ()
int | gnutls_rehandshake ()
int | gnutls_safe_renegotiation_status ()
const char * | gnutls_sec_param_get_name ()
return | gnutls_sec_param_to_pk_bits ()
int | gnutls_server_name_get ()
int | gnutls_server_name_set ()
int | gnutls_session_channel_binding ()
void | gnutls_session_enable_compatibility_mode ()
int | gnutls_session_get_data ()
int | gnutls_session_get_data2 ()
int | gnutls_session_get_id ()
int | gnutls_session_get_id2 ()
void * | gnutls_session_get_ptr ()
void | gnutls_session_get_random ()
int | gnutls_session_is_resumed ()
int | gnutls_session_resumption_requested ()
int | gnutls_session_set_data ()
int | gnutls_session_set_premaster ()
void | gnutls_session_set_ptr ()
int | gnutls_session_ticket_enable_client ()
int | gnutls_session_ticket_enable_server ()
int | gnutls_session_ticket_key_generate ()
int | gnutls_set_default_priority ()
int | gnutls_sign_algorithm_get ()
int | gnutls_sign_algorithm_get_requested ()
gnutls_digest_algorithm_t | gnutls_sign_get_hash_algorithm ()
gnutls_sign_algorithm_t | gnutls_sign_get_id ()
const char * | gnutls_sign_get_name ()
gnutls_pk_algorithm_t | gnutls_sign_get_pk_algorithm ()
int | gnutls_sign_is_secure ()
const gnutls_sign_algorithm_t * | gnutls_sign_list ()
int | gnutls_srp_allocate_client_credentials ()
int | gnutls_srp_allocate_server_credentials ()
int | gnutls_srp_base64_decode ()
int | gnutls_srp_base64_encode ()
void | gnutls_srp_free_client_credentials ()
void | gnutls_srp_free_server_credentials ()
const char * | gnutls_srp_server_get_username ()
int | gnutls_srp_set_client_credentials ()
void | gnutls_srp_set_client_credentials_function ()
void | gnutls_srp_set_prime_bits ()
int | gnutls_srp_set_server_credentials_file ()
void | gnutls_srp_set_server_credentials_function ()
int | gnutls_srp_verifier ()
int | gnutls_srtp_get_keys ()
int | gnutls_srtp_get_mki ()
int | gnutls_srtp_get_profile_id ()
const char * | gnutls_srtp_get_profile_name ()
int | gnutls_srtp_get_selected_profile ()
int | gnutls_srtp_set_mki ()
int | gnutls_srtp_set_profile ()
int | gnutls_srtp_set_profile_direct ()
int | gnutls_store_commitment ()
int | gnutls_store_pubkey ()
const char * | gnutls_strerror ()
const char * | gnutls_strerror_name ()
void | gnutls_tdb_deinit ()
int | gnutls_tdb_init ()
void | gnutls_tdb_set_store_commitment_func ()
void | gnutls_tdb_set_store_func ()
void | gnutls_tdb_set_verify_func ()
int | (*gnutls_tdb_store_commitment_func) ()
int | (*gnutls_tdb_store_func) ()
int | (*gnutls_tdb_verify_func) ()
time_t | (*gnutls_time_func) ()
gnutls_transport_ptr_t | gnutls_transport_get_ptr ()
void | gnutls_transport_get_ptr2 ()
void | gnutls_transport_set_errno ()
void | gnutls_transport_set_errno_function ()
void | gnutls_transport_set_ptr ()
void | gnutls_transport_set_ptr2 ()
void | gnutls_transport_set_pull_function ()
void | gnutls_transport_set_pull_timeout_function ()
void | gnutls_transport_set_push_function ()
void | gnutls_transport_set_vec_push_function ()
int | gnutls_url_is_supported ()
ssize_t | (*gnutls_vec_push_func) ()
int | gnutls_verify_stored_pubkey ()
int | (*mutex_deinit_func) ()
int | (*mutex_init_func) ()
int | (*mutex_lock_func) ()
int | (*mutex_unlock_func) ()

## Types and Values

#define | GNUTLS_CIPHER_ARCFOUR
#define | GNUTLS_CIPHER_RIJNDAEL_128_CBC
#define | GNUTLS_CIPHER_RIJNDAEL_256_CBC
#define | GNUTLS_CIPHER_RIJNDAEL_CBC
#define | GNUTLS_DIG_SHA
#define | GNUTLS_E_AGAIN
#define | GNUTLS_E_APPLICATION_ERROR_MAX
#define | GNUTLS_E_APPLICATION_ERROR_MIN
#define | GNUTLS_E_ASN1_DER_ERROR
#define | GNUTLS_E_ASN1_DER_OVERFLOW
#define | GNUTLS_E_ASN1_ELEMENT_NOT_FOUND
#define | GNUTLS_E_ASN1_GENERIC_ERROR
#define | GNUTLS_E_ASN1_IDENTIFIER_NOT_FOUND
#define | GNUTLS_E_ASN1_SYNTAX_ERROR
#define | GNUTLS_E_ASN1_TAG_ERROR
#define | GNUTLS_E_ASN1_TAG_IMPLICIT
#define | GNUTLS_E_ASN1_TYPE_ANY_ERROR
#define | GNUTLS_E_ASN1_VALUE_NOT_FOUND
#define | GNUTLS_E_ASN1_VALUE_NOT_VALID
#define | GNUTLS_E_BAD_COOKIE
#define | GNUTLS_E_BASE64_DECODING_ERROR
#define | GNUTLS_E_BASE64_ENCODING_ERROR
#define | GNUTLS_E_BASE64_UNEXPECTED_HEADER_ERROR
#define | GNUTLS_E_CERTIFICATE_ERROR
#define | GNUTLS_E_CERTIFICATE_KEY_MISMATCH
#define | GNUTLS_E_CERTIFICATE_LIST_UNSORTED
#define | GNUTLS_E_CHANNEL_BINDING_NOT_AVAILABLE
#define | GNUTLS_E_COMPRESSION_FAILED
#define | GNUTLS_E_CONSTRAINT_ERROR
#define | GNUTLS_E_CRYPTODEV_DEVICE_ERROR
#define | GNUTLS_E_CRYPTODEV_IOCTL_ERROR
#define | GNUTLS_E_CRYPTO_ALREADY_REGISTERED
#define | GNUTLS_E_CRYPTO_INIT_FAILED
#define | GNUTLS_E_DB_ERROR
#define | GNUTLS_E_DECOMPRESSION_FAILED
#define | GNUTLS_E_DECRYPTION_FAILED
#define | GNUTLS_E_DH_PRIME_UNACCEPTABLE
#define | GNUTLS_E_ECC_NO_SUPPORTED_CURVES
#define | GNUTLS_E_ECC_UNSUPPORTED_CURVE
#define | GNUTLS_E_ENCRYPTION_FAILED
#define | GNUTLS_E_ERROR_IN_FINISHED_PACKET
#define | GNUTLS_E_EXPIRED
#define | GNUTLS_E_FATAL_ALERT_RECEIVED
#define | GNUTLS_E_FILE_ERROR
#define | GNUTLS_E_GOT_APPLICATION_DATA
#define | GNUTLS_E_HANDSHAKE_TOO_LARGE
#define | GNUTLS_E_HASH_FAILED
#define | GNUTLS_E_HEARTBEAT_PING_RECEIVED
#define | GNUTLS_E_HEARTBEAT_PONG_RECEIVED
#define | GNUTLS_E_IA_VERIFY_FAILED
#define | GNUTLS_E_ILLEGAL_PARAMETER
#define | GNUTLS_E_ILLEGAL_SRP_USERNAME
#define | GNUTLS_E_INCOMPATIBLE_CRYPTO_LIBRARY
#define | GNUTLS_E_INCOMPATIBLE_GCRYPT_LIBRARY
#define | GNUTLS_E_INCOMPATIBLE_LIBTASN1_LIBRARY
#define | GNUTLS_E_INCOMPAT_DSA_KEY_WITH_TLS_PROTOCOL
#define | GNUTLS_E_INSUFFICIENT_CRED
#define | GNUTLS_E_INSUFFICIENT_CREDENTIALS
#define | GNUTLS_E_INSUFICIENT_CRED
#define | GNUTLS_E_INSUFICIENT_CREDENTIALS
#define | GNUTLS_E_INTERNAL_ERROR
#define | GNUTLS_E_INTERRUPTED
#define | GNUTLS_E_INVALID_PASSWORD
#define | GNUTLS_E_INVALID_REQUEST
#define | GNUTLS_E_INVALID_SESSION
#define | GNUTLS_E_KEY_USAGE_VIOLATION
#define | GNUTLS_E_LARGE_PACKET
#define | GNUTLS_E_LOCKING_ERROR
#define | GNUTLS_E_MAC_VERIFY_FAILED
#define | GNUTLS_E_MEMORY_ERROR
#define | GNUTLS_E_MPI_PRINT_FAILED
#define | GNUTLS_E_MPI_SCAN_FAILED
#define | GNUTLS_E_NO_CERTIFICATE_FOUND
#define | GNUTLS_E_NO_CERTIFICATE_STATUS
#define | GNUTLS_E_NO_CIPHER_SUITES
#define | GNUTLS_E_NO_COMPRESSION_ALGORITHMS
#define | GNUTLS_E_NO_PRIORITIES_WERE_SET
#define | GNUTLS_E_NO_TEMPORARY_DH_PARAMS
#define | GNUTLS_E_NO_TEMPORARY_RSA_PARAMS
#define | GNUTLS_E_OCSP_RESPONSE_ERROR
#define | GNUTLS_E_OPENPGP_FINGERPRINT_UNSUPPORTED
#define | GNUTLS_E_OPENPGP_GETKEY_FAILED
#define | GNUTLS_E_OPENPGP_KEYRING_ERROR
#define | GNUTLS_E_OPENPGP_PREFERRED_KEY_ERROR
#define | GNUTLS_E_OPENPGP_SUBKEY_ERROR
#define | GNUTLS_E_OPENPGP_UID_REVOKED
#define | GNUTLS_E_PARSING_ERROR
#define | GNUTLS_E_PKCS11_ATTRIBUTE_ERROR
#define | GNUTLS_E_PKCS11_DATA_ERROR
#define | GNUTLS_E_PKCS11_DEVICE_ERROR
#define | GNUTLS_E_PKCS11_ERROR
#define | GNUTLS_E_PKCS11_KEY_ERROR
#define | GNUTLS_E_PKCS11_LOAD_ERROR
#define | GNUTLS_E_PKCS11_PIN_ERROR
#define | GNUTLS_E_PKCS11_PIN_EXPIRED
#define | GNUTLS_E_PKCS11_PIN_LOCKED
#define | GNUTLS_E_PKCS11_REQUESTED_OBJECT_NOT_AVAILBLE
#define | GNUTLS_E_PKCS11_SESSION_ERROR
#define | GNUTLS_E_PKCS11_SIGNATURE_ERROR
#define | GNUTLS_E_PKCS11_SLOT_ERROR
#define | GNUTLS_E_PKCS11_TOKEN_ERROR
#define | GNUTLS_E_PKCS11_UNSUPPORTED_FEATURE_ERROR
#define | GNUTLS_E_PKCS11_USER_ERROR
#define | GNUTLS_E_PKCS1_WRONG_PAD
#define | GNUTLS_E_PK_DECRYPTION_FAILED
#define | GNUTLS_E_PK_ENCRYPTION_FAILED
#define | GNUTLS_E_PK_SIGN_FAILED
#define | GNUTLS_E_PK_SIG_VERIFY_FAILED
#define | GNUTLS_E_PREMATURE_TERMINATION
#define | GNUTLS_E_PULL_ERROR
#define | GNUTLS_E_PUSH_ERROR
#define | GNUTLS_E_RANDOM_FAILED
#define | GNUTLS_E_RECEIVED_ILLEGAL_EXTENSION
#define | GNUTLS_E_RECEIVED_ILLEGAL_PARAMETER
#define | GNUTLS_E_RECORD_LIMIT_REACHED
#define | GNUTLS_E_REHANDSHAKE
#define | GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE
#define | GNUTLS_E_SAFE_RENEGOTIATION_FAILED
#define | GNUTLS_E_SESSION_EOF
#define | GNUTLS_E_SHORT_MEMORY_BUFFER
#define | GNUTLS_E_SRP_PWD_ERROR
#define | GNUTLS_E_SRP_PWD_PARSING_ERROR
#define | GNUTLS_E_SUCCESS
#define | GNUTLS_E_TIMEDOUT
#define | GNUTLS_E_TOO_MANY_EMPTY_PACKETS
#define | GNUTLS_E_TOO_MANY_HANDSHAKE_PACKETS
#define | GNUTLS_E_TPM_ERROR
#define | GNUTLS_E_TPM_KEY_NOT_FOUND
#define | GNUTLS_E_TPM_KEY_PASSWORD_ERROR
#define | GNUTLS_E_TPM_SESSION_ERROR
#define | GNUTLS_E_TPM_SRK_PASSWORD_ERROR
#define | GNUTLS_E_TPM_UNINITIALIZED
#define | GNUTLS_E_UNEXPECTED_HANDSHAKE_PACKET
#define | GNUTLS_E_UNEXPECTED_PACKET
#define | GNUTLS_E_UNEXPECTED_PACKET_LENGTH
#define | GNUTLS_E_UNIMPLEMENTED_FEATURE
#define | GNUTLS_E_UNKNOWN_ALGORITHM
#define | GNUTLS_E_UNKNOWN_CIPHER_SUITE
#define | GNUTLS_E_UNKNOWN_CIPHER_TYPE
#define | GNUTLS_E_UNKNOWN_COMPRESSION_ALGORITHM
#define | GNUTLS_E_UNKNOWN_HASH_ALGORITHM
#define | GNUTLS_E_UNKNOWN_PKCS_BAG_TYPE
#define | GNUTLS_E_UNKNOWN_PKCS_CONTENT_TYPE
#define | GNUTLS_E_UNKNOWN_PK_ALGORITHM
#define | GNUTLS_E_UNKNOWN_SRP_USERNAME
#define | GNUTLS_E_UNSAFE_RENEGOTIATION_DENIED
#define | GNUTLS_E_UNSUPPORTED_CERTIFICATE_TYPE
#define | GNUTLS_E_UNSUPPORTED_SIGNATURE_ALGORITHM
#define | GNUTLS_E_UNSUPPORTED_VERSION_PACKET
#define | GNUTLS_E_UNWANTED_ALGORITHM
#define | GNUTLS_E_USER_ERROR
#define | GNUTLS_E_WARNING_ALERT_RECEIVED
#define | GNUTLS_E_WARNING_IA_FPHF_RECEIVED
#define | GNUTLS_E_WARNING_IA_IPHF_RECEIVED
#define | GNUTLS_E_X509_CERTIFICATE_ERROR
#define | GNUTLS_E_X509_UNKNOWN_SAN
#define | GNUTLS_E_X509_UNSUPPORTED_ATTRIBUTE
#define | GNUTLS_E_X509_UNSUPPORTED_CRITICAL_EXTENSION
#define | GNUTLS_E_X509_UNSUPPORTED_EXTENSION
#define | GNUTLS_E_X509_UNSUPPORTED_OID
#define | GNUTLS_HEARTBEAT_WAIT
#define | GNUTLS_KEY_CRL_SIGN
#define | GNUTLS_KEY_DATA_ENCIPHERMENT
#define | GNUTLS_KEY_DECIPHER_ONLY
#define | GNUTLS_KEY_DIGITAL_SIGNATURE
#define | GNUTLS_KEY_ENCIPHER_ONLY
#define | GNUTLS_KEY_KEY_AGREEMENT
#define | GNUTLS_KEY_KEY_CERT_SIGN
#define | GNUTLS_KEY_KEY_ENCIPHERMENT
#define | GNUTLS_KEY_NON_REPUDIATION
#define | GNUTLS_MAC_SHA
#define | GNUTLS_MAX_ALGORITHM_NUM
#define | GNUTLS_MAX_SESSION_ID
#define | GNUTLS_PKCS11_PIN_CONTEXT_SPECIFIC
#define | GNUTLS_PKCS11_PIN_COUNT_LOW
#define | GNUTLS_PKCS11_PIN_FINAL_TRY
#define | GNUTLS_PKCS11_PIN_SO
#define | GNUTLS_PKCS11_PIN_USER
#define | GNUTLS_PKCS11_PIN_WRONG
#define | GNUTLS_PK_ECC
#define | GNUTLS_SERVER
#define | GNUTLS_VERSION
#define | GNUTLS_VERSION_MAJOR
#define | GNUTLS_VERSION_MINOR
#define | GNUTLS_VERSION_NUMBER
#define | GNUTLS_VERSION_PATCH
#define | HAVE_SSIZE_T
enum | gnutls_alert_description_t
enum | gnutls_alert_level_t
struct | gnutls_certificate_credentials_st
enum | gnutls_certificate_print_formats_t
enum | gnutls_certificate_request_t
enum | gnutls_certificate_status_t
enum | gnutls_certificate_type_t
enum | gnutls_channel_binding_t
enum | gnutls_cipher_algorithm_t
enum | gnutls_close_request_t
enum | gnutls_compression_method_t
#define | gnutls_cred_set
enum | gnutls_credentials_type_t
struct | gnutls_dh_params_int
typedef | gnutls_dh_params_t
enum | gnutls_digest_algorithm_t
enum | gnutls_ecc_curve_t
enum | gnutls_handshake_description_t
enum | gnutls_kx_algorithm_t
enum | gnutls_mac_algorithm_t
| gnutls_openpgp_crt_int
enum | gnutls_openpgp_crt_status_t
typedef | gnutls_openpgp_crt_t
| gnutls_openpgp_keyring_int
typedef | gnutls_openpgp_keyring_t
| gnutls_openpgp_privkey_int
typedef | gnutls_openpgp_privkey_t
enum | gnutls_params_type_t
#define | gnutls_pem_base64_decode_alloc
#define | gnutls_pem_base64_encode_alloc
enum | gnutls_pin_flag_t
enum | gnutls_pk_algorithm_t
struct | gnutls_pkcs11_privkey_st
typedef | gnutls_pkcs11_privkey_t
struct | gnutls_priority_st
typedef | gnutls_priority_t
enum | gnutls_privkey_type_t
enum | gnutls_protocol_t
enum | gnutls_psk_key_flags
enum | gnutls_random_art_t
#define | gnutls_read
typedef | gnutls_rsa_params_t
enum | gnutls_sec_param_t
enum | gnutls_server_name_type_t
struct | gnutls_session_int
typedef | gnutls_session_t
#define | gnutls_sign_algorithm_get_name
enum | gnutls_sign_algorithm_t
#define | gnutls_srp_base64_decode_alloc
#define | gnutls_srp_base64_encode_alloc
enum | gnutls_srtp_profile_t
enum | gnutls_supplemental_data_format_type_t
struct | gnutls_tdb_int
typedef | gnutls_tdb_t
typedef | gnutls_transport_ptr_t
#define | gnutls_write
| gnutls_x509_crl_int
typedef | gnutls_x509_crl_t
| gnutls_x509_crq_int
typedef | gnutls_x509_crq_t
enum | gnutls_x509_crt_fmt_t
| gnutls_x509_crt_int
typedef | gnutls_x509_crt_t
| gnutls_x509_privkey_int
typedef | gnutls_x509_privkey_t
enum | gnutls_x509_subject_alt_name_t

## Description

## Functions

### GNUTLS_CLIENT

    #define GNUTLS_CLIENT (1<<1)

### GNUTLS_DATAGRAM

    #define GNUTLS_DATAGRAM (1<<2)

### GNUTLS_DEFAULT_HANDSHAKE_TIMEOUT

    #define GNUTLS_DEFAULT_HANDSHAKE_TIMEOUT ((unsigned int)-1)

### GNUTLS_HB_LOCAL_ALLOWED_TO_SEND

    #define GNUTLS_HB_LOCAL_ALLOWED_TO_SEND (1<<2)

### GNUTLS_HB_PEER_ALLOWED_TO_SEND

    #define GNUTLS_HB_PEER_ALLOWED_TO_SEND (1)

### GNUTLS_HB_PEER_NOT_ALLOWED_TO_SEND

    #define GNUTLS_HB_PEER_NOT_ALLOWED_TO_SEND (1<<1)

### GNUTLS_NONBLOCK

    #define GNUTLS_NONBLOCK (1<<3)

### GNUTLS_NO_EXTENSIONS

    #define GNUTLS_NO_EXTENSIONS (1<<4)

### gnutls_alert_get ()

    gnutls_alert_description_t
    gnutls_alert_get (gnutls_session_t session);

This function will return the last alert number received. This function should be called when `GNUTLS_E_WARNING_ALERT_RECEIVED` or `GNUTLS_E_FATAL_ALERT_RECEIVED` errors are returned by a gnutls function. The peer may send alerts if he encounters an error. If no alert has been received the returned value is undefined.

#### Parameters

session | is a gnutls_session_t type. |

#### Returns

the last alert received, a gnutls_alert_description_t value.

### gnutls_alert_get_name ()

    const char *
    gnutls_alert_get_name (gnutls_alert_description_t alert);

This function will return a string that describes the given alert number, or `NULL`. See `gnutls_alert_get()`.

#### Parameters

alert | is an alert number. |

#### Returns

string corresponding to gnutls_alert_description_t value.

### gnutls_alert_get_strname ()

    const char *
    gnutls_alert_get_strname (gnutls_alert_description_t alert);

This function will return a string of the name of the alert.

#### Parameters

alert | is an alert number. |

#### Returns

string corresponding to gnutls_alert_description_t value.

Since: 3.0

### gnutls_alert_send ()

    int
    gnutls_alert_send (gnutls_session_t session,
                       gnutls_alert_level_t level,
                       gnutls_alert_description_t desc);

This function will send an alert to the peer in order to inform him of something important (eg. his Certificate could not be verified). If the alert level is Fatal then the peer is expected to close the connection, otherwise he may ignore the alert and continue.

The error code of the underlying record send function will be returned, so you may also receive `GNUTLS_E_INTERRUPTED` or `GNUTLS_E_AGAIN` as well.

#### Parameters

session | is a gnutls_session_t type. |
level | is the level of the alert |
desc | is the alert description |

#### Returns

On success, `GNUTLS_E_SUCCESS` (0) is returned, otherwise an error code is returned.

### gnutls_alert_send_appropriate ()

    int
    gnutls_alert_send_appropriate (gnutls_session_t session,
                                   int err);

Sends an alert to the peer depending on the error code returned by a gnutls function. This function will call `gnutls_error_to_alert()` to determine the appropriate alert to send.

This function may also return `GNUTLS_E_AGAIN`, or `GNUTLS_E_INTERRUPTED`.

If the return value is `GNUTLS_E_INVALID_REQUEST`, then no alert has been sent to the peer.

#### Parameters

session | is a gnutls_session_t type. |
err | is an integer |

#### Returns

On success, `GNUTLS_E_SUCCESS` (0) is returned, otherwise an error code is returned.

### gnutls_alloc_function ()

    void *
    (*gnutls_alloc_function) (size_t Param1);

### gnutls_anon_allocate_client_credentials ()

    int
    gnutls_anon_allocate_client_credentials
                                   (gnutls_anon_client_credentials_t *sc);

This structure is complex enough to manipulate directly thus this helper function is provided in order to allocate it.

#### Parameters

sc | is a pointer to a gnutls_anon_client_credentials_t type. |

#### Returns

`GNUTLS_E_SUCCESS` on success, or an error code.

### gnutls_anon_allocate_server_credentials ()

    int
    gnutls_anon_allocate_server_credentials
                                   (gnutls_anon_server_credentials_t *sc);

This structure is complex enough to manipulate directly thus this helper function is provided in order to allocate it.

#### Parameters

sc | is a pointer to a gnutls_anon_server_credentials_t type. |

#### Returns

`GNUTLS_E_SUCCESS` on success, or an error code.

### gnutls_anon_free_client_credentials ()

    void
    gnutls_anon_free_client_credentials (gnutls_anon_client_credentials_t sc);

This structure is complex enough to manipulate directly thus this helper function is provided in order to free (deallocate) it.

#### Parameters

sc | is a gnutls_anon_client_credentials_t type. |

### gnutls_anon_free_server_credentials ()

    void
    gnutls_anon_free_server_credentials (gnutls_anon_server_credentials_t sc);

This structure is complex enough to manipulate directly thus this helper function is provided in order to free (deallocate) it.

#### Parameters

sc | is a gnutls_anon_server_credentials_t type. |

### gnutls_anon_set_params_function ()

    void
    gnutls_anon_set_params_function (gnutls_anon_server_credentials_t res,
                                     gnutls_params_function *func);

This function will set a callback in order for the server to get the Diffie-Hellman or RSA parameters for anonymous authentication. The callback should return `GNUTLS_E_SUCCESS` (0) on success.

#### Parameters

res | is a gnutls_anon_server_credentials_t type |
func | is the function to be called |

### gnutls_anon_set_server_dh_params ()

    void
    gnutls_anon_set_server_dh_params (gnutls_anon_server_credentials_t res,
                                      gnutls_dh_params_t dh_params);

This function will set the Diffie-Hellman parameters for an anonymous server to use. These parameters will be used in Anonymous Diffie-Hellman cipher suites.

#### Parameters

res | is a gnutls_anon_server_credentials_t type |
dh_params | The Diffie-Hellman parameters. |

### gnutls_anon_set_server_params_function ()

    void
    gnutls_anon_set_server_params_function
                                   (gnutls_anon_server_credentials_t res,
                                    gnutls_params_function *func);

This function will set a callback in order for the server to get the Diffie-Hellman parameters for anonymous authentication. The callback should return `GNUTLS_E_SUCCESS` (0) on success.

#### Parameters

res | is a gnutls_certificate_credentials_t type |
func | is the function to be called |

### gnutls_audit_log_func ()

    void
    (*gnutls_audit_log_func) (gnutls_session_t Param1,
                              const char *Param2);

### gnutls_bye ()

    int
    gnutls_bye (gnutls_session_t session,
                gnutls_close_request_t how);

Terminates the current TLS/SSL connection. The connection should have been initiated using `gnutls_handshake()`. `how` should be one of `GNUTLS_SHUT_RDWR`, `GNUTLS_SHUT_WR`.

In case of `GNUTLS_SHUT_RDWR` the TLS session gets terminated and further receives and sends will be disallowed. If the return value is zero you may continue using the underlying transport layer. `GNUTLS_SHUT_RDWR` sends an alert containing a close request and waits for the peer to reply with the same message.

In case of `GNUTLS_SHUT_WR` the TLS session gets terminated and further sends will be disallowed. In order to reuse the connection you should wait for an EOF from the peer. `GNUTLS_SHUT_WR` sends an alert containing a close request.

Note that not all implementations will properly terminate a TLS connection. Some of them, usually for performance reasons, will terminate only the underlying transport layer, and thus not distinguishing between a malicious party prematurely terminating the connection and normal termination.

This function may also return `GNUTLS_E_AGAIN` or `GNUTLS_E_INTERRUPTED`; cf. `gnutls_record_get_direction()`.

#### Parameters

session | is a gnutls_session_t type. |
how | is an integer |

#### Returns

`GNUTLS_E_SUCCESS` on success, or an error code, see function documentation for entire semantics.

### gnutls_calloc_function ()

    void *
    (*gnutls_calloc_function) (size_t Param1,
                               size_t Param2);

### gnutls_certificate_activation_time_peers ()

    time_t
    gnutls_certificate_activation_time_peers
                                   (gnutls_session_t session);

`gnutls_certificate_activation_time_peers` is deprecated and should not be used in newly-written code.

gnutls_certificate_verify_peers2() now verifies activation times.

This function will return the peer's certificate activation time. This is the creation time for openpgp keys.

#### Parameters

session | is a gnutls session |

#### Returns

(time_t)-1 on error.

### gnutls_certificate_allocate_credentials ()

    int
    gnutls_certificate_allocate_credentials
                                   (gnutls_certificate_credentials_t *res);

This structure is complex enough to manipulate directly thus this helper function is provided in order to allocate it.

#### Parameters

res | is a pointer to a gnutls_certificate_credentials_t type. |

#### Returns

`GNUTLS_E_SUCCESS` on success, or an error code.

### gnutls_certificate_client_get_request_status ()

    int
    gnutls_certificate_client_get_request_status
                                   (gnutls_session_t session);

Get whether client certificate is requested or not.

#### Parameters

session | is a gnutls session |

#### Returns

0 if the peer (server) did not request client authentication or 1 otherwise.

### gnutls_certificate_expiration_time_peers ()

    time_t
    gnutls_certificate_expiration_time_peers
                                   (gnutls_session_t session);

`gnutls_certificate_expiration_time_peers` is deprecated and should not be used in newly-written code.

gnutls_certificate_verify_peers2() now verifies expiration times.

This function will return the peer's certificate expiration time.

#### Parameters

session | is a gnutls session |

#### Returns

(time_t)-1 on error.

### gnutls_certificate_free_ca_names ()

    void
    gnutls_certificate_free_ca_names (gnutls_certificate_credentials_t sc);

This function will delete all the CA name in the given credentials. Clients may call this to save some memory since in client side the CA names are not used. Servers might want to use this function if a large list of trusted CAs is present and sending the names of it would just consume bandwidth without providing information to client.

CA names are used by servers to advertise the CAs they support to clients.

#### Parameters

sc | is a gnutls_certificate_credentials_t type. |

### gnutls_certificate_free_cas ()

    void
    gnutls_certificate_free_cas (gnutls_certificate_credentials_t sc);

This function will delete all the CAs associated with the given credentials. Servers that do not use `gnutls_certificate_verify_peers2()` may call this to save some memory.

#### Parameters

sc | is a gnutls_certificate_credentials_t type. |

### gnutls_certificate_free_credentials ()

    void
    gnutls_certificate_free_credentials (gnutls_certificate_credentials_t sc);

This structure is complex enough to manipulate directly thus this helper function is provided in order to free (deallocate) it.

This function does not free any temporary parameters associated with this structure (ie RSA and DH parameters are not freed by this function).

#### Parameters

sc | is a gnutls_certificate_credentials_t type. |

### gnutls_certificate_free_crls ()

    void
    gnutls_certificate_free_crls (gnutls_certificate_credentials_t sc);

This function will delete all the CRLs associated with the given credentials.

#### Parameters

sc | is a gnutls_certificate_credentials_t type. |

### gnutls_certificate_free_keys ()

    void
    gnutls_certificate_free_keys (gnutls_certificate_credentials_t sc);

This function will delete all the keys and the certificates associated with the given credentials. This function must not be called when a TLS negotiation that uses the credentials is in progress.

#### Parameters

sc | is a gnutls_certificate_credentials_t type. |

### gnutls_certificate_get_issuer ()

    int
    gnutls_certificate_get_issuer (gnutls_certificate_credentials_t sc,
                                   gnutls_x509_crt_t cert,
                                   gnutls_x509_crt_t *issuer,
                                   unsigned int flags);

This function will return the issuer of a given certificate. As with `gnutls_x509_trust_list_get_issuer()` this function requires the `GNUTLS_TL_GET_COPY` flag in order to operate with PKCS 11 trust lists. In that case the issuer must be freed using `gnutls_x509_crt_deinit()`.

#### Parameters

sc | is a gnutls_certificate_credentials_t type. |
cert | is the certificate to find issuer for |
issuer | Will hold the issuer if any. Should be treated as constant. |
flags | Use zero or `GNUTLS_TL_GET_COPY` |

#### Returns

On success, `GNUTLS_E_SUCCESS` (0) is returned, otherwise a negative error value.

Since: 3.0

### gnutls_certificate_get_ours ()

    const gnutls_datum_t *
    gnutls_certificate_get_ours (gnutls_session_t session);

Gets the certificate as sent to the peer in the last handshake. The certificate is in raw (DER) format. No certificate list is being returned. Only the first certificate.

#### Parameters

session | is a gnutls session |

#### Returns

a pointer to a gnutls_datum_t containing our certificate, or `NULL` in case of an error or if no certificate was used.

### gnutls_certificate_get_peers ()

    const gnutls_datum_t *
    gnutls_certificate_get_peers (gnutls_session_t session,
                                  unsigned int *list_size);

Get the peer's raw certificate (chain) as sent by the peer. These certificates are in raw format (DER encoded for X.509). In case of a X.509 then a certificate list may be present. The first certificate in the list is the peer's certificate, following the issuer's certificate, then the issuer's issuer etc.

In case of OpenPGP keys a single key will be returned in raw format.

#### Parameters

session | is a gnutls session |
list_size | is the length of the certificate list (may be `NULL`) |

#### Returns

a pointer to a gnutls_datum_t containing the peer's certificates, or `NULL` in case of an error or if no certificate was used.

### gnutls_certificate_get_peers_subkey_id ()

    int
    gnutls_certificate_get_peers_subkey_id
                                   (gnutls_session_t session,
                                    gnutls_datum_t *id);

Get the peer's subkey ID when OpenPGP certificates are used. The returned `id` should be treated as constant.

#### Parameters

session | is a gnutls session |
id | will contain the ID |

#### Returns

On success, `GNUTLS_E_SUCCESS` (0) is returned, otherwise an error code is returned.

Since: 3.1.3

### gnutls_certificate_send_x509_rdn_sequence ()

    void
    gnutls_certificate_send_x509_rdn_sequence
                                   (gnutls_session_t session,
                                    int status);

If status is non zero, this function will order gnutls not to send the rdnSequence in the certificate request message. That is the server will not advertise its trusted CAs to the peer. If status is zero then the default behaviour will take effect, which is to advertise the server's trusted CAs.

This function has no effect in clients, and in authentication methods other than certificate with X.509 certificates.

#### Parameters

session | a gnutls_session_t type. |
status | is 0 or 1 |

### gnutls_certificate_server_set_request ()

    void
    gnutls_certificate_server_set_request (gnutls_session_t session,
                                           gnutls_certificate_request_t req);

This function specifies if we (in case of a server) are going to send a certificate request message to the client. If `req` is GNUTLS_CERT_REQUIRE then the server will return an error if the peer does not provide a certificate. If you do not call this function then the client will not be asked to send a certificate.

#### Parameters

session | is a gnutls_session_t type. |
req | is one of GNUTLS_CERT_REQUEST, GNUTLS_CERT_REQUIRE |

### gnutls_certificate_set_dh_params ()

    void
    gnutls_certificate_set_dh_params (gnutls_certificate_credentials_t res,
                                      gnutls_dh_params_t dh_params);

This function will set the Diffie-Hellman parameters for a certificate server to use. These parameters will be used in Ephemeral Diffie-Hellman cipher suites. Note that only a pointer to the parameters are stored in the certificate handle, so you must not deallocate the parameters before the certificate is deallocated.

#### Parameters

res | is a gnutls_certificate_credentials_t type |
dh_params | the Diffie-Hellman parameters. |

### gnutls_certificate_set_ocsp_status_request_file ()

    int
    gnutls_certificate_set_ocsp_status_request_file
                                   (gnutls_certificate_credentials_t res,
                                    const char *response_file,
                                    unsigned int flags);

This function sets the filename of an OCSP response, that will be sent to the client if requests an OCSP certificate status. This is a convenience function which is inefficient on busy servers since the file is opened on every access. Use `gnutls_certificate_set_ocsp_status_request_function()` to fine-tune file accesses.

#### Parameters

response_file | a filename of the OCSP response |
flags | should be zero |

#### Returns

On success, `GNUTLS_E_SUCCESS` (0) is returned, otherwise a negative error code is returned.

Since: 3.1.3

### gnutls_certificate_set_ocsp_status_request_function ()

    void
    gnutls_certificate_set_ocsp_status_request_function
                                   (gnutls_certificate_credentials_t res,
                                    gnutls_status_request_ocsp_func ocsp_func,
                                    void *ptr);

This function is to be used by server to register a callback to handle OCSP status requests from the client. The callback will be invoked if the client supplied a status-request OCSP extension. The callback function prototype is:

typedef int (*gnutls_status_request_ocsp_func) (gnutls_session_t session, void *ptr, gnutls_datum_t *ocsp_response);

The callback will be invoked if the client requests an OCSP certificate status. The callback may return `GNUTLS_E_NO_CERTIFICATE_STATUS`, if there is no recent OCSP response. If the callback returns `GNUTLS_E_SUCCESS`, the server will provide the client with the ocsp_response.

The response must be a value allocated using `gnutls_malloc()`, and will be deinitialized when needed.

#### Parameters

ocsp_func | function pointer to OCSP status request callback. |
ptr | opaque pointer passed to callback function |

Since: 3.1.3

### gnutls_certificate_set_params_function ()

    void
    gnutls_certificate_set_params_function
                                   (gnutls_certificate_credentials_t res,
                                    gnutls_params_function *func);

This function will set a callback in order for the server to get the Diffie-Hellman or RSA parameters for certificate authentication. The callback should return `GNUTLS_E_SUCCESS` (0) on success.

#### Parameters

res | is a gnutls_certificate_credentials_t type |
func | is the function to be called |

### gnutls_certificate_set_pin_function ()

    void
    gnutls_certificate_set_pin_function (gnutls_certificate_credentials_t Param1,
                                         gnutls_pin_callback_t fn,
                                         void *userdata);

### gnutls_certificate_set_retrieve_function ()

    void
    gnutls_certificate_set_retrieve_function
                                   (gnutls_certificate_credentials_t cred,
                                    gnutls_certificate_retrieve_function *func);

This function sets a callback to be called in order to retrieve the certificate to be used in the handshake. The callback will take control only if a certificate is requested by the peer. You are advised to use `gnutls_certificate_set_retrieve_function2()` because it is much more efficient in the processing it requires from gnutls.

The callback's function prototype is: int (*callback)(gnutls_session_t, const gnutls_datum_t* req_ca_dn, int nreqs, const gnutls_pk_algorithm_t* pk_algos, int pk_algos_length, gnutls_retr2_st* st);

`req_ca_dn` is only used in X.509 certificates. Contains a list with the CA names that the server considers trusted. This is a hint and typically the client should send a certificate that is signed by one of these CAs. These names, when available, are DER encoded. To get a more meaningful value use the function `gnutls_x509_rdn_get()`.

`pk_algos` contains a list with server's acceptable signature algorithms. The certificate returned should support the server's given algorithms.

`st` should contain the certificates and private keys.

If the callback function is provided then gnutls will call it, in the handshake, after the certificate request message has been received.

In server side pk_algos and req_ca_dn are NULL.

The callback function should set the certificate list to be sent, and return 0 on success. If no certificate was selected then the number of certificates should be set to zero. The value (-1) indicates error and the handshake will be terminated. If both certificates are set in the credentials and a callback is available, the callback takes predence.

#### Parameters

cred | is a gnutls_certificate_credentials_t type. |
func | is the callback function |

Since: 3.0

### gnutls_certificate_set_verify_flags ()

    void
    gnutls_certificate_set_verify_flags (gnutls_certificate_credentials_t res,
                                         unsigned int flags);

This function will set the flags to be used for verification of certificates and override any defaults. The provided flags must be an OR of the gnutls_certificate_verify_flags enumerations.

#### Parameters

res | is a gnutls_certificate_credentials_t type |
flags | are the flags |

### gnutls_certificate_set_verify_function ()

    void
    gnutls_certificate_set_verify_function
                                   (gnutls_certificate_credentials_t cred,
                                    gnutls_certificate_verify_function *func);

This function sets a callback to be called when peer's certificate has been received in order to verify it on receipt rather than doing after the handshake is completed.

The callback's function prototype is: int (*callback)(gnutls_session_t);

If the callback function is provided then gnutls will call it, in the handshake, just after the certificate message has been received. To verify or obtain the certificate the `gnutls_certificate_verify_peers2()`, `gnutls_certificate_type_get()`, `gnutls_certificate_get_peers()` functions can be used.

The callback function should return 0 for the handshake to continue or non-zero to terminate.

#### Parameters

cred | is a gnutls_certificate_credentials_t type. |
func | is the callback function |

Since: 2.10.0

### gnutls_certificate_set_verify_limits ()

    void
    gnutls_certificate_set_verify_limits (gnutls_certificate_credentials_t res,
                                          unsigned int max_bits,
                                          unsigned int max_depth);

This function will set some upper limits for the default verification function, `gnutls_certificate_verify_peers2()`, to avoid denial of service attacks. You can set them to zero to disable limits.

#### Parameters

res | is a gnutls_certificate_credentials type |
max_bits | is the number of bits of an acceptable certificate (default 8200) |
max_depth | is maximum depth of the verification of a certificate chain (default 5) |

### gnutls_certificate_set_x509_crl ()

    int
    gnutls_certificate_set_x509_crl (gnutls_certificate_credentials_t res,
                                     gnutls_x509_crl_t *crl_list,
                                     int crl_list_size);

This function adds the trusted CRLs in order to verify client or server certificates. In case of a client this is not required to be called if the certificates are not verified using `gnutls_certificate_verify_peers2()`. This function may be called multiple times.

#### Parameters

res | is a gnutls_certificate_credentials_t type. |
crl_list | is a list of trusted CRLs. They should have been verified before. |
crl_list_size | holds the size of the crl_list |

#### Returns

number of CRLs processed, or a negative error code on error.

Since: 2.4.0

### gnutls_certificate_set_x509_crl_file ()

    int
    gnutls_certificate_set_x509_crl_file (gnutls_certificate_credentials_t res,
                                          const char *crlfile,
                                          gnutls_x509_crt_fmt_t type);

This function adds the trusted CRLs in order to verify client or server certificates. In case of a client this is not required to be called if the certificates are not verified using `gnutls_certificate_verify_peers2()`. This function may be called multiple times.

#### Parameters

res | is a gnutls_certificate_credentials_t type. |
crlfile | is a file containing the list of verified CRLs (DER or PEM list) |
type | is PEM or DER |

#### Returns

number of CRLs processed or a negative error code on error.

### gnutls_certificate_set_x509_crl_mem ()

    int
    gnutls_certificate_set_x509_crl_mem (gnutls_certificate_credentials_t res,
                                         const gnutls_datum_t *CRL,
                                         gnutls_x509_crt_fmt_t type);

This function adds the trusted CRLs in order to verify client or server certificates. In case of a client this is not required to be called if the certificates are not verified using `gnutls_certificate_verify_peers2()`. This function may be called multiple times.

#### Parameters

res | is a gnutls_certificate_credentials_t type. |
CRL | is a list of trusted CRLs. They should have been verified before. |
type | is DER or PEM |

#### Returns

number of CRLs processed, or a negative error code on error.

### gnutls_certificate_set_x509_key ()

    int
    gnutls_certificate_set_x509_key (gnutls_certificate_credentials_t res,
                                     gnutls_x509_crt_t *cert_list,
                                     int cert_list_size,
                                     gnutls_x509_privkey_t key);

This function sets a certificate/private key pair in the gnutls_certificate_credentials_t type. This function may be called more than once, in case multiple keys/certificates exist for the server. For clients that wants to send more than their own end entity certificate (e.g., also an intermediate CA cert) then put the certificate chain in `cert_list` .

Note that the certificates and keys provided, can be safely deinitialized after this function is called.

If that function fails to load the `res` type is at an undefined state, it must not be reused to load other keys or certificates.

#### Parameters

res | is a gnutls_certificate_credentials_t type. |
cert_list | contains a certificate list (path) for the specified private key |
cert_list_size | holds the size of the certificate list |
key | is a gnutls_x509_privkey_t key |

#### Returns

`GNUTLS_E_SUCCESS` (0) on success, or a negative error code.

Since: 2.4.0

### gnutls_certificate_set_x509_key_file ()

    int
    gnutls_certificate_set_x509_key_file (gnutls_certificate_credentials_t res,
                                          const char *certfile,
                                          const char *keyfile,
                                          gnutls_x509_crt_fmt_t type);

This function sets a certificate/private key pair in the gnutls_certificate_credentials_t type. This function may be called more than once, in case multiple keys/certificates exist for the server. For clients that need to send more than its own end entity certificate, e.g., also an intermediate CA cert, then the `certfile` must contain the ordered certificate chain.

Note that the names in the certificate provided will be considered when selecting the appropriate certificate to use (in case of multiple certificate/key pairs).

This function can also accept URLs at `keyfile` and `certfile` . In that case it will use the private key and certificate indicated by the URLs. Note that the supported URLs are the ones indicated by `gnutls_url_is_supported()`.

In case the `certfile` is provided as a PKCS 11 URL, then the certificate, and its present issuers in the token are imported (i.e., forming the required trust chain).

If that function fails to load the `res` structure is at an undefined state, it must not be reused to load other keys or certificates.

#### Parameters

res | is a gnutls_certificate_credentials_t type. |
certfile | is a file that containing the certificate list (path) for the specified private key, in PKCS7 format, or a list of certificates |
keyfile | is a file that contains the private key |
type | is PEM or DER |

#### Returns

`GNUTLS_E_SUCCESS` (0) on success, or a negative error code.

Since: 3.1.11

### gnutls_certificate_set_x509_key_mem ()

    int
    gnutls_certificate_set_x509_key_mem (gnutls_certificate_credentials_t res,
                                         const gnutls_datum_t *cert,
                                         const gnutls_datum_t *key,
                                         gnutls_x509_crt_fmt_t type);

This function sets a certificate/private key pair in the gnutls_certificate_credentials_t type. This function may be called more than once, in case multiple keys/certificates exist for the server.

Note that the keyUsage (2.5.29.15) PKIX extension in X.509 certificates is supported. This means that certificates intended for signing cannot be used for ciphersuites that require encryption.

If the certificate and the private key are given in PEM encoding then the strings that hold their values must be null terminated.

The `key` may be `NULL` if you are using a sign callback, see `gnutls_sign_callback_set()`.

#### Parameters

res | is a gnutls_certificate_credentials_t type. |
cert | contains a certificate list (path) for the specified private key |
key | is the private key, or `NULL` |
type | is PEM or DER |

#### Returns

`GNUTLS_E_SUCCESS` (0) on success, or a negative error code.

### gnutls_certificate_set_x509_simple_pkcs12_file ()

    int
    gnutls_certificate_set_x509_simple_pkcs12_file
                                   (gnutls_certificate_credentials_t res,
                                    const char *pkcs12file,
                                    gnutls_x509_crt_fmt_t type,
                                    const char *password);

This function sets a certificate/private key pair and/or a CRL in the gnutls_certificate_credentials_t type. This function may be called more than once (in case multiple keys/certificates exist for the server).

PKCS12 files with a MAC, encrypted bags and PKCS #8 private keys are supported. However, only password based security, and the same password for all operations, are supported.

PKCS12 file may contain many keys and/or certificates, and this function will try to auto-detect based on the key ID the certificate and key pair to use. If the PKCS12 file contain the issuer of the selected certificate, it will be appended to the certificate to form a chain.

If more than one private keys are stored in the PKCS12 file, then only one key will be read (and it is undefined which one).

It is believed that the limitations of this function is acceptable for most usage, and that any more flexibility would introduce complexity that would make it harder to use this functionality at all.

#### Parameters

res | is a gnutls_certificate_credentials_t type. |
pkcs12file | filename of file containing PKCS12 blob. |
type | is PEM or DER of the `pkcs12file` . |
password | optional password used to decrypt PKCS12 file, bags and keys. |

#### Returns

`GNUTLS_E_SUCCESS` (0) on success, or a negative error code.

### gnutls_certificate_set_x509_simple_pkcs12_mem ()

    int
    gnutls_certificate_set_x509_simple_pkcs12_mem
                                   (gnutls_certificate_credentials_t res,
                                    const gnutls_datum_t *p12blob,
                                    gnutls_x509_crt_fmt_t type,
                                    const char *password);

This function sets a certificate/private key pair and/or a CRL in the gnutls_certificate_credentials_t type. This function may be called more than once (in case multiple keys/certificates exist for the server).

Encrypted PKCS12 bags and PKCS#8 private keys are supported. However, only password based security, and the same password for all operations, are supported.

PKCS12 file may contain many keys and/or certificates, and this function will try to auto-detect based on the key ID the certificate and key pair to use. If the PKCS12 file contain the issuer of the selected certificate, it will be appended to the certificate to form a chain.

If more than one private keys are stored in the PKCS12 file, then only one key will be read (and it is undefined which one).

It is believed that the limitations of this function is acceptable for most usage, and that any more flexibility would introduce complexity that would make it harder to use this functionality at all.

#### Parameters

res | is a gnutls_certificate_credentials_t type. |
p12blob | the PKCS12 blob. |
type | is PEM or DER of the `pkcs12file` . |
password | optional password used to decrypt PKCS12 file, bags and keys. |

#### Returns

`GNUTLS_E_SUCCESS` (0) on success, or a negative error code.

Since: 2.8.0

### gnutls_certificate_set_x509_system_trust ()

    int
    gnutls_certificate_set_x509_system_trust
                                   (gnutls_certificate_credentials_t cred);

This function adds the system's default trusted CAs in order to verify client or server certificates.

In the case the system is currently unsupported `GNUTLS_E_UNIMPLEMENTED_FEATURE` is returned.

#### Parameters

cred | is a gnutls_certificate_credentials_t type. |

#### Returns

the number of certificates processed or a negative error code on error.

Since: 3.0.20

### gnutls_certificate_set_x509_trust ()

    int
    gnutls_certificate_set_x509_trust (gnutls_certificate_credentials_t res,
                                       gnutls_x509_crt_t *ca_list,
                                       int ca_list_size);

This function adds the trusted CAs in order to verify client or server certificates. In case of a client this is not required to be called if the certificates are not verified using `gnutls_certificate_verify_peers2()`. This function may be called multiple times.

In case of a server the CAs set here will be sent to the client if a certificate request is sent. This can be disabled using `gnutls_certificate_send_x509_rdn_sequence()`.

#### Parameters

res | is a gnutls_certificate_credentials_t type. |
ca_list | is a list of trusted CAs |
ca_list_size | holds the size of the CA list |

#### Returns

the number of certificates processed or a negative error code on error.

Since: 2.4.0

### gnutls_certificate_set_x509_trust_file ()

    int
    gnutls_certificate_set_x509_trust_file
                                   (gnutls_certificate_credentials_t cred,
                                    const char *cafile,
                                    gnutls_x509_crt_fmt_t type);

This function adds the trusted CAs in order to verify client or server certificates. In case of a client this is not required to be called if the certificates are not verified using `gnutls_certificate_verify_peers2()`. This function may be called multiple times.

In case of a server the names of the CAs set here will be sent to the client if a certificate request is sent. This can be disabled using `gnutls_certificate_send_x509_rdn_sequence()`.

This function can also accept URLs. In that case it will import all certificates that are marked as trusted. Note that the supported URLs are the ones indicated by `gnutls_url_is_supported()`.

#### Parameters

cred | is a gnutls_certificate_credentials_t type. |
cafile | is a file containing the list of trusted CAs (DER or PEM list) |
type | is PEM or DER |

#### Returns

the number of certificates processed

### gnutls_certificate_set_x509_trust_mem ()

    int
    gnutls_certificate_set_x509_trust_mem (gnutls_certificate_credentials_t res,
                                           const gnutls_datum_t *ca,
                                           gnutls_x509_crt_fmt_t type);

This function adds the trusted CAs in order to verify client or server certificates. In case of a client this is not required to be called if the certificates are not verified using `gnutls_certificate_verify_peers2()`. This function may be called multiple times.

In case of a server the CAs set here will be sent to the client if a certificate request is sent. This can be disabled using `gnutls_certificate_send_x509_rdn_sequence()`.

#### Parameters

res | is a gnutls_certificate_credentials_t type. |
ca | is a list of trusted CAs or a DER certificate |
type | is DER or PEM |

#### Returns

the number of certificates processed or a negative error code on error.

### gnutls_certificate_type_get ()

    gnutls_certificate_type_t
    gnutls_certificate_type_get (gnutls_session_t session);

The certificate type is by default X.509, unless it is negotiated as a TLS extension.

#### Parameters

session | is a gnutls_session_t type. |

#### Returns

the currently used gnutls_certificate_type_t certificate type.

### gnutls_certificate_type_get_id ()

    gnutls_certificate_type_t
    gnutls_certificate_type_get_id (const char *name);

The names are compared in a case insensitive way.

#### Parameters

name | is a certificate type name |

#### Returns

a gnutls_certificate_type_t for the specified in a string certificate type, or `GNUTLS_CRT_UNKNOWN` on error.

### gnutls_certificate_type_get_name ()

    const char *
    gnutls_certificate_type_get_name (gnutls_certificate_type_t type);

Convert a gnutls_certificate_type_t type to a string.

#### Parameters

type | is a certificate type |

#### Returns

a string that contains the name of the specified certificate type, or `NULL` in case of unknown types.

### gnutls_certificate_type_list ()

    const gnutls_certificate_type_t *
    gnutls_certificate_type_list (void);

Get a list of certificate types.

#### Returns

a (0)-terminated list of gnutls_certificate_type_t integers indicating the available certificate types.

### gnutls_certificate_verification_status_print ()

    int
    gnutls_certificate_verification_status_print
                                   (unsigned int status,
                                    gnutls_certificate_type_t type,
                                    gnutls_datum_t *out,
                                    unsigned int flags);

This function will pretty print the status of a verification process -- eg. the one obtained by `gnutls_certificate_verify_peers3()`.

The output `out` needs to be deallocated using `gnutls_free()`.

#### Parameters

status | The status flags to be printed |
type | The certificate type |
out | Newly allocated datum with (0) terminated string. |
flags | should be zero |

#### Returns

On success, `GNUTLS_E_SUCCESS` (0) is returned, otherwise a negative error value.

Since: 3.1.4

### gnutls_certificate_verify_peers2 ()

    int
    gnutls_certificate_verify_peers2 (gnutls_session_t session,
                                      unsigned int *status);

This function will verify the peer's certificate and store the status in the `status` variable as a bitwise or'd gnutls_certificate_status_t values or zero if the certificate is trusted. Note that value in `status` is set only when the return value of this function is success (i.e, failure to trust a certificate does not imply a negative return value). The default verification flags used by this function can be overridden using `gnutls_certificate_set_verify_flags()`.

This function will take into account the OCSP Certificate Status TLS extension, as well as the following X.509 certificate extensions: Name Constraints, Key Usage, and Basic Constraints (pathlen).

To avoid denial of service attacks some default upper limits regarding the certificate key size and chain size are set. To override them use `gnutls_certificate_set_verify_limits()`.

Note that you must also check the peer's name in order to check if the verified certificate belongs to the actual peer, see `gnutls_x509_crt_check_hostname()`, or use `gnutls_certificate_verify_peers3()`.

#### Parameters

session | is a gnutls session |
status | is the output of the verification |

#### Returns

a negative error code on error and `GNUTLS_E_SUCCESS` (0) on success.

### gnutls_certificate_verify_peers3 ()

    int
    gnutls_certificate_verify_peers3 (gnutls_session_t session,
                                      const char *hostname,
                                      unsigned int *status);

This function will verify the peer's certificate and store the status in the `status` variable as a bitwise or'd gnutls_certificate_status_t values or zero if the certificate is trusted. Note that value in `status` is set only when the return value of this function is success (i.e, failure to trust a certificate does not imply a negative return value). The default verification flags used by this function can be overridden using `gnutls_certificate_set_verify_flags()`. See the documentation of `gnutls_certificate_verify_peers2()` for details in the verification process.

If the `hostname` provided is non-NULL then this function will compare the hostname in the certificate against the given. The comparison will be accurate for ascii names; non-ascii names are compared byte-by-byte. If names do not match the `GNUTLS_CERT_UNEXPECTED_OWNER` status flag will be set.

In order to verify the purpose of the end-certificate (by checking the extended key usage), use `gnutls_certificate_verify_peers()`.

#### Parameters

session | is a gnutls session |
hostname | is the expected name of the peer; may be `NULL` |
status | is the output of the verification |

#### Returns

a negative error code on error and `GNUTLS_E_SUCCESS` (0) on success.

Since: 3.1.4

### gnutls_check_version ()

    const char *
    gnutls_check_version (const char *req_version);

Check GnuTLS Library version.

See `GNUTLS_VERSION` for a suitable `req_version` string.

#### Parameters

req_version | version string to compare with, or `NULL`. |

#### Returns

Check that the version of the library is at minimum the one given as a string in `req_version` and return the actual version string of the library; return `NULL` if the condition is not met. If `NULL` is passed to this function no check is done and only the version string is returned.

### gnutls_cipher_get ()

    gnutls_cipher_algorithm_t
    gnutls_cipher_get (gnutls_session_t session);

Get currently used cipher.

#### Parameters

session | is a gnutls_session_t type. |

#### Returns

the currently used cipher, a gnutls_cipher_algorithm_t type.

### gnutls_cipher_get_id ()

    gnutls_cipher_algorithm_t
    gnutls_cipher_get_id (const char *name);

The names are compared in a case insensitive way.

#### Parameters

name | is a cipher algorithm name |

#### Returns

return a gnutls_cipher_algorithm_t value corresponding to the specified cipher, or `GNUTLS_CIPHER_UNKNOWN` on error.

### gnutls_cipher_get_key_size ()

    size_t
    gnutls_cipher_get_key_size (gnutls_cipher_algorithm_t algorithm);

Get key size for cipher.

#### Parameters

algorithm | is an encryption algorithm |

#### Returns

length (in bytes) of the given cipher's key size, or 0 if the given cipher is invalid.

### gnutls_cipher_get_name ()

    const char *
    gnutls_cipher_get_name (gnutls_cipher_algorithm_t algorithm);

Convert a gnutls_cipher_algorithm_t type to a string.

#### Parameters

algorithm | is an encryption algorithm |

#### Returns

a pointer to a string that contains the name of the specified cipher, or `NULL`.

### gnutls_cipher_list ()

    const gnutls_cipher_algorithm_t *
    gnutls_cipher_list (void);

Get a list of supported cipher algorithms. Note that not necessarily all ciphers are supported as TLS cipher suites. For example, DES is not supported as a cipher suite, but is supported for other purposes (e.g., PKCS#8 or similar).

This function is not thread safe.

#### Returns

a (0)-terminated list of gnutls_cipher_algorithm_t integers indicating the available ciphers.

### gnutls_cipher_suite_get_name ()

    const char *
    gnutls_cipher_suite_get_name (gnutls_kx_algorithm_t kx_algorithm,
                                  gnutls_cipher_algorithm_t cipher_algorithm,
                                  gnutls_mac_algorithm_t mac_algorithm);

Note that the full cipher suite name must be prepended by TLS or SSL depending of the protocol in use.

#### Parameters

kx_algorithm | is a Key exchange algorithm |
cipher_algorithm | is a cipher algorithm |
mac_algorithm | is a MAC algorithm |

#### Returns

a string that contains the name of a TLS cipher suite, specified by the given algorithms, or `NULL`.

### gnutls_cipher_suite_info ()

    const char *
    gnutls_cipher_suite_info (size_t idx,
                              unsigned char *cs_id,
                              gnutls_kx_algorithm_t *kx,
                              gnutls_cipher_algorithm_t *cipher,
                              gnutls_mac_algorithm_t *mac,
                              gnutls_protocol_t *min_version);

Get information about supported cipher suites. Use the function iteratively to get information about all supported cipher suites. Call with idx=0 to get information about first cipher suite, then idx=1 and so on until the function returns NULL.

#### Parameters

idx | index of cipher suite to get information about, starts on 0. |
cs_id | output buffer with room for 2 bytes, indicating cipher suite value |
kx | output variable indicating key exchange algorithm, or `NULL`. |
cipher | output variable indicating cipher, or `NULL`. |
mac | output variable indicating MAC algorithm, or `NULL`. |
min_version | output variable indicating TLS protocol version, or `NULL`. |

#### Returns

the name of `idx` cipher suite, and set the information about the cipher suite in the output variables. If `idx` is out of bounds, `NULL` is returned.

### gnutls_compression_get ()

    gnutls_compression_method_t
    gnutls_compression_get (gnutls_session_t session);

Get currently used compression algorithm.

#### Parameters

session | is a gnutls_session_t type. |

#### Returns

the currently used compression method, a gnutls_compression_method_t value.

### gnutls_compression_get_id ()

    gnutls_compression_method_t
    gnutls_compression_get_id (const char *name);

The names are compared in a case insensitive way.

#### Parameters

name | is a compression method name |

#### Returns

an id of the specified in a string compression method, or `GNUTLS_COMP_UNKNOWN` on error.

### gnutls_compression_get_name ()

    const char *
    gnutls_compression_get_name (gnutls_compression_method_t algorithm);

Convert a gnutls_compression_method_t value to a string.

#### Parameters

algorithm | is a Compression algorithm |

#### Returns

a pointer to a string that contains the name of the specified compression algorithm, or `NULL`.

### gnutls_compression_list ()

    const gnutls_compression_method_t *
    gnutls_compression_list (void);

Get a list of compression methods.

#### Returns

a zero-terminated list of gnutls_compression_method_t integers indicating the available compression methods.

### gnutls_credentials_clear ()

    void
    gnutls_credentials_clear (gnutls_session_t session);

Clears all the credentials previously set in this session.

#### Parameters

session | is a gnutls_session_t type. |

### gnutls_credentials_set ()

    int
    gnutls_credentials_set (gnutls_session_t session,
                            gnutls_credentials_type_t type,
                            void *cred);

Sets the needed credentials for the specified type. Eg username, password - or public and private keys etc. The `cred` parameter is a structure that depends on the specified type and on the current session (client or server).

In order to minimize memory usage, and share credentials between several threads gnutls keeps a pointer to cred, and not the whole cred structure. Thus you will have to keep the structure allocated until you call `gnutls_deinit()`.

For `GNUTLS_CRD_ANON`, `cred` should be gnutls_anon_client_credentials_t in case of a client. In case of a server it should be gnutls_anon_server_credentials_t.

For `GNUTLS_CRD_SRP`, `cred` should be gnutls_srp_client_credentials_t in case of a client, and gnutls_srp_server_credentials_t, in case of a server.

For `GNUTLS_CRD_CERTIFICATE`, `cred` should be gnutls_certificate_credentials_t.

#### Parameters

session | is a gnutls_session_t type. |
type | is the type of the credentials |
cred | the credentials to set |

#### Returns

On success, `GNUTLS_E_SUCCESS` (0) is returned, otherwise a negative error code is returned.

### gnutls_db_check_entry ()

    int
    gnutls_db_check_entry (gnutls_session_t session,
                           gnutls_datum_t session_entry);

This function has no effect.

#### Parameters

session | is a gnutls_session_t type. |
session_entry | is the session data (not key) |

#### Returns

Returns `GNUTLS_E_EXPIRED`, if the database entry has expired or 0 otherwise.

### gnutls_db_get_ptr ()

    void *
    gnutls_db_get_ptr (gnutls_session_t session);

Get db function pointer.

#### Parameters

session | is a gnutls_session_t type. |

#### Returns

the pointer that will be sent to db store, retrieve and delete functions, as the first argument.

### gnutls_db_remove_func ()

    int
    (*gnutls_db_remove_func) (void *Param1,
                              gnutls_datum_t key);

### gnutls_db_remove_session ()

    void
    gnutls_db_remove_session (gnutls_session_t session);

This function will remove the current session data from the session database. This will prevent future handshakes reusing these session data. This function should be called if a session was terminated abnormally, and before `gnutls_deinit()` is called.

Normally `gnutls_deinit()` will remove abnormally terminated sessions.

#### Parameters

session | is a gnutls_session_t type. |

### gnutls_db_retr_func ()

    gnutls_datum_t
    (*gnutls_db_retr_func) (void *Param1,
                            gnutls_datum_t key);

### gnutls_db_set_cache_expiration ()

    void
    gnutls_db_set_cache_expiration (gnutls_session_t session,
                                    int seconds);

Set the expiration time for resumed sessions. The default is 3600 (one hour) at the time of this writing.

#### Parameters

session | is a gnutls_session_t type. |
seconds | is the number of seconds. |

### gnutls_db_set_ptr ()

    void
    gnutls_db_set_ptr (gnutls_session_t session,
                       void *ptr);

Sets the pointer that will be provided to db store, retrieve and delete functions, as the first argument.

#### Parameters

session | is a gnutls_session_t type. |
ptr | is the pointer |

### gnutls_db_set_remove_function ()

    void
    gnutls_db_set_remove_function (gnutls_session_t session,
                                   gnutls_db_remove_func rem_func);

Sets the function that will be used to remove data from the resumed sessions database. This function must return 0 on success.

The first argument to `rem_func` will be null unless `gnutls_db_set_ptr()` has been called.

#### Parameters

session | is a gnutls_session_t type. |
rem_func | is the function. |

### gnutls_db_set_retrieve_function ()

    void
    gnutls_db_set_retrieve_function (gnutls_session_t session,
                                     gnutls_db_retr_func retr_func);

Sets the function that will be used to retrieve data from the resumed sessions database. This function must return a gnutls_datum_t containing the data on success, or a gnutls_datum_t containing null and 0 on failure.

The datum's data must be allocated using the function `gnutls_malloc()`.

The first argument to `retr_func` will be null unless `gnutls_db_set_ptr()` has been called.

#### Parameters

session | is a gnutls_session_t type. |
retr_func | is the function. |

### gnutls_db_set_store_function ()

    void
    gnutls_db_set_store_function (gnutls_session_t session,
                                  gnutls_db_store_func store_func);

Sets the function that will be used to store data in the resumed sessions database. This function must return 0 on success.

The first argument to `store_func` will be null unless `gnutls_db_set_ptr()` has been called.

#### Parameters

session | is a gnutls_session_t type. |
store_func | is the function |

### gnutls_db_store_func ()

    int
    (*gnutls_db_store_func) (void *Param1,
                             gnutls_datum_t key,
                             gnutls_datum_t data);

### gnutls_deinit ()

    void
    gnutls_deinit (gnutls_session_t session);

This function clears all buffers associated with the `session` . This function will also remove session data from the session database if the session was terminated abnormally.

#### Parameters

session | is a gnutls_session_t type. |

### gnutls_dh_get_group ()

    int
    gnutls_dh_get_group (gnutls_session_t session,
                         gnutls_datum_t *raw_gen,
                         gnutls_datum_t *raw_prime);

This function will return the group parameters used in the last Diffie-Hellman key exchange with the peer. These are the prime and the generator used. This function should be used for both anonymous and ephemeral Diffie-Hellman. The output parameters must be freed with `gnutls_free()`.

Note, that the prime and generator are exported as non-negative integers and may include a leading zero byte.

#### Parameters

session | is a gnutls session |
raw_gen | will hold the generator. |
raw_prime | will hold the prime. |

#### Returns

On success, `GNUTLS_E_SUCCESS` (0) is returned, otherwise an error code is returned.

### gnutls_dh_get_peers_public_bits ()

    int
    gnutls_dh_get_peers_public_bits (gnutls_session_t session);

Get the Diffie-Hellman public key bit size. Can be used for both anonymous and ephemeral Diffie-Hellman.

#### Parameters

session | is a gnutls session |

#### Returns

The public key bit size used in the last Diffie-Hellman key exchange with the peer, or a negative error code in case of error.

### gnutls_dh_get_prime_bits ()

    int
    gnutls_dh_get_prime_bits (gnutls_session_t session);

This function will return the bits of the prime used in the last Diffie-Hellman key exchange with the peer. Should be used for both anonymous and ephemeral Diffie-Hellman. Note that some ciphers, like RSA and DSA without DHE, do not use a Diffie-Hellman key exchange, and then this function will return 0.

#### Parameters

session | is a gnutls session |

#### Returns

The Diffie-Hellman bit strength is returned, or 0 if no Diffie-Hellman key exchange was done, or a negative error code on failure.

### gnutls_dh_get_pubkey ()

    int
    gnutls_dh_get_pubkey (gnutls_session_t session,
                          gnutls_datum_t *raw_key);

This function will return the peer's public key used in the last Diffie-Hellman key exchange. This function should be used for both anonymous and ephemeral Diffie-Hellman. The output parameters must be freed with `gnutls_free()`.

Note, that public key is exported as non-negative integer and may include a leading zero byte.

#### Parameters

session | is a gnutls session |
raw_key | will hold the public key. |

#### Returns

On success, `GNUTLS_E_SUCCESS` (0) is returned, otherwise an error code is returned.

### gnutls_dh_get_secret_bits ()

    int
    gnutls_dh_get_secret_bits (gnutls_session_t session);

This function will return the bits used in the last Diffie-Hellman key exchange with the peer. Should be used for both anonymous and ephemeral Diffie-Hellman.

#### Parameters

session | is a gnutls session |

#### Returns

On success, `GNUTLS_E_SUCCESS` (0) is returned, otherwise an error code is returned.

### gnutls_dh_params_cpy ()

    int
    gnutls_dh_params_cpy (gnutls_dh_params_t dst,
                          gnutls_dh_params_t src);

This function will copy the DH parameters structure from source to destination.

#### Parameters

dst | Is the destination parameters, which should be initialized. |
src | Is the source parameters |

#### Returns

On success, `GNUTLS_E_SUCCESS` (0) is returned, otherwise a negative error code is returned.

### gnutls_dh_params_deinit ()

    void
    gnutls_dh_params_deinit (gnutls_dh_params_t dh_params);

This function will deinitialize the DH parameters type.

#### Parameters

dh_params | The parameters |

### gnutls_dh_params_export2_pkcs3 ()

    int
    gnutls_dh_params_export2_pkcs3 (gnutls_dh_params_t params,
                                    gnutls_x509_crt_fmt_t format,
                                    gnutls_datum_t *out);

This function will export the given dh parameters to a PKCS3 DHParams structure. This is the format generated by "openssl dhparam" tool. The data in `out` will be allocated using `gnutls_malloc()`.

If the structure is PEM encoded, it will have a header of "BEGIN DH PARAMETERS".

#### Parameters

params | Holds the DH parameters |
format | the format of output params. One of PEM or DER. |
out | will contain a PKCS3 DHParams structure PEM or DER encoded |

#### Returns

On success, `GNUTLS_E_SUCCESS` (0) is returned, otherwise a negative error code is returned.

Since: 3.1.3

### gnutls_dh_params_export_pkcs3 ()

    int
    gnutls_dh_params_export_pkcs3 (gnutls_dh_params_t params,
                                   gnutls_x509_crt_fmt_t format,
                                   unsigned char *params_data,
                                   size_t *params_data_size);

This function will export the given dh parameters to a PKCS3 DHParams structure. This is the format generated by "openssl dhparam" tool. If the buffer provided is not long enough to hold the output, then GNUTLS_E_SHORT_MEMORY_BUFFER will be returned.

If the structure is PEM encoded, it will have a header of "BEGIN DH PARAMETERS".

#### Parameters

params | Holds the DH parameters |
format | the format of output params. One of PEM or DER. |
params_data | will contain a PKCS3 DHParams structure PEM or DER encoded |
params_data_size | holds the size of params_data (and will be replaced by the actual size of parameters) |

#### Returns

On success, `GNUTLS_E_SUCCESS` (0) is returned, otherwise a negative error code is returned.

### gnutls_dh_params_export_raw ()

    int
    gnutls_dh_params_export_raw (gnutls_dh_params_t params,
                                 gnutls_datum_t *prime,
                                 gnutls_datum_t *generator,
                                 unsigned int *bits);

This function will export the pair of prime and generator for use in the Diffie-Hellman key exchange. The new parameters will be allocated using `gnutls_malloc()` and will be stored in the appropriate datum.

#### Parameters

params | Holds the DH parameters |
prime | will hold the new prime |
generator | will hold the new generator |
bits | if non null will hold the secret key's number of bits |

#### Returns

On success, `GNUTLS_E_SUCCESS` (0) is returned, otherwise a negative error code is returned.

### gnutls_dh_params_generate2 ()

    int
    gnutls_dh_params_generate2 (gnutls_dh_params_t params,
                                unsigned int bits);

This function will generate a new pair of prime and generator for use in the Diffie-Hellman key exchange. The new parameters will be allocated using `gnutls_malloc()` and will be stored in the appropriate datum. This function is normally slow.

Do not set the number of bits directly, use `gnutls_sec_param_to_pk_bits()` to get bits for `GNUTLS_PK_DSA`. Also note that the DH parameters are only useful to servers. Since clients use the parameters sent by the server, it's of no use to call this in client side.

#### Parameters

bits | is the prime's number of bits |

#### Returns

On success, `GNUTLS_E_SUCCESS` (0) is returned, otherwise a negative error code is returned.

### gnutls_dh_params_import_pkcs3 ()

    int
    gnutls_dh_params_import_pkcs3 (gnutls_dh_params_t params,
                                   const gnutls_datum_t *pkcs3_params,
                                   gnutls_x509_crt_fmt_t format);

This function will extract the DHParams found in a PKCS3 formatted structure. This is the format generated by "openssl dhparam" tool.

If the structure is PEM encoded, it should have a header of "BEGIN DH PARAMETERS".

#### Parameters

params | The parameters |
pkcs3_params | should contain a PKCS3 DHParams structure PEM or DER encoded |
format | the format of params. PEM or DER. |

#### Returns

On success, `GNUTLS_E_SUCCESS` (0) is returned, otherwise a negative error code is returned.

### gnutls_dh_params_import_raw ()

    int
    gnutls_dh_params_import_raw (gnutls_dh_params_t dh_params,
                                 const gnutls_datum_t *prime,
                                 const gnutls_datum_t *generator);

This function will replace the pair of prime and generator for use in the Diffie-Hellman key exchange. The new parameters should be stored in the appropriate gnutls_datum.

#### Parameters

dh_params | The parameters |
prime | holds the new prime |
generator | holds the new generator |

#### Returns

On success, `GNUTLS_E_SUCCESS` (0) is returned, otherwise a negative error code is returned.

### gnutls_dh_params_init ()

    int
    gnutls_dh_params_init (gnutls_dh_params_t *dh_params);

This function will initialize the DH parameters type.

#### Parameters

dh_params | The parameters |

#### Returns

On success, `GNUTLS_E_SUCCESS` (0) is returned, otherwise a negative error code is returned.

### gnutls_dh_set_prime_bits ()

    void
    gnutls_dh_set_prime_bits (gnutls_session_t session,
                              unsigned int bits);

This function sets the number of bits, for use in a Diffie-Hellman key exchange. This is used both in DH ephemeral and DH anonymous cipher suites. This will set the minimum size of the prime that will be used for the handshake.

In the client side it sets the minimum accepted number of bits. If a server sends a prime with less bits than that `GNUTLS_E_DH_PRIME_UNACCEPTABLE` will be returned by the handshake.

Note that this function will warn via the audit log for value that are believed to be weak.

The function has no effect in server side.

Note that since 3.1.7 this function is deprecated. The minimum number of bits is set by the priority string level. Also this function must be called after `gnutls_priority_set_direct()` or the set value may be overridden by the selected priority options.

#### Parameters

session | is a gnutls_session_t type. |
bits | is the number of bits |

### gnutls_ecc_curve_get ()

    gnutls_ecc_curve_t
    gnutls_ecc_curve_get (gnutls_session_t session);

Returns the currently used elliptic curve. Only valid when using an elliptic curve ciphersuite.

#### Parameters

session | is a gnutls_session_t type. |

#### Returns

the currently used curve, a gnutls_ecc_curve_t type.

Since: 3.0

### gnutls_ecc_curve_get_name ()

    const char *
    gnutls_ecc_curve_get_name (gnutls_ecc_curve_t curve);

Convert a gnutls_ecc_curve_t value to a string.

#### Parameters

curve | is an ECC curve |

#### Returns

a string that contains the name of the specified curve or `NULL`.

Since: 3.0

### gnutls_ecc_curve_get_size ()

    int
    gnutls_ecc_curve_get_size (gnutls_ecc_curve_t curve);

Returns the size in bytes of the curve.

#### Parameters

curve | is an ECC curve |

#### Returns

a the size or (0).

Since: 3.0

### gnutls_ecc_curve_list ()

    const gnutls_ecc_curve_t *
    gnutls_ecc_curve_list (void);

Get the list of supported elliptic curves.

This function is not thread safe.

#### Returns

Return a (0)-terminated list of gnutls_ecc_curve_t integers indicating the available curves.

### gnutls_errno_func ()

    int
    (*gnutls_errno_func) (gnutls_transport_ptr_t Param1);

### gnutls_error_is_fatal ()

    int
    gnutls_error_is_fatal (int error);

If a GnuTLS function returns a negative error code you may feed that value to this function to see if the error condition is fatal to a TLS session (i.e., must be terminated).

Note that you may also want to check the error code manually, since some non-fatal errors to the protocol (such as a warning alert or a rehandshake request) may be fatal for your program.

This function is only useful if you are dealing with errors from functions that relate to a TLS session (e.g., record layer or handshake layer handling functions).

#### Parameters

error | is a GnuTLS error code, a negative error code |

#### Returns

Non-zero value on fatal errors or zero on non-fatal.

### gnutls_error_to_alert ()

    int
    gnutls_error_to_alert (int err,
                           int *level);

Get an alert depending on the error code returned by a gnutls function. All alerts sent by this function should be considered fatal. The only exception is when `err` is `GNUTLS_E_REHANDSHAKE`, where a warning alert should be sent to the peer indicating that no renegotiation will be performed.

If there is no mapping to a valid alert the alert to indicate internal error is returned.

#### Parameters

err | is a negative integer |
level | the alert level will be stored there |

#### Returns

the alert code to use for a particular error code.

### gnutls_fingerprint ()

    int
    gnutls_fingerprint (gnutls_digest_algorithm_t algo,
                        const gnutls_datum_t *data,
                        void *result,
                        size_t *result_size);

This function will calculate a fingerprint (actually a hash), of the given data. The result is not printable data. You should convert it to hex, or to something else printable.

This is the usual way to calculate a fingerprint of an X.509 DER encoded certificate. Note however that the fingerprint of an OpenPGP certificate is not just a hash and cannot be calculated with this function.

#### Parameters

algo | is a digest algorithm |
data | is the data |
result | is the place where the result will be copied (may be null). |
result_size | should hold the size of the result. The actual size of the returned result will also be copied there. |

#### Returns

On success, `GNUTLS_E_SUCCESS` (0) is returned, otherwise an error code is returned.

### gnutls_free_function ()

    void
    (*gnutls_free_function) (void *Param1);

### gnutls_global_deinit ()

    void
    gnutls_global_deinit (void);

This function deinitializes the global data, that were initialized using `gnutls_global_init()`.

### gnutls_global_init ()

    int
    gnutls_global_init (void);

This function performs any required precalculations, detects the supported CPU capabilities and initializes the underlying cryptographic backend. In order to free any resources taken by this call you should `gnutls_global_deinit()` when gnutls usage is no longer needed.

This function increments a global counter, so that `gnutls_global_deinit()` only releases resources when it has been called as many times as `gnutls_global_init()`. This is useful when GnuTLS is used by more than one library in an application. This function can be called many times, but will only do something the first time.

Since GnuTLS 3.3.0 this function is automatically called on library constructor. Since the same version this function is also thread safe. The automatic initialization can be avoided if the environment variable `GNUTLS_NO_EXPLICIT_INIT` is set to be 1.

A subsequent call of this function if the initial has failed will return the same error code.

#### Returns

On success, `GNUTLS_E_SUCCESS` (0) is returned, otherwise a negative error code is returned.

### gnutls_global_set_audit_log_function ()

    void
    gnutls_global_set_audit_log_function (gnutls_audit_log_func log_func);

This is the function to set the audit logging function. This is a function to report important issues, such as possible attacks in the protocol. This is different from `gnutls_global_set_log_function()` because it will report also session-specific events. The session parameter will be null if there is no corresponding TLS session.

`gnutls_audit_log_func` is of the form, void (*gnutls_audit_log_func)( gnutls_session_t, const char*);

#### Parameters

log_func | it is the audit log function |

Since: 3.0

### gnutls_global_set_log_function ()

    void
    gnutls_global_set_log_function (gnutls_log_func log_func);

This is the function where you set the logging function gnutls is going to use. This function only accepts a character array. Normally you may not use this function since it is only used for debugging purposes.

`gnutls_log_func` is of the form, void (*gnutls_log_func)( int level, const char*);

#### Parameters

log_func | it's a log function |

### gnutls_global_set_log_level ()

    void
    gnutls_global_set_log_level (int level);

This is the function that allows you to set the log level. The level is an integer between 0 and 9. Higher values mean more verbosity. The default value is 0. Larger values should only be used with care, since they may reveal sensitive information.

Use a log level over 10 to enable all debugging options.

#### Parameters

level | it's an integer from 0 to 99. |

### gnutls_global_set_mem_functions ()

    void
    gnutls_global_set_mem_functions (gnutls_alloc_function alloc_func,
                                     gnutls_alloc_function secure_alloc_func,
                                     gnutls_is_secure_function is_secure_func,
                                     gnutls_realloc_function realloc_func,
                                     gnutls_free_function free_func);

`gnutls_global_set_mem_functions` is deprecated and should not be used in newly-written code.

since 3.3.0 it is no longer possible to replace the internally used memory allocation functions

This is the function where you set the memory allocation functions gnutls is going to use. By default the libc's allocation functions (`malloc()`, `free()`), are used by gnutls, to allocate both sensitive and not sensitive data. This function is provided to set the memory allocation functions to something other than the defaults

This function must be called before `gnutls_global_init()` is called. This function is not thread safe.

#### Parameters

alloc_func | it's the default memory allocation function. Like `malloc()`. |
secure_alloc_func | This is the memory allocation function that will be used for sensitive data. |
is_secure_func | a function that returns 0 if the memory given is not secure. May be NULL. |
realloc_func | A realloc function |
free_func | The function that frees allocated data. Must accept a NULL pointer. |

### gnutls_global_set_mutex ()

    void
    gnutls_global_set_mutex (mutex_init_func init,
                             mutex_deinit_func deinit,
                             mutex_lock_func lock,
                             mutex_unlock_func unlock);

With this function you are allowed to override the default mutex locks used in some parts of gnutls and dependent libraries. This function should be used if you have complete control of your program and libraries. Do not call this function from a library, or preferrably from any application unless really needed to. GnuTLS will use the appropriate locks for the running system.

This function must be called prior to any other gnutls function.

#### Parameters

init | mutex initialization function |
deinit | mutex deinitialization function |
lock | mutex locking function |
unlock | mutex unlocking function |

Since: 2.12.0

### gnutls_global_set_time_function ()

    void
    gnutls_global_set_time_function (gnutls_time_func time_func);

This is the function where you can override the default system time function. The application provided function should behave the same as the standard function.

#### Parameters

time_func | it's the system time function, a `gnutls_time_func()` callback. |

Since: 2.12.0

### gnutls_handshake ()

    int
    gnutls_handshake (gnutls_session_t session);

This function does the handshake of the TLS/SSL protocol, and initializes the TLS connection.

This function will fail if any problem is encountered, and will return a negative error code. In case of a client, if the client has asked to resume a session, but the server couldn't, then a full handshake will be performed.

The non-fatal errors expected by this function are: `GNUTLS_E_INTERRUPTED`, `GNUTLS_E_AGAIN`, `GNUTLS_E_WARNING_ALERT_RECEIVED`, and `GNUTLS_E_GOT_APPLICATION_DATA`, the latter only in a case of rehandshake.

The former two interrupt the handshake procedure due to the lower layer being interrupted, and the latter because of an alert that may be sent by a server (it is always a good idea to check any received alerts). On these errors call this function again, until it returns 0; cf. `gnutls_record_get_direction()` and `gnutls_error_is_fatal()`. In DTLS sessions the non-fatal error `GNUTLS_E_LARGE_PACKET` is also possible, and indicates that the MTU should be adjusted.

If this function is called by a server after a rehandshake request then `GNUTLS_E_GOT_APPLICATION_DATA` or `GNUTLS_E_WARNING_ALERT_RECEIVED` may be returned. Note that these are non fatal errors, only in the specific case of a rehandshake. Their meaning is that the client rejected the rehandshake request or in the case of `GNUTLS_E_GOT_APPLICATION_DATA` it could also mean that some data were pending. A client may receive that error code if it initiates the handshake and the server doesn't agreed.

#### Parameters

session | is a gnutls_session_t type. |

#### Returns

`GNUTLS_E_SUCCESS` on success, otherwise a negative error code.

### gnutls_handshake_get_last_in ()

    gnutls_handshake_description_t
    gnutls_handshake_get_last_in (gnutls_session_t session);

This function is only useful to check where the last performed handshake failed. If the previous handshake succeed or was not performed at all then no meaningful value will be returned.

Check `gnutls_handshake_description_t` in gnutls.h for the available handshake descriptions.

#### Parameters

session | is a gnutls_session_t type. |

#### Returns

the last handshake message type received, a `gnutls_handshake_description_t`.

### gnutls_handshake_get_last_out ()

    gnutls_handshake_description_t
    gnutls_handshake_get_last_out (gnutls_session_t session);

This function is only useful to check where the last performed handshake failed. If the previous handshake succeed or was not performed at all then no meaningful value will be returned.

Check `gnutls_handshake_description_t` in gnutls.h for the available handshake descriptions.

#### Parameters

session | is a gnutls_session_t type. |

#### Returns

the last handshake message type sent, a `gnutls_handshake_description_t`.

### gnutls_handshake_post_client_hello_func ()

    int
    (*gnutls_handshake_post_client_hello_func)
                                   (gnutls_session_t Param1);

### gnutls_handshake_set_max_packet_length ()

    void
    gnutls_handshake_set_max_packet_length
                                   (gnutls_session_t session,
                                    size_t max);

This function will set the maximum size of all handshake messages. Handshakes over this size are rejected with `GNUTLS_E_HANDSHAKE_TOO_LARGE` error code. The default value is 48kb which is typically large enough. Set this to 0 if you do not want to set an upper limit.

The reason for restricting the handshake message sizes are to limit Denial of Service attacks.

#### Parameters

session | is a gnutls_session_t type. |
max | is the maximum number. |

### gnutls_handshake_set_post_client_hello_function ()

    void
    gnutls_handshake_set_post_client_hello_function
                                   (gnutls_session_t session,
                                    gnutls_handshake_post_client_hello_func func);

This function will set a callback to be called after the client hello has been received (callback valid in server side only). This allows the server to adjust settings based on received extensions.

Those settings could be ciphersuites, requesting certificate, or anything else except for version negotiation (this is done before the hello message is parsed).

This callback must return 0 on success or a gnutls error code to terminate the handshake.

Since GnuTLS 3.3.5 the callback is allowed to return `GNUTLS_E_AGAIN` or `GNUTLS_E_INTERRUPTED` to put the handshake on hold. In that case `gnutls_handshake()` will return `GNUTLS_E_INTERRUPTED` and can be resumed when needed.

Warning: You should not use this function to terminate the handshake based on client input unless you know what you are doing. Before the handshake is finished there is no way to know if there is a man-in-the-middle attack being performed.

#### Parameters

session | is a gnutls_session_t type. |
func | is the function to be called |

### gnutls_handshake_set_private_extensions ()

    void
    gnutls_handshake_set_private_extensions
                                   (gnutls_session_t session,
                                    int allow);

This function will enable or disable the use of private cipher suites (the ones that start with 0xFF). By default or if `allow` is 0 then these cipher suites will not be advertised nor used.

Currently GnuTLS does not include such cipher-suites or compression algorithms.

Enabling the private ciphersuites when talking to other than gnutls servers and clients may cause interoperability problems.

#### Parameters

session | is a gnutls_session_t type. |
allow | is an integer (0 or 1) |

### gnutls_handshake_set_timeout ()

    void
    gnutls_handshake_set_timeout (gnutls_session_t session,
                                  unsigned int ms);

This function sets the timeout for the TLS handshake process to the provided value. Use an `ms` value of zero to disable timeout, or `GNUTLS_DEFAULT_HANDSHAKE_TIMEOUT` for a reasonable default value. For the DTLS protocol, the more detailed `gnutls_dtls_set_timeouts()` is provided.

This function requires to set a pull timeout callback. See `gnutls_transport_set_pull_timeout_function()`.

#### Parameters

session | is a gnutls_session_t type. |
ms | is a timeout value in milliseconds |

Since: 3.1.0

### gnutls_heartbeat_allowed ()

    int
    gnutls_heartbeat_allowed (gnutls_session_t session,
                              unsigned int type);

This function will check whether heartbeats are allowed to be sent or received in this session.

#### Parameters

session | is a gnutls_session_t type. |
type | one of `GNUTLS_HB_LOCAL_ALLOWED_TO_SEND` and `GNUTLS_HB_PEER_ALLOWED_TO_SEND` |

#### Returns

Non zero if heartbeats are allowed.

Since: 3.1.2

### gnutls_heartbeat_enable ()

    void
    gnutls_heartbeat_enable (gnutls_session_t session,
                             unsigned int type);

If this function is called with the `GNUTLS_HB_PEER_ALLOWED_TO_SEND` `type` , GnuTLS will allow heartbeat messages to be received. Moreover it also request the peer to accept heartbeat messages.

If the `type` used is `GNUTLS_HB_LOCAL_ALLOWED_TO_SEND`, then the peer will be asked to accept heartbeat messages but not send ones.

The function `gnutls_heartbeat_allowed()` can be used to test Whether locally generated heartbeat messages can be accepted by the peer.

#### Parameters

session | is a gnutls_session_t type. |
type | one of the GNUTLS_HB_* flags |

Since: 3.1.2

### gnutls_heartbeat_get_timeout ()

    unsigned int
    gnutls_heartbeat_get_timeout (gnutls_session_t session);

This function will return the milliseconds remaining for a retransmission of the previously sent ping message. This function is useful when ping is used in non-blocking mode, to estimate when to call `gnutls_heartbeat_ping()` if no packets have been received.

#### Parameters

session | is a gnutls_session_t type. |

#### Returns

the remaining time in milliseconds.

Since: 3.1.2

### gnutls_heartbeat_ping ()

    int
    gnutls_heartbeat_ping (gnutls_session_t session,
                           size_t data_size,
                           unsigned int max_tries,
                           unsigned int flags);

This function sends a ping to the peer. If the `flags` is set to `GNUTLS_HEARTBEAT_WAIT` then it waits for a reply from the peer.

Note that it is highly recommended to use this function with the flag `GNUTLS_HEARTBEAT_WAIT`, or you need to handle retransmissions and timeouts manually.

#### Parameters

session | is a gnutls_session_t type. |
data_size | is the length of the ping payload. |
max_tries | if flags is `GNUTLS_HEARTBEAT_WAIT` then this sets the number of retransmissions. Use zero for indefinite (until timeout). |
flags | if `GNUTLS_HEARTBEAT_WAIT` then wait for pong or timeout instead of returning immediately. |

#### Returns

`GNUTLS_E_SUCCESS` on success, otherwise a negative error code.

Since: 3.1.2

### gnutls_heartbeat_pong ()

    int
    gnutls_heartbeat_pong (gnutls_session_t session,
                           unsigned int flags);

This function replies to a ping by sending a pong to the peer.

#### Parameters

session | is a gnutls_session_t type. |
flags | should be zero |

#### Returns

`GNUTLS_E_SUCCESS` on success, otherwise a negative error code.

Since: 3.1.2

### gnutls_heartbeat_set_timeouts ()

    void
    gnutls_heartbeat_set_timeouts (gnutls_session_t session,
                                   unsigned int retrans_timeout,
                                   unsigned int total_timeout);

This function will override the timeouts for the DTLS heartbeat protocol. The retransmission timeout is the time after which a message from the peer is not received, the previous request will be retransmitted. The total timeout is the time after which the handshake will be aborted with `GNUTLS_E_TIMEDOUT`.

If the retransmission timeout is zero then the handshake will operate in a non-blocking way, i.e., return `GNUTLS_E_AGAIN`.

#### Parameters

session | is a gnutls_session_t type. |
retrans_timeout | The time at which a retransmission will occur in milliseconds |
total_timeout | The time at which the connection will be aborted, in milliseconds. |

Since: 3.1.2

### gnutls_hex2bin ()

    int
    gnutls_hex2bin (const char *hex_data,
                    size_t hex_size,
                    void *bin_data,
                    size_t *bin_size);

Convert a buffer with hex data to binary data. This function unlike `gnutls_hex_decode()` can parse hex data with separators between numbers. That is, it ignores any non-hex characters.

#### Parameters

hex_data | string with data in hex format |
hex_size | size of hex data |
bin_data | output array with binary data |
bin_size | when calling should hold maximum size of `bin_data` , on return will hold actual length of `bin_data` . |

#### Returns

`GNUTLS_E_SUCCESS` on success, otherwise a negative error code.

Since: 2.4.0

### gnutls_hex_decode ()

    int
    gnutls_hex_decode (const gnutls_datum_t *hex_data,
                       void *result,
                       size_t *result_size);

This function will decode the given encoded data, using the hex encoding used by PSK password files.

Initially `result_size` must hold the maximum size available in `result` , and on return it will contain the number of bytes written.

#### Parameters

hex_data | contain the encoded data |
result | the place where decoded data will be copied |
result_size | holds the size of the result |

#### Returns

`GNUTLS_E_SHORT_MEMORY_BUFFER` if the buffer given is not long enough, or 0 on success.

### gnutls_hex_encode ()

    int
    gnutls_hex_encode (const gnutls_datum_t *data,
                       char *result,
                       size_t *result_size);

This function will convert the given data to printable data, using the hex encoding, as used in the PSK password files.

Note that the size of the result includes the null terminator.

#### Parameters

data | contain the raw data |
result | the place where hex data will be copied |
result_size | holds the size of the result |

#### Returns

`GNUTLS_E_SHORT_MEMORY_BUFFER` if the buffer given is not long enough, or 0 on success.

### gnutls_init ()

    int
    gnutls_init (gnutls_session_t *session,
                 unsigned int flags);

This function initializes the current session to null. Every session must be initialized before use, so internal structures can be allocated. This function allocates structures which can only be free'd by calling `gnutls_deinit()`. Returns `GNUTLS_E_SUCCESS` (0) on success.

`flags` can be one of `GNUTLS_CLIENT`, `GNUTLS_SERVER`, `GNUTLS_DATAGRAM`, `GNUTLS_NONBLOCK` or `GNUTLS_NOSIGNAL` (since 3.4.2).

The flag `GNUTLS_NO_REPLAY_PROTECTION` will disable any replay protection in DTLS mode. That must only used when replay protection is achieved using other means.

Note that since version 3.1.2 this function enables some common TLS extensions such as session tickets and OCSP certificate status request in client side by default. To prevent that use the `GNUTLS_NO_EXTENSIONS` flag.

#### Parameters

session | is a pointer to a gnutls_session_t type. |
flags | indicate if this session is to be used for server or client. |

#### Returns

`GNUTLS_E_SUCCESS` on success, or an error code.

### gnutls_is_secure_function ()

    int
    (*gnutls_is_secure_function) (const void *Param1);

### gnutls_key_generate ()

    int
    gnutls_key_generate (gnutls_datum_t *key,
                         unsigned int key_size);

Generates a random key of `key_size` bytes.

#### Parameters

key | is a pointer to a gnutls_datum_t which will contain a newly created key |
key_size | the number of bytes of the key |

#### Returns

On success, `GNUTLS_E_SUCCESS` (0) is returned, or an error code.

Since: 3.0

### gnutls_kx_get ()

    gnutls_kx_algorithm_t
    gnutls_kx_get (gnutls_session_t session);

Get currently used key exchange algorithm.

#### Parameters

session | is a gnutls_session_t type. |

#### Returns

the key exchange algorithm used in the last handshake, a gnutls_kx_algorithm_t value.

### gnutls_kx_get_id ()

    gnutls_kx_algorithm_t
    gnutls_kx_get_id (const char *name);

Convert a string to a gnutls_kx_algorithm_t value. The names are compared in a case insensitive way.

#### Parameters

name | is a KX name |

#### Returns

an id of the specified KX algorithm, or `GNUTLS_KX_UNKNOWN` on error.

### gnutls_kx_get_name ()

    const char *
    gnutls_kx_get_name (gnutls_kx_algorithm_t algorithm);

Convert a gnutls_kx_algorithm_t value to a string.

#### Parameters

algorithm | is a key exchange algorithm |

#### Returns

a pointer to a string that contains the name of the specified key exchange algorithm, or `NULL`.

### gnutls_kx_list ()

    const gnutls_kx_algorithm_t *
    gnutls_kx_list (void);

Get a list of supported key exchange algorithms.

This function is not thread safe.

#### Returns

a (0)-terminated list of gnutls_kx_algorithm_t integers indicating the available key exchange algorithms.

### gnutls_load_file ()

    int
    gnutls_load_file (const char *filename,
                      gnutls_datum_t *data);

This function will load a file into a datum. The data are zero terminated but the terminating null is not included in length. The returned data are allocated using `gnutls_malloc()`.

#### Parameters

filename | the name of the file to load |
data | Where the file will be stored |

#### Returns

On success, `GNUTLS_E_SUCCESS` (0) is returned, otherwise an error code is returned.

Since 3.1.0

### gnutls_log_func ()

    void
    (*gnutls_log_func) (int Param1,
                        const char *Param2);

### gnutls_mac_get ()

    gnutls_mac_algorithm_t
    gnutls_mac_get (gnutls_session_t session);

Get currently used MAC algorithm.

#### Parameters

session | is a gnutls_session_t type. |

#### Returns

the currently used mac algorithm, a gnutls_mac_algorithm_t value.

### gnutls_mac_get_id ()

    gnutls_mac_algorithm_t
    gnutls_mac_get_id (const char *name);

Convert a string to a gnutls_mac_algorithm_t value. The names are compared in a case insensitive way.

#### Parameters

name | is a MAC algorithm name |

#### Returns

a gnutls_mac_algorithm_t id of the specified MAC algorithm string, or `GNUTLS_MAC_UNKNOWN` on failure.

### gnutls_mac_get_key_size ()

    size_t
    gnutls_mac_get_key_size (gnutls_mac_algorithm_t algorithm);

Returns the size of the MAC key used in TLS.

#### Parameters

algorithm | is an encryption algorithm |

#### Returns

length (in bytes) of the given MAC key size, or 0 if the given MAC algorithm is invalid.

### gnutls_mac_get_name ()

    const char *
    gnutls_mac_get_name (gnutls_mac_algorithm_t algorithm);

Convert a gnutls_mac_algorithm_t value to a string.

#### Parameters

algorithm | is a MAC algorithm |

#### Returns

a string that contains the name of the specified MAC algorithm, or `NULL`.

### gnutls_mac_list ()

    const gnutls_mac_algorithm_t *
    gnutls_mac_list (void);

Get a list of hash algorithms for use as MACs. Note that not necessarily all MACs are supported in TLS cipher suites. This function is not thread safe.

#### Returns

Return a (0)-terminated list of gnutls_mac_algorithm_t integers indicating the available MACs.

### gnutls_ocsp_status_request_enable_client ()

    int
    gnutls_ocsp_status_request_enable_client
                                   (gnutls_session_t session,
                                    gnutls_datum_t *responder_id,
                                    size_t responder_id_size,
                                    gnutls_datum_t *request_extensions);

This function is to be used by clients to request OCSP response from the server, using the "status_request" TLS extension. Only OCSP status type is supported. A typical server has a single OCSP response cached, so `responder_id` and `extensions` should be null.

#### Parameters

session | is a gnutls_session_t type. |
responder_id | array with gnutls_datum_t with DER data of responder id |
responder_id_size | number of members in `responder_id` array |

#### Returns

On success, `GNUTLS_E_SUCCESS` (0) is returned, otherwise a negative error code is returned.

Since: 3.1.3

### gnutls_ocsp_status_request_get ()

    int
    gnutls_ocsp_status_request_get (gnutls_session_t session,
                                    gnutls_datum_t *response);

This function returns the OCSP status response received from the TLS server. The `response` should be treated as constant. If no OCSP response is available then `GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE` is returned.

#### Parameters

session | is a gnutls_session_t type. |
response | a gnutls_datum_t with DER encoded OCSP response |

#### Returns

On success, `GNUTLS_E_SUCCESS` (0) is returned, otherwise a negative error code is returned.

Since: 3.1.3

### gnutls_ocsp_status_request_is_checked ()

    int
    gnutls_ocsp_status_request_is_checked (gnutls_session_t session,
                                           unsigned int flags);

Check whether an OCSP status response was included in the handshake and whether it was checked and valid (not too old or superseded). This is a helper function when needing to decide whether to perform an OCSP validity check on the peer's certificate. Should be called after any of gnutls_certificate_verify_peers*() are called.

If the flag `GNUTLS_OCSP_SR_IS_AVAIL` is specified, the return value of the function indicates whether an OCSP status response have been received (even if invalid).

#### Parameters

session | is a gnutls session |
flags | should be zero or `GNUTLS_OCSP_SR_IS_AVAIL` |

#### Returns

non zero if the response was valid, or a zero if it wasn't sent, or sent and was invalid.

### gnutls_openpgp_send_cert ()

    void
    gnutls_openpgp_send_cert (gnutls_session_t session,
                              gnutls_openpgp_crt_status_t status);

This function will order gnutls to send the key fingerprint instead of the key in the initial handshake procedure. This should be used with care and only when there is indication or knowledge that the server can obtain the client's key.

#### Parameters

session | a gnutls_session_t type. |
status | is one of GNUTLS_OPENPGP_CERT, or GNUTLS_OPENPGP_CERT_FINGERPRINT |

### gnutls_pem_base64_decode ()

    int
    gnutls_pem_base64_decode (const char *header,
                              const gnutls_datum_t *b64_data,
                              unsigned char *result,
                              size_t *result_size);

This function will decode the given encoded data. If the header given is non null this function will search for "-----BEGIN header" and decode only this part. Otherwise it will decode the first PEM packet found.

#### Parameters

header | A null terminated string with the PEM header (eg. CERTIFICATE) |
b64_data | contain the encoded data |
result | the place where decoded data will be copied |
result_size | holds the size of the result |

#### Returns

On success `GNUTLS_E_SUCCESS` (0) is returned, `GNUTLS_E_SHORT_MEMORY_BUFFER` is returned if the buffer given is not long enough, or 0 on success.

### gnutls_pem_base64_encode ()

    int
    gnutls_pem_base64_encode (const char *msg,
                              const gnutls_datum_t *data,
                              char *result,
                              size_t *result_size);

This function will convert the given data to printable data, using the base64 encoding. This is the encoding used in PEM messages.

The output string will be null terminated, although the size will not include the terminating null.

#### Parameters

msg | is a message to be put in the header |
data | contain the raw data |
result | the place where base64 data will be copied |
result_size | holds the size of the result |

#### Returns

On success `GNUTLS_E_SUCCESS` (0) is returned, `GNUTLS_E_SHORT_MEMORY_BUFFER` is returned if the buffer given is not long enough, or 0 on success.

### gnutls_perror ()

    void
    gnutls_perror (int error);

This function is like `perror()`. The only difference is that it accepts an error number returned by a gnutls function.

#### Parameters

error | is a GnuTLS error code, a negative error code |

### gnutls_pin_callback_t ()

    int
    (*gnutls_pin_callback_t) (void *userdata,
                              int attempt,
                              const char *token_url,
                              const char *token_label,
                              unsigned int flags,
                              char *pin,
                              size_t pin_max);

Callback function type for PKCS11 or TPM PIN entry. It is set by functions like `gnutls_pkcs11_set_pin_function()`.

The callback should provides the PIN code to unlock the token with label `token_label` , specified by the URL `token_url` .

The PIN code, as a NUL-terminated ASCII string, should be copied into the `pin` buffer (of maximum size `pin_max` ), and return 0 to indicate success. Alternatively, the callback may return a negative gnutls error code to indicate failure and cancel PIN entry (in which case, the contents of the `pin` parameter are ignored).

When a PIN is required, the callback will be invoked repeatedly (and indefinitely) until either the returned PIN code is correct, the callback returns failure, or the token refuses login (e.g. when the token is locked due to too many incorrect PINs!). For the first such invocation, the `attempt` counter will have value zero; it will increase by one for each subsequent attempt.

#### Parameters

userdata | user-controlled data from `gnutls_pkcs11_set_pin_function()`. |
attempt | pin-attempt counter, initially 0. |
token_url | URL of token. |
token_label | label of token. |
flags | a gnutls_pin_flag_t flag. |
pin | buffer to hold PIN, of size `pin_max` . |
pin_max | size of `pin` buffer. |

#### Returns

`GNUTLS_E_SUCCESS` (0) on success or a negative error code on error.

Since: 2.12.0

### gnutls_pk_algorithm_get_name ()

    const char *
    gnutls_pk_algorithm_get_name (gnutls_pk_algorithm_t algorithm);

Convert a gnutls_pk_algorithm_t value to a string.

#### Parameters

algorithm | is a pk algorithm |

#### Returns

a string that contains the name of the specified public key algorithm, or `NULL`.

### gnutls_pk_bits_to_sec_param ()

    gnutls_sec_param_t
    gnutls_pk_bits_to_sec_param (gnutls_pk_algorithm_t algo,
                                 unsigned int bits);

This is the inverse of `gnutls_sec_param_to_pk_bits()`. Given an algorithm and the number of bits, it will return the security parameter. This is a rough indication.

#### Parameters

algo | is a public key algorithm |
bits | is the number of bits |

#### Returns

The security parameter.

Since: 2.12.0

### gnutls_pk_get_id ()

    gnutls_pk_algorithm_t
    gnutls_pk_get_id (const char *name);

Convert a string to a gnutls_pk_algorithm_t value. The names are compared in a case insensitive way. For example, gnutls_pk_get_id("RSA") will return `GNUTLS_PK_RSA`.

#### Parameters

name | is a string containing a public key algorithm name. |

#### Returns

a gnutls_pk_algorithm_t id of the specified public key algorithm string, or `GNUTLS_PK_UNKNOWN` on failures.

Since: 2.6.0

### gnutls_pk_get_name ()

    const char *
    gnutls_pk_get_name (gnutls_pk_algorithm_t algorithm);

Convert a gnutls_pk_algorithm_t value to a string.

#### Parameters

algorithm | is a public key algorithm |

#### Returns

a pointer to a string that contains the name of the specified public key algorithm, or `NULL`.

Since: 2.6.0

### gnutls_pk_list ()

    const gnutls_pk_algorithm_t *
    gnutls_pk_list (void);

Get a list of supported public key algorithms.

This function is not thread safe.

#### Returns

a (0)-terminated list of gnutls_pk_algorithm_t integers indicating the available ciphers.

Since: 2.6.0

### gnutls_pk_to_sign ()

    gnutls_sign_algorithm_t
    gnutls_pk_to_sign (gnutls_pk_algorithm_t pk,
                       gnutls_digest_algorithm_t hash);

This function maps public key and hash algorithms combinations to signature algorithms.

#### Parameters

pk | is a public key algorithm |
hash | a hash algorithm |

#### Returns

return a gnutls_sign_algorithm_t value, or `GNUTLS_SIGN_UNKNOWN` on error.

### gnutls_prf ()

    int
    gnutls_prf (gnutls_session_t session,
                size_t label_size,
                const char *label,
                int server_random_first,
                size_t extra_size,
                const char *extra,
                size_t outsize,
                char *out);

Applies the TLS Pseudo-Random-Function (PRF) on the master secret and the provided data, seeded with the client and server random fields. For the key expansion specified in RFC5705 see `gnutls_prf_rfc5705()`.

The `label` variable usually contains a string denoting the purpose for the generated data. The `server_random_first` indicates whether the client random field or the server random field should be first in the seed. Non-zero indicates that the server random field is first, 0 that the client random field is first.

The `extra` variable can be used to add more data to the seed, after the random variables. It can be used to make sure the generated output is strongly connected to some additional data (e.g., a string used in user authentication).

The output is placed in `out` , which must be pre-allocated.

#### Parameters

session | is a gnutls_session_t type. |
label_size | length of the `label` variable. |
label | label used in PRF computation, typically a short string. |
server_random_first | non-zero if server random field should be first in seed |
extra_size | length of the `extra` variable. |
extra | optional extra data to seed the PRF with. |
outsize | size of pre-allocated output buffer to hold the output. |
out | pre-allocated buffer to hold the generated data. |

#### Returns

`GNUTLS_E_SUCCESS` on success, or an error code.

### gnutls_prf_raw ()

    int
    gnutls_prf_raw (gnutls_session_t session,
                    size_t label_size,
                    const char *label,
                    size_t seed_size,
                    const char *seed,
                    size_t outsize,
                    char *out);

Apply the TLS Pseudo-Random-Function (PRF) on the master secret and the provided data.

The `label` variable usually contains a string denoting the purpose for the generated data. The `seed` usually contains data such as the client and server random, perhaps together with some additional data that is added to guarantee uniqueness of the output for a particular purpose.

Because the output is not guaranteed to be unique for a particular session unless `seed` includes the client random and server random fields (the PRF would output the same data on another connection resumed from the first one), it is not recommended to use this function directly. The `gnutls_prf()` function seeds the PRF with the client and server random fields directly, and is recommended if you want to generate pseudo random data unique for each session.

#### Parameters

session | is a gnutls_session_t type. |
label_size | length of the `label` variable. |
label | label used in PRF computation, typically a short string. |
seed_size | length of the `seed` variable. |
seed | optional extra data to seed the PRF with. |
outsize | size of pre-allocated output buffer to hold the output. |
out | pre-allocated buffer to hold the generated data. |

#### Returns

`GNUTLS_E_SUCCESS` on success, or an error code.

### gnutls_priority_certificate_type_list ()

    int
    gnutls_priority_certificate_type_list (gnutls_priority_t pcache,
                                           const unsigned int **list);

Get a list of available certificate types in the priority structure.

#### Parameters

pcache | is a gnutls_prioritity_t type. |
list | will point to an integer list |

#### Returns

the number of certificate types, or an error code.

Since: 3.0

### gnutls_priority_compression_list ()

    int
    gnutls_priority_compression_list (gnutls_priority_t pcache,
                                      const unsigned int **list);

Get a list of available compression method in the priority structure.

#### Parameters

pcache | is a gnutls_prioritity_t type. |
list | will point to an integer list |

#### Returns

the number of methods, or an error code.

Since: 3.0

### gnutls_priority_deinit ()

    void
    gnutls_priority_deinit (gnutls_priority_t priority_cache);

Deinitializes the priority cache.

#### Parameters

priority_cache | is a gnutls_prioritity_t type. |

### gnutls_priority_ecc_curve_list ()

    int
    gnutls_priority_ecc_curve_list (gnutls_priority_t pcache,
                                    const unsigned int **list);

Get a list of available elliptic curves in the priority structure.

#### Parameters

pcache | is a gnutls_prioritity_t type. |
list | will point to an integer list |

#### Returns

the number of curves, or an error code.

Since: 3.0

### gnutls_priority_get_cipher_suite_index ()

    int
    gnutls_priority_get_cipher_suite_index
                                   (gnutls_priority_t pcache,
                                    unsigned int idx,
                                    unsigned int *sidx);

### gnutls_priority_init ()

    int
    gnutls_priority_init (gnutls_priority_t *priority_cache,
                          const char *priorities,
                          const char **err_pos);

Sets priorities for the ciphers, key exchange methods, macs and compression methods. The `priority_cache` should be deinitialized using `gnutls_priority_deinit()`.

The priorities option allows you to specify a colon separated list of the cipher priorities to enable. Some keywords are defined to provide quick access to common preferences.

Unless there is a special need, use the "NORMAL" keyword to apply a reasonable security level, or "NORMAL:`COMPAT`" for compatibility.

"PERFORMANCE" means all the "secure" ciphersuites are enabled, limited to 128 bit ciphers and sorted by terms of speed performance.

"LEGACY" the NORMAL settings for GnuTLS 3.2.x or earlier. There is no verification profile set, and the allowed DH primes are considered weak today.

"NORMAL" means all "secure" ciphersuites. The 256-bit ciphers are included as a fallback only. The ciphers are sorted by security margin.

"PFS" means all "secure" ciphersuites that support perfect forward secrecy. The 256-bit ciphers are included as a fallback only. The ciphers are sorted by security margin.

"SECURE128" means all "secure" ciphersuites of security level 128-bit or more.

"SECURE192" means all "secure" ciphersuites of security level 192-bit or more.

"SUITEB128" means all the NSA SuiteB ciphersuites with security level of 128.

"SUITEB192" means all the NSA SuiteB ciphersuites with security level of 192.

"NONE" means nothing is enabled. This disables even protocols and compression methods.

"`KEYWORD` " The system administrator imposed settings. The provided keywords will be expanded from a configuration-time provided file - default is: /etc/gnutls/default-priorities. Any keywords that follow it, will be appended to the expanded string. If there is no system string, then the function will fail. The system file should be formatted as "KEYWORD=VALUE", e.g., "SYSTEM=NORMAL:+ARCFOUR-128".

Special keywords are "!", "-" and "+". "!" or "-" appended with an algorithm will remove this algorithm. "+" appended with an algorithm will add this algorithm.

Check the GnuTLS manual section "Priority strings" for detailed information.

Examples:

"NONE:+VERS-TLS-ALL:+MAC-ALL:+RSA:+AES-128-CBC:+SIGN-ALL:+COMP-NULL"

"NORMAL:+ARCFOUR-128" means normal ciphers plus ARCFOUR-128.

"SECURE128:-VERS-SSL3.0:+COMP-DEFLATE" means that only secure ciphers are enabled, SSL3.0 is disabled, and libz compression enabled.

"NONE:+VERS-TLS-ALL:+AES-128-CBC:+RSA:+SHA1:+COMP-NULL:+SIGN-RSA-SHA1",

"NONE:+VERS-TLS-ALL:+AES-128-CBC:+ECDHE-RSA:+SHA1:+COMP-NULL:+SIGN-RSA-SHA1:+CURVE-SECP256R1",

"SECURE256:+SECURE128",

Note that "NORMAL:`COMPAT`" is the most compatible mode.

A `NULL` `priorities` string indicates the default priorities to be used (this is available since GnuTLS 3.3.0).

#### Parameters

priority_cache | is a gnutls_prioritity_t type. |
priorities | is a string describing priorities (may be `NULL`) |
err_pos | In case of an error this will have the position in the string the error occurred |

#### Returns

On syntax error `GNUTLS_E_INVALID_REQUEST` is returned, `GNUTLS_E_SUCCESS` on success, or an error code.

### gnutls_priority_protocol_list ()

    int
    gnutls_priority_protocol_list (gnutls_priority_t pcache,
                                   const unsigned int **list);

Get a list of available TLS version numbers in the priority structure.

#### Parameters

pcache | is a gnutls_prioritity_t type. |
list | will point to an integer list |

#### Returns

the number of protocols, or an error code.

Since: 3.0

### gnutls_priority_set ()

    int
    gnutls_priority_set (gnutls_session_t session,
                         gnutls_priority_t priority);

Sets the priorities to use on the ciphers, key exchange methods, macs and compression methods.

#### Parameters

session | is a gnutls_session_t type. |
priority | is a gnutls_priority_t type. |

#### Returns

`GNUTLS_E_SUCCESS` on success, or an error code.

### gnutls_priority_set_direct ()

    int
    gnutls_priority_set_direct (gnutls_session_t session,
                                const char *priorities,
                                const char **err_pos);

Sets the priorities to use on the ciphers, key exchange methods, macs and compression methods. This function avoids keeping a priority cache and is used to directly set string priorities to a TLS session. For documentation check the `gnutls_priority_init()`.

To simply use a reasonable default, consider using `gnutls_set_default_priority()`.

#### Parameters

session | is a gnutls_session_t type. |
priorities | is a string describing priorities |
err_pos | In case of an error this will have the position in the string the error occured |

#### Returns

On syntax error `GNUTLS_E_INVALID_REQUEST` is returned, `GNUTLS_E_SUCCESS` on success, or an error code.

### gnutls_priority_sign_list ()

    int
    gnutls_priority_sign_list (gnutls_priority_t pcache,
                               const unsigned int **list);

Get a list of available signature algorithms in the priority structure.

#### Parameters

pcache | is a gnutls_prioritity_t type. |
list | will point to an integer list |

#### Returns

the number of algorithms, or an error code.

Since: 3.0

### gnutls_protocol_get_id ()

    gnutls_protocol_t
    gnutls_protocol_get_id (const char *name);

The names are compared in a case insensitive way.

#### Parameters

name | is a protocol name |

#### Returns

an id of the specified protocol, or `GNUTLS_VERSION_UNKNOWN` on error.

### gnutls_protocol_get_name ()

    const char *
    gnutls_protocol_get_name (gnutls_protocol_t version);

Convert a gnutls_protocol_t value to a string.

#### Parameters

version | is a (gnutls) version number |

#### Returns

a string that contains the name of the specified TLS version (e.g., "TLS1.0"), or `NULL`.

### gnutls_protocol_get_version ()

    gnutls_protocol_t
    gnutls_protocol_get_version (gnutls_session_t session);

Get TLS version, a gnutls_protocol_t value.

#### Parameters

session | is a gnutls_session_t type. |

#### Returns

The version of the currently used protocol.

### gnutls_protocol_list ()

    const gnutls_protocol_t *
    gnutls_protocol_list (void);

Get a list of supported protocols, e.g. SSL 3.0, TLS 1.0 etc.

This function is not thread safe.

#### Returns

a (0)-terminated list of gnutls_protocol_t integers indicating the available protocols.

### gnutls_psk_allocate_client_credentials ()

    int
    gnutls_psk_allocate_client_credentials
                                   (gnutls_psk_client_credentials_t *sc);

This structure is complex enough to manipulate directly thus this helper function is provided in order to allocate it.

#### Parameters

sc | is a pointer to a gnutls_psk_server_credentials_t type. |

#### Returns

On success, `GNUTLS_E_SUCCESS` (0) is returned, otherwise an error code is returned.

### gnutls_psk_allocate_server_credentials ()

    int
    gnutls_psk_allocate_server_credentials
                                   (gnutls_psk_server_credentials_t *sc);

This structure is complex enough to manipulate directly thus this helper function is provided in order to allocate it.

#### Parameters

sc | is a pointer to a gnutls_psk_server_credentials_t type. |

#### Returns

On success, `GNUTLS_E_SUCCESS` (0) is returned, otherwise an error code is returned.

### gnutls_psk_client_get_hint ()

    const char *
    gnutls_psk_client_get_hint (gnutls_session_t session);

The PSK identity hint may give the client help in deciding which username to use. This should only be called in case of PSK authentication and in case of a client.

#### Parameters

session | is a gnutls session |

#### Returns

the identity hint of the peer, or `NULL` in case of an error.

Since: 2.4.0

### gnutls_psk_free_client_credentials ()

    void
    gnutls_psk_free_client_credentials (gnutls_psk_client_credentials_t sc);

This structure is complex enough to manipulate directly thus this helper function is provided in order to free (deallocate) it.

#### Parameters

sc | is a gnutls_psk_client_credentials_t type. |

### gnutls_psk_free_server_credentials ()

    void
    gnutls_psk_free_server_credentials (gnutls_psk_server_credentials_t sc);

This structure is complex enough to manipulate directly thus this helper function is provided in order to free (deallocate) it.

#### Parameters

sc | is a gnutls_psk_server_credentials_t type. |

### gnutls_psk_server_get_username ()

    const char *
    gnutls_psk_server_get_username (gnutls_session_t session);

This should only be called in case of PSK authentication and in case of a server.

#### Parameters

session | is a gnutls session |

#### Returns

the username of the peer, or `NULL` in case of an error.

### gnutls_psk_set_client_credentials ()

    int
    gnutls_psk_set_client_credentials (gnutls_psk_client_credentials_t res,
                                       const char *username,
                                       const gnutls_datum_t *key,
                                       gnutls_psk_key_flags flags);

This function sets the username and password, in a gnutls_psk_client_credentials_t type. Those will be used in PSK authentication. `username` should be an ASCII string or UTF-8 strings prepared using the "SASLprep" profile of "stringprep". The key can be either in raw byte format or in Hex format (without the 0x prefix).

#### Parameters

res | is a gnutls_psk_client_credentials_t type. |
username | is the user's zero-terminated userid |
key | is the user's key |
flags | indicate the format of the key, either `GNUTLS_PSK_KEY_RAW` or `GNUTLS_PSK_KEY_HEX`. |

#### Returns

On success, `GNUTLS_E_SUCCESS` (0) is returned, otherwise an error code is returned.

### gnutls_psk_set_client_credentials_function ()

    void
    gnutls_psk_set_client_credentials_function
                                   (gnutls_psk_client_credentials_t cred,
                                    gnutls_psk_client_credentials_function *func);

This function can be used to set a callback to retrieve the username and password for client PSK authentication. The callback's function form is: int (*callback)(gnutls_session_t, char** username, gnutls_datum_t* key);

The `username` and `key->data` must be allocated using `gnutls_malloc()`. `username` should be ASCII strings or UTF-8 strings prepared using the "SASLprep" profile of "stringprep".

The callback function will be called once per handshake.

The callback function should return 0 on success. -1 indicates an error.

#### Parameters

cred | is a gnutls_psk_server_credentials_t type. |
func | is the callback function |

### gnutls_psk_set_params_function ()

    void
    gnutls_psk_set_params_function (gnutls_psk_server_credentials_t res,
                                    gnutls_params_function *func);

This function will set a callback in order for the server to get the Diffie-Hellman or RSA parameters for PSK authentication. The callback should return `GNUTLS_E_SUCCESS` (0) on success.

#### Parameters

res | is a gnutls_psk_server_credentials_t type |
func | is the function to be called |

### gnutls_psk_set_server_credentials_file ()

    int
    gnutls_psk_set_server_credentials_file
                                   (gnutls_psk_server_credentials_t res,
                                    const char *password_file);

This function sets the password file, in a gnutls_psk_server_credentials_t type. This password file holds usernames and keys and will be used for PSK authentication.

#### Parameters

res | is a gnutls_psk_server_credentials_t type. |
password_file | is the PSK password file (passwd.psk) |

#### Returns

On success, `GNUTLS_E_SUCCESS` (0) is returned, otherwise an error code is returned.

### gnutls_psk_set_server_credentials_function ()

    void
    gnutls_psk_set_server_credentials_function
                                   (gnutls_psk_server_credentials_t cred,
                                    gnutls_psk_server_credentials_function *func);

This function can be used to set a callback to retrieve the user's PSK credentials. The callback's function form is: int (*callback)(gnutls_session_t, const char* username, gnutls_datum_t* key);

`username` contains the actual username. The `key` must be filled in using the `gnutls_malloc()`.

In case the callback returned a negative number then gnutls will assume that the username does not exist.

The callback function will only be called once per handshake. The callback function should return 0 on success, while -1 indicates an error.

#### Parameters

cred | is a gnutls_psk_server_credentials_t type. |
func | is the callback function |

### gnutls_psk_set_server_credentials_hint ()

    int
    gnutls_psk_set_server_credentials_hint
                                   (gnutls_psk_server_credentials_t res,
                                    const char *hint);

This function sets the identity hint, in a gnutls_psk_server_credentials_t type. This hint is sent to the client to help it chose a good PSK credential (i.e., username and password).

#### Parameters

res | is a gnutls_psk_server_credentials_t type. |
hint | is the PSK identity hint string |

#### Returns

On success, `GNUTLS_E_SUCCESS` (0) is returned, otherwise an error code is returned.

Since: 2.4.0

### gnutls_psk_set_server_dh_params ()

    void
    gnutls_psk_set_server_dh_params (gnutls_psk_server_credentials_t res,
                                     gnutls_dh_params_t dh_params);

This function will set the Diffie-Hellman parameters for an anonymous server to use. These parameters will be used in Diffie-Hellman exchange with PSK cipher suites.

#### Parameters

res | is a gnutls_psk_server_credentials_t type |
dh_params | is a structure that holds Diffie-Hellman parameters. |

### gnutls_psk_set_server_params_function ()

    void
    gnutls_psk_set_server_params_function (gnutls_psk_server_credentials_t res,
                                           gnutls_params_function *func);

This function will set a callback in order for the server to get the Diffie-Hellman parameters for PSK authentication. The callback should return `GNUTLS_E_SUCCESS` (0) on success.

#### Parameters

res | is a gnutls_certificate_credentials_t type |
func | is the function to be called |

### gnutls_pull_func ()

    ssize_t
    (*gnutls_pull_func) (gnutls_transport_ptr_t Param1,
                         void *Param2,
                         size_t Param3);

### gnutls_pull_timeout_func ()

    int
    (*gnutls_pull_timeout_func) (gnutls_transport_ptr_t Param1,
                                 unsigned int ms);

### gnutls_push_func ()

    ssize_t
    (*gnutls_push_func) (gnutls_transport_ptr_t Param1,
                         const void *Param2,
                         size_t Param3);

### gnutls_random_art ()

    int
    gnutls_random_art (gnutls_random_art_t type,
                       const char *key_type,
                       unsigned int key_size,
                       void *fpr,
                       size_t fpr_size,
                       gnutls_datum_t *art);

This function will convert a given fingerprint to an "artistic" image. The returned image is allocated using `gnutls_malloc()`.

#### Parameters

type | The type of the random art (for now only `GNUTLS_RANDOM_ART_OPENSSH` is supported) |
key_type | The type of the key (RSA, DSA etc.) |
key_size | The size of the key in bits |
fpr | The fingerprint of the key |
fpr_size | The size of the fingerprint |
art | The returned random art |

#### Returns

On success, `GNUTLS_E_SUCCESS` (0) is returned, otherwise an error code is returned.

### gnutls_realloc_function ()

    void *
    (*gnutls_realloc_function) (void *Param1,
                                size_t Param2);

### gnutls_record_check_pending ()

    size_t
    gnutls_record_check_pending (gnutls_session_t session);

This function checks if there are unread data in the gnutls buffers. If the return value is non-zero the next call to `gnutls_record_recv()` is guaranteed not to block.

#### Parameters

session | is a gnutls_session_t type. |

#### Returns

Returns the size of the data or zero.

### gnutls_record_disable_padding ()

    void
    gnutls_record_disable_padding (gnutls_session_t session);

Used to disabled padding in TLS 1.0 and above. Normally you do not need to use this function, but there are buggy clients that complain if a server pads the encrypted data. This of course will disable protection against statistical attacks on the data.

This functions is defunt since 3.1.7. Random padding is disabled by default unless requested using `gnutls_range_send_message()`.

#### Parameters

session | is a gnutls_session_t type. |

### gnutls_record_get_direction ()

    int
    gnutls_record_get_direction (gnutls_session_t session);

This function provides information about the internals of the record protocol and is only useful if a prior gnutls function call (e.g. `gnutls_handshake()`) was interrupted for some reason, that is, if a function returned `GNUTLS_E_INTERRUPTED` or `GNUTLS_E_AGAIN`. In such a case, you might want to call `select()` or `poll()` before calling the interrupted gnutls function again. To tell you whether a file descriptor should be selected for either reading or writing, `gnutls_record_get_direction()` returns 0 if the interrupted function was trying to read data, and 1 if it was trying to write data.

This function's output is unreliable if you are using the `session` in different threads, for sending and receiving.

#### Parameters

session | is a gnutls_session_t type. |

#### Returns

0 if trying to read data, 1 if trying to write data.

### gnutls_record_get_max_size ()

    size_t
    gnutls_record_get_max_size (gnutls_session_t session);

Get the record size. The maximum record size is negotiated by the client after the first handshake message.

#### Parameters

session | is a gnutls_session_t type. |

#### Returns

The maximum record packet size in this connection.

### gnutls_record_recv ()

    ssize_t
    gnutls_record_recv (gnutls_session_t session,
                        void *data,
                        size_t data_size);

This function has the similar semantics with `recv()`. The only difference is that it accepts a GnuTLS session, and uses different error codes. In the special case that a server requests a renegotiation, the client may receive an error code of `GNUTLS_E_REHANDSHAKE`. This message may be simply ignored, replied with an alert `GNUTLS_A_NO_RENEGOTIATION`, or replied with a new handshake, depending on the client's will. If `EINTR` is returned by the internal push function (the default is `recv()`) then `GNUTLS_E_INTERRUPTED` will be returned. If `GNUTLS_E_INTERRUPTED` or `GNUTLS_E_AGAIN` is returned, you must call this function again to get the data. See also `gnutls_record_get_direction()`. A server may also receive `GNUTLS_E_REHANDSHAKE` when a client has initiated a handshake. In that case the server can only initiate a handshake or terminate the connection.

#### Parameters

session | is a gnutls_session_t type. |
data | the buffer that the data will be read into |
data_size | the number of requested bytes |

#### Returns

The number of bytes received and zero on EOF (for stream connections). A negative error code is returned in case of an error. The number of bytes received might be less than the requested `data_size` .

### gnutls_record_recv_seq ()

    ssize_t
    gnutls_record_recv_seq (gnutls_session_t session,
                            void *data,
                            size_t data_size,
                            unsigned char *seq);

This function is the same as `gnutls_record_recv()`, except that it returns in addition to data, the sequence number of the data. This is useful in DTLS where record packets might be received out-of-order. The returned 8-byte sequence number is an integer in big-endian format and should be treated as a unique message identification.

#### Parameters

session | is a gnutls_session_t type. |
data | the buffer that the data will be read into |
data_size | the number of requested bytes |
seq | is the packet's 64-bit sequence number. Should have space for 8 bytes. |

#### Returns

The number of bytes received and zero on EOF. A negative error code is returned in case of an error. The number of bytes received might be less than `data_size` .

Since: 3.0

### gnutls_record_send ()

    ssize_t
    gnutls_record_send (gnutls_session_t session,
                        const void *data,
                        size_t data_size);

This function has the similar semantics with `send()`. The only difference is that it accepts a GnuTLS session, and uses different error codes. Note that if the send buffer is full, `send()` will block this function. See the `send()` documentation for more information.

You can replace the default push function which is `send()`, by using `gnutls_transport_set_push_function()`.

If the EINTR is returned by the internal push function then `GNUTLS_E_INTERRUPTED` will be returned. If `GNUTLS_E_INTERRUPTED` or `GNUTLS_E_AGAIN` is returned, you must call this function again, with the exact same parameters; alternatively you could provide a `NULL` pointer for data, and 0 for size. cf. `gnutls_record_get_direction()`.

Note that in DTLS this function will return the `GNUTLS_E_LARGE_PACKET` error code if the send data exceed the data MTU value - as returned by `gnutls_dtls_get_data_mtu()`. The errno value EMSGSIZE also maps to `GNUTLS_E_LARGE_PACKET`. Note that since 3.2.13 this function can be called under cork in DTLS mode, and will refuse to send data over the MTU size by returning `GNUTLS_E_LARGE_PACKET`.

#### Parameters

session | is a gnutls_session_t type. |
data | contains the data to send |
data_size | is the length of the data |

#### Returns

The number of bytes sent, or a negative error code. The number of bytes sent might be less than `data_size` . The maximum number of bytes this function can send in a single call depends on the negotiated maximum record size.

### gnutls_record_set_max_size ()

    ssize_t
    gnutls_record_set_max_size (gnutls_session_t session,
                                size_t size);

This function sets the maximum record packet size in this connection. This property can only be set to clients. The server may choose not to accept the requested size.

Acceptable values are 512(=2^9), 1024(=2^10), 2048(=2^11) and 4096(=2^12). The requested record size does get in effect immediately only while sending data. The receive part will take effect after a successful handshake.

This function uses a TLS extension called 'max record size'. Not all TLS implementations use or even understand this extension.

#### Parameters

session | is a gnutls_session_t type. |
size | is the new size |

#### Returns

On success, `GNUTLS_E_SUCCESS` (0) is returned, otherwise a negative error code is returned.

### gnutls_rehandshake ()

    int
    gnutls_rehandshake (gnutls_session_t session);

This function will renegotiate security parameters with the client. This should only be called in case of a server.

This message informs the peer that we want to renegotiate parameters (perform a handshake).

If this function succeeds (returns 0), you must call the `gnutls_handshake()` function in order to negotiate the new parameters.

Since TLS is full duplex some application data might have been sent during peer's processing of this message. In that case one should call `gnutls_record_recv()` until GNUTLS_E_REHANDSHAKE is returned to clear any pending data. Care must be taken, if rehandshake is mandatory, to terminate if it does not start after some threshold.

If the client does not wish to renegotiate parameters he should reply with an alert message, thus the return code will be `GNUTLS_E_WARNING_ALERT_RECEIVED` and the alert will be `GNUTLS_A_NO_RENEGOTIATION`. A client may also choose to ignore this message.

#### Parameters

session | is a gnutls_session_t type. |

#### Returns

`GNUTLS_E_SUCCESS` on success, otherwise a negative error code.

### gnutls_safe_renegotiation_status ()

    int
    gnutls_safe_renegotiation_status (gnutls_session_t session);

Can be used to check whether safe renegotiation is being used in the current session.

#### Parameters

session | is a gnutls_session_t type. |

#### Returns

0 when safe renegotiation is not used and non (0) when safe renegotiation is used.

Since: 2.10.0

### gnutls_sec_param_get_name ()

    const char *
    gnutls_sec_param_get_name (gnutls_sec_param_t param);

Convert a gnutls_sec_param_t value to a string.

#### Parameters

param | is a security parameter |

#### Returns

a pointer to a string that contains the name of the specified security level, or `NULL`.

Since: 2.12.0

### gnutls_sec_param_to_pk_bits ()

    return
    gnutls_sec_param_to_pk_bits (GNUTLS_PK_DH Param1);

When generating private and public key pairs a difficult question is which size of "bits" the modulus will be in RSA and the group size in DSA. The easy answer is 1024, which is also wrong. This function will convert a human understandable security parameter to an appropriate size for the specific algorithm.

#### Returns

The number of bits, or (0).

Since: 2.12.0

### gnutls_server_name_get ()

    int
    gnutls_server_name_get (gnutls_session_t session,
                            void *data,
                            size_t *data_length,
                            unsigned int *type,
                            unsigned int indx);

This function will allow you to get the name indication (if any), a client has sent. The name indication may be any of the enumeration gnutls_server_name_type_t.

If `type` is GNUTLS_NAME_DNS, then this function is to be used by servers that support virtual hosting, and the data will be a null terminated IDNA ACE string (prior to GnuTLS 3.4.0 it was a UTF-8 string).

If `data` has not enough size to hold the server name GNUTLS_E_SHORT_MEMORY_BUFFER is returned, and `data_length` will hold the required size.

`index` is used to retrieve more than one server names (if sent by the client). The first server name has an index of 0, the second 1 and so on. If no name with the given index exists GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE is returned.

#### Parameters

session | is a gnutls_session_t type. |
data | will hold the data |
data_length | will hold the data length. Must hold the maximum size of data. |
type | will hold the server name indicator type |
indx | is the index of the server_name |

#### Returns

On success, `GNUTLS_E_SUCCESS` (0) is returned, otherwise a negative error code is returned.

### gnutls_server_name_set ()

    int
    gnutls_server_name_set (gnutls_session_t session,
                            gnutls_server_name_type_t type,
                            const void *name,
                            size_t name_length);

This function is to be used by clients that want to inform (via a TLS extension mechanism) the server of the name they connected to. This should be used by clients that connect to servers that do virtual hosting.

The value of `name` depends on the `type` type. In case of `GNUTLS_NAME_DNS`, a UTF-8 null-terminated domain name string, without the trailing dot, is expected.

IPv4 or IPv6 addresses are not permitted.

#### Parameters

session | is a gnutls_session_t type. |
type | specifies the indicator type |
name | is a string that contains the server name. |
name_length | holds the length of name |

#### Returns

On success, `GNUTLS_E_SUCCESS` (0) is returned, otherwise a negative error code is returned.

### gnutls_session_channel_binding ()

    int
    gnutls_session_channel_binding (gnutls_session_t session,
                                    gnutls_channel_binding_t cbtype,
                                    gnutls_datum_t *cb);

Extract given channel binding data of the `cbtype` (e.g., `GNUTLS_CB_TLS_UNIQUE`) type.

#### Parameters

session | is a gnutls_session_t type. |
cbtype | an gnutls_channel_binding_t enumeration type |
cb | output buffer array with data |

#### Returns

`GNUTLS_E_SUCCESS` on success, `GNUTLS_E_UNIMPLEMENTED_FEATURE` if the `cbtype` is unsupported, `GNUTLS_E_CHANNEL_BINDING_NOT_AVAILABLE` if the data is not currently available, or an error code.

Since: 2.12.0

### gnutls_session_enable_compatibility_mode ()

    void
    gnutls_session_enable_compatibility_mode
                                   (gnutls_session_t session);

This function can be used to disable certain (security) features in TLS in order to maintain maximum compatibility with buggy clients. Because several trade-offs with security are enabled, if required they will be reported through the audit subsystem.

Normally only servers that require maximum compatibility with everything out there, need to call this function.

Note that this function must be called after any call to gnutls_priority functions.

#### Parameters

session | is a gnutls_session_t type. |

### gnutls_session_get_data ()

    int
    gnutls_session_get_data (gnutls_session_t session,
                             void *session_data,
                             size_t *session_data_size);

Returns all session parameters needed to be stored to support resumption. The client should call this, and store the returned session data. A session may be resumed later by calling `gnutls_session_set_data()`. This function must be called after a successful (full) handshake. It should not be used in already resumed sessions --see `gnutls_session_is_resumed()`.

#### Parameters

session | is a gnutls_session_t type. |
session_data | is a pointer to space to hold the session. |
session_data_size | is the session_data's size, or it will be set by the function. |

#### Returns

On success, `GNUTLS_E_SUCCESS` (0) is returned, otherwise an error code is returned.

### gnutls_session_get_data2 ()

    int
    gnutls_session_get_data2 (gnutls_session_t session,
                              gnutls_datum_t *data);

Returns all session parameters needed to be stored to support resumption. The client should call this, and store the returned session data. A session may be resumed later by calling `gnutls_session_set_data()`. This function must be called after a successful (full) handshake. It should not be used in already resumed sessions --see `gnutls_session_is_resumed()`.

The returned `data` are allocated and must be released using `gnutls_free()`.

#### Parameters

session | is a gnutls_session_t type. |
data | is a pointer to a datum that will hold the session. |

#### Returns

On success, `GNUTLS_E_SUCCESS` (0) is returned, otherwise an error code is returned.

### gnutls_session_get_id ()

    int
    gnutls_session_get_id (gnutls_session_t session,
                           void *session_id,
                           size_t *session_id_size);

Returns the current session ID. This can be used if you want to check if the next session you tried to resume was actually resumed. That is because resumed sessions share the same session ID with the original session.

The session ID is selected by the server, that identify the current session. In all supported TLS protocols, the session id is less than `GNUTLS_MAX_SESSION_ID_SIZE`.

#### Parameters

session | is a gnutls_session_t type. |
session_id | is a pointer to space to hold the session id. |
session_id_size | initially should contain the maximum `session_id` size and will be updated. |

#### Returns

On success, `GNUTLS_E_SUCCESS` (0) is returned, otherwise an error code is returned.

### gnutls_session_get_id2 ()

    int
    gnutls_session_get_id2 (gnutls_session_t session,
                            gnutls_datum_t *session_id);

Returns the current session ID. The returned data should be treated as constant.

#### Parameters

session | is a gnutls_session_t type. |
session_id | will point to the session ID. |

#### Returns

On success, `GNUTLS_E_SUCCESS` (0) is returned, otherwise an error code is returned.

Since: 3.1.4

### gnutls_session_get_ptr ()

    void *
    gnutls_session_get_ptr (gnutls_session_t session);

Get user pointer for session. Useful in callbacks. This is the pointer set with `gnutls_session_set_ptr()`.

#### Parameters

session | is a gnutls_session_t type. |

#### Returns

the user given pointer from the session structure, or `NULL` if it was never set.

### gnutls_session_get_random ()

    void
    gnutls_session_get_random (gnutls_session_t session,
                               gnutls_datum_t *client,
                               gnutls_datum_t *server);

This function returns pointers to the client and server random fields used in the TLS handshake. The pointers are not to be modified or deallocated.

If a client random value has not yet been established, the output will be garbage.

#### Parameters

session | is a gnutls_session_t type. |
client | the client part of the random |
server | the server part of the random |

Since: 3.0

### gnutls_session_is_resumed ()

    int
    gnutls_session_is_resumed (gnutls_session_t session);

Check whether session is resumed or not.

#### Parameters

session | is a gnutls_session_t type. |

#### Returns

non zero if this session is resumed, or a zero if this is a new session.

### gnutls_session_resumption_requested ()

    int
    gnutls_session_resumption_requested (gnutls_session_t session);

Check whether the client has asked for session resumption. This function is valid only on server side.

#### Parameters

session | is a gnutls_session_t type. |

#### Returns

non zero if session resumption was asked, or a zero if not.

### gnutls_session_set_data ()

    int
    gnutls_session_set_data (gnutls_session_t session,
                             const void *session_data,
                             size_t session_data_size);

Sets all session parameters, in order to resume a previously established session. The session data given must be the one returned by `gnutls_session_get_data()`. This function should be called before `gnutls_handshake()`.

Keep in mind that session resuming is advisory. The server may choose not to resume the session, thus a full handshake will be performed.

#### Parameters

session | is a gnutls_session_t type. |
session_data | is a pointer to space to hold the session. |
session_data_size | is the session's size |

#### Returns

On success, `GNUTLS_E_SUCCESS` (0) is returned, otherwise an error code is returned.

### gnutls_session_set_premaster ()

    int
    gnutls_session_set_premaster (gnutls_session_t session,
                                  unsigned int entity,
                                  gnutls_protocol_t version,
                                  gnutls_kx_algorithm_t kx,
                                  gnutls_cipher_algorithm_t cipher,
                                  gnutls_mac_algorithm_t mac,
                                  gnutls_compression_method_t comp,
                                  const gnutls_datum_t *master,
                                  const gnutls_datum_t *session_id);

This function sets the premaster secret in a session. This is a function intended for exceptional uses. Do not use this function unless you are implementing a legacy protocol. Use `gnutls_session_set_data()` instead.

#### Parameters

session | is a gnutls_session_t type. |
entity | GNUTLS_SERVER or GNUTLS_CLIENT |
version | the TLS protocol version |
kx | the key exchange method |
cipher | the cipher |
mac | the MAC algorithm |
comp | the compression method |
master | the master key to use |
session_id | the session identifier |

#### Returns

On success, `GNUTLS_E_SUCCESS` (0) is returned, otherwise an error code is returned.

### gnutls_session_set_ptr ()

    void
    gnutls_session_set_ptr (gnutls_session_t session,
                            void *ptr);

This function will set (associate) the user given pointer `ptr` to the session structure. This pointer can be accessed with `gnutls_session_get_ptr()`.

#### Parameters

session | is a gnutls_session_t type. |
ptr | is the user pointer |

### gnutls_session_ticket_enable_client ()

    int
    gnutls_session_ticket_enable_client (gnutls_session_t session);

Request that the client should attempt session resumption using SessionTicket.

#### Parameters

session | is a gnutls_session_t type. |

#### Returns

On success, `GNUTLS_E_SUCCESS` (0) is returned, or an error code.

Since: 2.10.0

### gnutls_session_ticket_enable_server ()

    int
    gnutls_session_ticket_enable_server (gnutls_session_t session,
                                         const gnutls_datum_t *key);

Request that the server should attempt session resumption using SessionTicket. `key` must be initialized with `gnutls_session_ticket_key_generate()`, and should be overwritten using `gnutls_memset()` before being released.

#### Parameters

session | is a gnutls_session_t type. |
key | key to encrypt session parameters. |

#### Returns

On success, `GNUTLS_E_SUCCESS` (0) is returned, or an error code.

Since: 2.10.0

### gnutls_session_ticket_key_generate ()

    int
    gnutls_session_ticket_key_generate (gnutls_datum_t *key);

Generate a random key to encrypt security parameters within SessionTicket.

#### Parameters

key | is a pointer to a gnutls_datum_t which will contain a newly created key. |

#### Returns

On success, `GNUTLS_E_SUCCESS` (0) is returned, or an error code.

Since: 2.10.0

### gnutls_set_default_priority ()

    int
    gnutls_set_default_priority (gnutls_session_t session);

Sets the default priority on the ciphers, key exchange methods, macs and compression methods. For more fine-tuning you could use `gnutls_priority_set_direct()` or `gnutls_priority_set()` instead.

#### Parameters

session | is a gnutls_session_t type. |

#### Returns

`GNUTLS_E_SUCCESS` on success, or an error code.

### gnutls_sign_algorithm_get ()

    int
    gnutls_sign_algorithm_get (gnutls_session_t session);

Returns the signature algorithm that is (or will be) used in this session by the server to sign data.

#### Parameters

session | is a gnutls_session_t type. |

#### Returns

The sign algorithm or `GNUTLS_SIGN_UNKNOWN`.

Since: 3.1.1

### gnutls_sign_algorithm_get_requested ()

    int
    gnutls_sign_algorithm_get_requested (gnutls_session_t session,
                                         size_t indx,
                                         gnutls_sign_algorithm_t *algo);

Returns the signature algorithm specified by index that was requested by the peer. If the specified index has no data available this function returns `GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE`. If the negotiated TLS version does not support signature algorithms then `GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE` will be returned even for the first index. The first index is 0.

This function is useful in the certificate callback functions to assist in selecting the correct certificate.

#### Parameters

session | is a gnutls_session_t type. |
indx | is an index of the signature algorithm to return |
algo | the returned certificate type will be stored there |

#### Returns

On success, `GNUTLS_E_SUCCESS` (0) is returned, otherwise an error code is returned.

Since: 2.10.0

### gnutls_sign_get_hash_algorithm ()

    gnutls_digest_algorithm_t
    gnutls_sign_get_hash_algorithm (gnutls_sign_algorithm_t sign);

This function returns the digest algorithm corresponding to the given signature algorithms.

#### Parameters

sign | is a signature algorithm |

#### Returns

return a gnutls_digest_algorithm_t value, or `GNUTLS_DIG_UNKNOWN` on error.

Since: 3.1.1

### gnutls_sign_get_id ()

    gnutls_sign_algorithm_t
    gnutls_sign_get_id (const char *name);

The names are compared in a case insensitive way.

#### Parameters

name | is a sign algorithm name |

#### Returns

return a gnutls_sign_algorithm_t value corresponding to the specified algorithm, or `GNUTLS_SIGN_UNKNOWN` on error.

### gnutls_sign_get_name ()

    const char *
    gnutls_sign_get_name (gnutls_sign_algorithm_t algorithm);

Convert a gnutls_sign_algorithm_t value to a string.

#### Parameters

algorithm | is a sign algorithm |

#### Returns

a string that contains the name of the specified sign algorithm, or `NULL`.

### gnutls_sign_get_pk_algorithm ()

    gnutls_pk_algorithm_t
    gnutls_sign_get_pk_algorithm (gnutls_sign_algorithm_t sign);

This function returns the public key algorithm corresponding to the given signature algorithms.

#### Parameters

sign | is a signature algorithm |

#### Returns

return a gnutls_pk_algorithm_t value, or `GNUTLS_PK_UNKNOWN` on error.

Since: 3.1.1

### gnutls_sign_is_secure ()

    int
    gnutls_sign_is_secure (gnutls_sign_algorithm_t algorithm);

#### Parameters

algorithm | is a sign algorithm |

#### Returns

Non-zero if the provided signature algorithm is considered to be secure.

### gnutls_sign_list ()

    const gnutls_sign_algorithm_t *
    gnutls_sign_list (void);

Get a list of supported public key signature algorithms.

#### Returns

a (0)-terminated list of gnutls_sign_algorithm_t integers indicating the available ciphers.

### gnutls_srp_allocate_client_credentials ()

    int
    gnutls_srp_allocate_client_credentials
                                   (gnutls_srp_client_credentials_t *sc);

This structure is complex enough to manipulate directly thus this helper function is provided in order to allocate it.

#### Parameters

sc | is a pointer to a gnutls_srp_server_credentials_t type. |

#### Returns

On success, `GNUTLS_E_SUCCESS` (0) is returned, or an error code.

### gnutls_srp_allocate_server_credentials ()

    int
    gnutls_srp_allocate_server_credentials
                                   (gnutls_srp_server_credentials_t *sc);

This structure is complex enough to manipulate directly thus this helper function is provided in order to allocate it.

#### Parameters

sc | is a pointer to a gnutls_srp_server_credentials_t type. |

#### Returns

On success, `GNUTLS_E_SUCCESS` (0) is returned, or an error code.

### gnutls_srp_base64_decode ()

    int
    gnutls_srp_base64_decode (const gnutls_datum_t *b64_data,
                              char *result,
                              size_t *result_size);

This function will decode the given encoded data, using the base64 encoding found in libsrp.

Note that `b64_data` should be null terminated.

Warning! This base64 encoding is not the "standard" encoding, so do not use it for non-SRP purposes.

#### Parameters

b64_data | contain the encoded data |
result | the place where decoded data will be copied |
result_size | holds the size of the result |

#### Returns

`GNUTLS_E_SHORT_MEMORY_BUFFER` if the buffer given is not long enough, or 0 on success.

### gnutls_srp_base64_encode ()

    int
    gnutls_srp_base64_encode (const gnutls_datum_t *data,
                              char *result,
                              size_t *result_size);

This function will convert the given data to printable data, using the base64 encoding, as used in the libsrp. This is the encoding used in SRP password files. If the provided buffer is not long enough GNUTLS_E_SHORT_MEMORY_BUFFER is returned.

Warning! This base64 encoding is not the "standard" encoding, so do not use it for non-SRP purposes.

#### Parameters

data | contain the raw data |
result | the place where base64 data will be copied |
result_size | holds the size of the result |

#### Returns

`GNUTLS_E_SHORT_MEMORY_BUFFER` if the buffer given is not long enough, or 0 on success.

### gnutls_srp_free_client_credentials ()

    void
    gnutls_srp_free_client_credentials (gnutls_srp_client_credentials_t sc);

This structure is complex enough to manipulate directly thus this helper function is provided in order to free (deallocate) it.

#### Parameters

sc | is a gnutls_srp_client_credentials_t type. |

### gnutls_srp_free_server_credentials ()

    void
    gnutls_srp_free_server_credentials (gnutls_srp_server_credentials_t sc);

This structure is complex enough to manipulate directly thus this helper function is provided in order to free (deallocate) it.

#### Parameters

sc | is a gnutls_srp_server_credentials_t type. |

### gnutls_srp_server_get_username ()

    const char *
    gnutls_srp_server_get_username (gnutls_session_t session);

This function will return the username of the peer. This should only be called in case of SRP authentication and in case of a server. Returns NULL in case of an error.

#### Parameters

session | is a gnutls session |

#### Returns

SRP username of the peer, or NULL in case of error.

### gnutls_srp_set_client_credentials ()

    int
    gnutls_srp_set_client_credentials (gnutls_srp_client_credentials_t res,
                                       const char *username,
                                       const char *password);

This function sets the username and password, in a gnutls_srp_client_credentials_t type. Those will be used in SRP authentication. `username` and `password` should be ASCII strings or UTF-8 strings prepared using the "SASLprep" profile of "stringprep".

#### Parameters

res | is a gnutls_srp_client_credentials_t type. |
username | is the user's userid |
password | is the user's password |

#### Returns

On success, `GNUTLS_E_SUCCESS` (0) is returned, or an error code.

### gnutls_srp_set_client_credentials_function ()

    void
    gnutls_srp_set_client_credentials_function
                                   (gnutls_srp_client_credentials_t cred,
                                    gnutls_srp_client_credentials_function *func);

This function can be used to set a callback to retrieve the username and password for client SRP authentication. The callback's function form is:

int (*callback)(gnutls_session_t, char** username, char**password);

The `username` and `password` must be allocated using `gnutls_malloc()`. `username` and `password` should be ASCII strings or UTF-8 strings prepared using the "SASLprep" profile of "stringprep".

The callback function will be called once per handshake before the initial hello message is sent.

The callback should not return a negative error code the second time called, since the handshake procedure will be aborted.

The callback function should return 0 on success. -1 indicates an error.

#### Parameters

cred | is a gnutls_srp_server_credentials_t type. |
func | is the callback function |

### gnutls_srp_set_prime_bits ()

    void
    gnutls_srp_set_prime_bits (gnutls_session_t session,
                               unsigned int bits);

This function sets the minimum accepted number of bits, for use in an SRP key exchange. If zero, the default 2048 bits will be used.

In the client side it sets the minimum accepted number of bits. If a server sends a prime with less bits than that `GNUTLS_E_RECEIVED_ILLEGAL_PARAMETER` will be returned by the handshake.

This function has no effect in server side.

#### Parameters

session | is a gnutls_session_t type. |
bits | is the number of bits |

Since: 2.6.0

### gnutls_srp_set_server_credentials_file ()

    int
    gnutls_srp_set_server_credentials_file
                                   (gnutls_srp_server_credentials_t res,
                                    const char *password_file,
                                    const char *password_conf_file);

This function sets the password files, in a gnutls_srp_server_credentials_t type. Those password files hold usernames and verifiers and will be used for SRP authentication.

#### Parameters

res | is a gnutls_srp_server_credentials_t type. |
password_file | is the SRP password file (tpasswd) |
password_conf_file | is the SRP password conf file (tpasswd.conf) |

#### Returns

On success, `GNUTLS_E_SUCCESS` (0) is returned, or an error code.

### gnutls_srp_set_server_credentials_function ()

    void
    gnutls_srp_set_server_credentials_function
                                   (gnutls_srp_server_credentials_t cred,
                                    gnutls_srp_server_credentials_function *func);

This function can be used to set a callback to retrieve the user's SRP credentials. The callback's function form is:

int (*callback)(gnutls_session_t, const char* username, gnutls_datum_t *salt, gnutls_datum_t *verifier, gnutls_datum_t *generator, gnutls_datum_t *prime);

`username` contains the actual username. The `salt` , `verifier` , `generator` and `prime` must be filled in using the `gnutls_malloc()`. For convenience `prime` and `generator` may also be one of the static parameters defined in gnutls.h.

Initially, the data field is NULL in every gnutls_datum_t structure that the callback has to fill in. When the callback is done GnuTLS deallocates all of those buffers which are non-NULL, regardless of the return value.

In order to prevent attackers from guessing valid usernames, if a user does not exist, g and n values should be filled in using a random user's parameters. In that case the callback must return the special value (1). See gnutls_srp_set_server_fake_salt_seed too. If this is not required for your application, return a negative number from the callback to abort the handshake.

The callback function will only be called once per handshake. The callback function should return 0 on success, while -1 indicates an error.

#### Parameters

cred | is a gnutls_srp_server_credentials_t type. |
func | is the callback function |

### gnutls_srp_verifier ()

    int
    gnutls_srp_verifier (const char *username,
                         const char *password,
                         const gnutls_datum_t *salt,
                         const gnutls_datum_t *generator,
                         const gnutls_datum_t *prime,
                         gnutls_datum_t *res);

This function will create an SRP verifier, as specified in RFC2945. The `prime` and `generator` should be one of the static parameters defined in gnutls/gnutls.h or may be generated.

The verifier will be allocated with ``gnutls_malloc()`` and will be stored in `res` using binary format.

#### Parameters

username | is the user's name |
password | is the user's password |
salt | should be some randomly generated bytes |
generator | is the generator of the group |
prime | is the group's prime |
res | where the verifier will be stored. |

#### Returns

On success, `GNUTLS_E_SUCCESS` (0) is returned, or an error code.

### gnutls_srtp_get_keys ()

    int
    gnutls_srtp_get_keys (gnutls_session_t session,
                          void *key_material,
                          unsigned int key_material_size,
                          gnutls_datum_t *client_key,
                          gnutls_datum_t *client_salt,
                          gnutls_datum_t *server_key,
                          gnutls_datum_t *server_salt);

This is a helper function to generate the keying material for SRTP. It requires the space of the key material to be pre-allocated (should be at least 2x the maximum key size and salt size). The `client_key` , `client_salt` , `server_key` and `server_salt` are convenience datums that point inside the key material. They may be `NULL`.

#### Parameters

session | is a gnutls_session_t type. |
key_material | Space to hold the generated key material |
key_material_size | The maximum size of the key material |
client_key | The master client write key, pointing inside the key material |
client_salt | The master client write salt, pointing inside the key material |
server_key | The master server write key, pointing inside the key material |
server_salt | The master server write salt, pointing inside the key material |

#### Returns

On success the size of the key material is returned, otherwise, `GNUTLS_E_SHORT_MEMORY_BUFFER` if the buffer given is not sufficient, or a negative error code.

Since 3.1.4

### gnutls_srtp_get_mki ()

    int
    gnutls_srtp_get_mki (gnutls_session_t session,
                         gnutls_datum_t *mki);

This function exports the negotiated Master Key Identifier, received by the peer if any. The returned value in `mki` should be treated as constant and valid only during the session's lifetime.

#### Parameters

session | is a gnutls_session_t type. |
mki | will hold the MKI |

#### Returns

On success, `GNUTLS_E_SUCCESS` (0) is returned, otherwise a negative error code is returned.

Since 3.1.4

### gnutls_srtp_get_profile_id ()

    int
    gnutls_srtp_get_profile_id (const char *name,
                                gnutls_srtp_profile_t *profile);

This function allows you to look up a profile based on a string.

#### Parameters

name | The name of the profile to look up |
profile | Will hold the profile id |

#### Returns

On success, `GNUTLS_E_SUCCESS` (0) is returned, otherwise a negative error code is returned.

Since 3.1.4

### gnutls_srtp_get_profile_name ()

    const char *
    gnutls_srtp_get_profile_name (gnutls_srtp_profile_t profile);

This function allows you to get the corresponding name for a SRTP protection profile.

#### Parameters

profile | The profile to look up a string for |

#### Returns

On success, the name of a SRTP profile as a string, otherwise NULL.

Since 3.1.4

### gnutls_srtp_get_selected_profile ()

    int
    gnutls_srtp_get_selected_profile (gnutls_session_t session,
                                      gnutls_srtp_profile_t *profile);

This function allows you to get the negotiated SRTP profile.

#### Parameters

session | is a gnutls_session_t type. |
profile | will hold the profile |

#### Returns

On success, `GNUTLS_E_SUCCESS` (0) is returned, otherwise a negative error code is returned.

Since 3.1.4

### gnutls_srtp_set_mki ()

    int
    gnutls_srtp_set_mki (gnutls_session_t session,
                         const gnutls_datum_t *mki);

This function sets the Master Key Identifier, to be used by this session (if any).

#### Parameters

session | is a gnutls_session_t type. |
mki | holds the MKI |

#### Returns

On success, `GNUTLS_E_SUCCESS` (0) is returned, otherwise a negative error code is returned.

Since 3.1.4

### gnutls_srtp_set_profile ()

    int
    gnutls_srtp_set_profile (gnutls_session_t session,
                             gnutls_srtp_profile_t profile);

This function is to be used by both clients and servers, to declare what SRTP profiles they support, to negotiate with the peer.

#### Parameters

session | is a gnutls_session_t type. |
profile | is the profile id to add. |

#### Returns

On success, `GNUTLS_E_SUCCESS` (0) is returned, otherwise a negative error code is returned.

Since 3.1.4

### gnutls_srtp_set_profile_direct ()

    int
    gnutls_srtp_set_profile_direct (gnutls_session_t session,
                                    const char *profiles,
                                    const char **err_pos);

This function is to be used by both clients and servers, to declare what SRTP profiles they support, to negotiate with the peer.

#### Parameters

session | is a gnutls_session_t type. |
profiles | is a string that contains the supported SRTP profiles, separated by colons. |
err_pos | In case of an error this will have the position in the string the error occured, may be NULL. |

#### Returns

On syntax error `GNUTLS_E_INVALID_REQUEST` is returned, `GNUTLS_E_SUCCESS` on success, or an error code.

Since 3.1.4

### gnutls_store_commitment ()

    int
    gnutls_store_commitment (const char *db_name,
                             gnutls_tdb_t tdb,
                             const char *host,
                             const char *service,
                             gnutls_digest_algorithm_t hash_algo,
                             const gnutls_datum_t *hash,
                             time_t expiration,
                             unsigned int flags);

This function will store the provided hash commitment to the list of stored public keys. The key with the given hash will be considered valid until the provided expiration time.

The `store` variable if non-null specifies a custom backend for the storage of entries. If it is NULL then the default file backend will be used.

Note that this function is not thread safe with the default backend.

#### Parameters

db_name | A file specifying the stored keys (use NULL for the default) |
tdb | A storage structure or NULL to use the default |
host | The peer's name |
service | non-NULL if this key is specific to a service (e.g. http) |
hash_algo | The hash algorithm type |
hash | The raw hash |
expiration | The expiration time (use 0 to disable expiration) |
flags | should be 0. |

#### Returns

On success, `GNUTLS_E_SUCCESS` (0) is returned, otherwise a negative error value.

Since: 3.0

### gnutls_store_pubkey ()

    int
    gnutls_store_pubkey (const char *db_name,
                         gnutls_tdb_t tdb,
                         const char *host,
                         const char *service,
                         gnutls_certificate_type_t cert_type,
                         const gnutls_datum_t *cert,
                         time_t expiration,
                         unsigned int flags);

This function will store the provided (raw or DER-encoded) certificate to the list of stored public keys. The key will be considered valid until the provided expiration time.

The `store` variable if non-null specifies a custom backend for the storage of entries. If it is NULL then the default file backend will be used.

#### Parameters

db_name | A file specifying the stored keys (use NULL for the default) |
tdb | A storage structure or NULL to use the default |
host | The peer's name |
service | non-NULL if this key is specific to a service (e.g. http) |
cert_type | The type of the certificate |
cert | The data of the certificate |
expiration | The expiration time (use 0 to disable expiration) |
flags | should be 0. |

#### Returns

On success, `GNUTLS_E_SUCCESS` (0) is returned, otherwise a negative error value.

Since: 3.0.13

### gnutls_strerror ()

    const char *
    gnutls_strerror (int error);

This function is similar to strerror. The difference is that it accepts an error number returned by a gnutls function; In case of an unknown error a descriptive string is sent instead of `NULL`.

Error codes are always a negative error code.

#### Parameters

error | is a GnuTLS error code, a negative error code |

#### Returns

A string explaining the GnuTLS error message.

### gnutls_strerror_name ()

    const char *
    gnutls_strerror_name (int error);

Return the GnuTLS error code define as a string. For example, gnutls_strerror_name (GNUTLS_E_DH_PRIME_UNACCEPTABLE) will return the string "GNUTLS_E_DH_PRIME_UNACCEPTABLE".

#### Parameters

error | is an error returned by a gnutls function. |

#### Returns

A string corresponding to the symbol name of the error code.

Since: 2.6.0

### gnutls_tdb_deinit ()

    void
    gnutls_tdb_deinit (gnutls_tdb_t tdb);

This function will deinitialize a public key trust storage structure.

#### Parameters

tdb | The structure to be deinitialized |

### gnutls_tdb_init ()

    int
    gnutls_tdb_init (gnutls_tdb_t *tdb);

This function will initialize a public key trust storage structure.

#### Parameters

tdb | A pointer to the type to be initialized |

#### Returns

On success, `GNUTLS_E_SUCCESS` (0) is returned, otherwise a negative error value.

### gnutls_tdb_set_store_commitment_func ()

    void
    gnutls_tdb_set_store_commitment_func (gnutls_tdb_t tdb,
                                          gnutls_tdb_store_commitment_func cstore);

### gnutls_tdb_set_store_func ()

    void
    gnutls_tdb_set_store_func (gnutls_tdb_t tdb,
                               gnutls_tdb_store_func store);

### gnutls_tdb_set_verify_func ()

    void
    gnutls_tdb_set_verify_func (gnutls_tdb_t tdb,
                                gnutls_tdb_verify_func verify);

### gnutls_tdb_store_commitment_func ()

    int
    (*gnutls_tdb_store_commitment_func) (const char *db_name,
                                         const char *host,
                                         const char *service,
                                         time_t expiration,
                                         gnutls_digest_algorithm_t hash_algo,
                                         const gnutls_datum_t *hash);

### gnutls_tdb_store_func ()

    int
    (*gnutls_tdb_store_func) (const char *db_name,
                              const char *host,
                              const char *service,
                              time_t expiration,
                              const gnutls_datum_t *pubkey);

### gnutls_tdb_verify_func ()

    int
    (*gnutls_tdb_verify_func) (const char *db_name,
                               const char *host,
                               const char *service,
                               const gnutls_datum_t *pubkey);

### gnutls_time_func ()

    time_t
    (*gnutls_time_func) (time_t *t);

Function prototype for `time()`-like function. Set with `gnutls_global_set_time_function()`.

#### Parameters

t | where to store time. |

#### Returns

Number of seconds since the epoch, or (time_t)-1 on errors.

### gnutls_transport_get_ptr ()

    gnutls_transport_ptr_t
    gnutls_transport_get_ptr (gnutls_session_t session);

Used to get the first argument of the transport function (like PUSH and PULL). This must have been set using `gnutls_transport_set_ptr()`.

#### Parameters

session | is a gnutls_session_t type. |

#### Returns

The first argument of the transport function.

### gnutls_transport_get_ptr2 ()

    void
    gnutls_transport_get_ptr2 (gnutls_session_t session,
                               gnutls_transport_ptr_t *recv_ptr,
                               gnutls_transport_ptr_t *send_ptr);

Used to get the arguments of the transport functions (like PUSH and PULL). These should have been set using `gnutls_transport_set_ptr2()`.

#### Parameters

session | is a gnutls_session_t type. |
recv_ptr | will hold the value for the pull function |
send_ptr | will hold the value for the push function |

### gnutls_transport_set_errno ()

    void
    gnutls_transport_set_errno (gnutls_session_t session,
                                int err);

Store `err` in the session-specific errno variable. Useful values for `err` are EINTR, EAGAIN and EMSGSIZE, other values are treated will be treated as real errors in the push/pull function.

This function is useful in replacement push and pull functions set by `gnutls_transport_set_push_function()` and `gnutls_transport_set_pull_function()` under Windows, where the replacements may not have access to the same `errno` variable that is used by GnuTLS (e.g., the application is linked to msvcr71.dll and gnutls is linked to msvcrt.dll).

#### Parameters

session | is a gnutls_session_t type. |
err | error value to store in session-specific errno variable. |

### gnutls_transport_set_errno_function ()

    void
    gnutls_transport_set_errno_function (gnutls_session_t session,
                                         gnutls_errno_func errno_func);

This is the function where you set a function to retrieve errno after a failed push or pull operation.

`errno_func` is of the form, int (*gnutls_errno_func)(gnutls_transport_ptr_t); and should return the errno.

#### Parameters

session | is a gnutls_session_t type. |
errno_func | a callback function similar to `write()` |

Since: 2.12.0

### gnutls_transport_set_ptr ()

    void
    gnutls_transport_set_ptr (gnutls_session_t session,
                              gnutls_transport_ptr_t ptr);

Used to set the first argument of the transport function (for push and pull callbacks). In berkeley style sockets this function will set the connection descriptor.

#### Parameters

session | is a gnutls_session_t type. |
ptr | is the value. |

### gnutls_transport_set_ptr2 ()

    void
    gnutls_transport_set_ptr2 (gnutls_session_t session,
                               gnutls_transport_ptr_t recv_ptr,
                               gnutls_transport_ptr_t send_ptr);

Used to set the first argument of the transport function (for push and pull callbacks). In berkeley style sockets this function will set the connection descriptor. With this function you can use two different pointers for receiving and sending.

#### Parameters

session | is a gnutls_session_t type. |
recv_ptr | is the value for the pull function |
send_ptr | is the value for the push function |

### gnutls_transport_set_pull_function ()

    void
    gnutls_transport_set_pull_function (gnutls_session_t session,
                                        gnutls_pull_func pull_func);

This is the function where you set a function for gnutls to receive data. Normally, if you use berkeley style sockets, do not need to use this function since the default recv(2) will probably be ok. The callback should return 0 on connection termination, a positive number indicating the number of bytes received, and -1 on error.

`gnutls_pull_func` is of the form, ssize_t (*gnutls_pull_func)(gnutls_transport_ptr_t, void*, size_t);

#### Parameters

session | is a gnutls_session_t type. |
pull_func | a callback function similar to `read()` |

### gnutls_transport_set_pull_timeout_function ()

    void
    gnutls_transport_set_pull_timeout_function
                                   (gnutls_session_t session,
                                    gnutls_pull_timeout_func func);

This is the function where you set a function for gnutls to know whether data are ready to be received. It should wait for data a given time frame in milliseconds. The callback should return 0 on timeout, a positive number if data can be received, and -1 on error. You'll need to override this function if `select()` is not suitable for the provided transport calls.

As with `select()`, if the timeout value is zero the callback should return zero if no data are immediately available.

`gnutls_pull_timeout_func` is of the form, int (*gnutls_pull_timeout_func)(gnutls_transport_ptr_t, unsigned int ms);

This callback is necessary when `gnutls_handshake_set_timeout()` or `gnutls_record_set_timeout()` are set. It will not be used when non-blocking sockets are in use. That is, this function will not operate when `GNUTLS_NONBLOCK` is specified in `gnutls_init()`, or a custom pull function is registered without updating the pull timeout function.

The helper function `gnutls_system_recv_timeout()` is provided to simplify writing callbacks.

#### Parameters

session | is a gnutls_session_t type. |
func | a callback function |

Since: 3.0

### gnutls_transport_set_push_function ()

    void
    gnutls_transport_set_push_function (gnutls_session_t session,
                                        gnutls_push_func push_func);

This is the function where you set a push function for gnutls to use in order to send data. If you are going to use berkeley style sockets, you do not need to use this function since the default send(2) will probably be ok. Otherwise you should specify this function for gnutls to be able to send data. The callback should return a positive number indicating the bytes sent, and -1 on error.

`push_func` is of the form, ssize_t (*gnutls_push_func)(gnutls_transport_ptr_t, const void*, size_t);

#### Parameters

session | is a gnutls_session_t type. |
push_func | a callback function similar to `write()` |

### gnutls_transport_set_vec_push_function ()

    void
    gnutls_transport_set_vec_push_function
                                   (gnutls_session_t session,
                                    gnutls_vec_push_func vec_func);

Using this function you can override the default writev(2) function for gnutls to send data. Setting this callback instead of `gnutls_transport_set_push_function()` is recommended since it introduces less overhead in the TLS handshake process.

`vec_func` is of the form, ssize_t (*gnutls_vec_push_func) (gnutls_transport_ptr_t, const giovec_t * iov, int iovcnt);

#### Parameters

session | is a gnutls_session_t type. |
vec_func | a callback function similar to `writev()` |

Since: 2.12.0

### gnutls_url_is_supported ()

    int
    gnutls_url_is_supported (const char *url);

Check whether url is supported. Depending on the system libraries GnuTLS may support pkcs11 or tpmkey URLs.

#### Parameters

url | A PKCS 11 url |

#### Returns

return non-zero if the given URL is supported, and zero if it is not known.

Since: 3.1.0

### gnutls_vec_push_func ()

    ssize_t
    (*gnutls_vec_push_func) (gnutls_transport_ptr_t Param1,
                             const giovec_t *iov,
                             int iovcnt);

### gnutls_verify_stored_pubkey ()

    int
    gnutls_verify_stored_pubkey (const char *db_name,
                                 gnutls_tdb_t tdb,
                                 const char *host,
                                 const char *service,
                                 gnutls_certificate_type_t cert_type,
                                 const gnutls_datum_t *cert,
                                 unsigned int flags);

This function will try to verify the provided (raw or DER-encoded) certificate using a list of stored public keys. The `service` field if non-NULL should be a port number.

The `retrieve` variable if non-null specifies a custom backend for the retrieval of entries. If it is NULL then the default file backend will be used. In POSIX-like systems the file backend uses the $HOME/.gnutls/known_hosts file.

Note that if the custom storage backend is provided the retrieval function should return `GNUTLS_E_CERTIFICATE_KEY_MISMATCH` if the host/service pair is found but key doesn't match, `GNUTLS_E_NO_CERTIFICATE_FOUND` if no such host/service with the given key is found, and 0 if it was found. The storage function should return 0 on success.

#### Parameters

db_name | A file specifying the stored keys (use NULL for the default) |
tdb | A storage structure or NULL to use the default |
host | The peer's name |
service | non-NULL if this key is specific to a service (e.g. http) |
cert_type | The type of the certificate |
cert | The raw (der) data of the certificate |
flags | should be 0. |

#### Returns

If no associated public key is found then `GNUTLS_E_NO_CERTIFICATE_FOUND` will be returned. If a key is found but does not match `GNUTLS_E_CERTIFICATE_KEY_MISMATCH` is returned. On success, `GNUTLS_E_SUCCESS` (0) is returned, or a negative error value on other errors.

Since: 3.0.13

### mutex_deinit_func ()

    int
    (*mutex_deinit_func) (void **mutex);

### mutex_init_func ()

    int
    (*mutex_init_func) (void **mutex);

### mutex_lock_func ()

    int
    (*mutex_lock_func) (void **mutex);

### mutex_unlock_func ()

    int
    (*mutex_unlock_func) (void **mutex);

## Types and Values

### GNUTLS_CIPHER_ARCFOUR

    #define GNUTLS_CIPHER_ARCFOUR GNUTLS_CIPHER_ARCFOUR_128

### GNUTLS_CIPHER_RIJNDAEL_128_CBC

    #define GNUTLS_CIPHER_RIJNDAEL_128_CBC GNUTLS_CIPHER_AES_128_CBC

### GNUTLS_CIPHER_RIJNDAEL_256_CBC

    #define GNUTLS_CIPHER_RIJNDAEL_256_CBC GNUTLS_CIPHER_AES_256_CBC

### GNUTLS_CIPHER_RIJNDAEL_CBC

    #define GNUTLS_CIPHER_RIJNDAEL_CBC GNUTLS_CIPHER_AES_128_CBC

### GNUTLS_DIG_SHA

    #define GNUTLS_DIG_SHA GNUTLS_DIG_SHA1

### GNUTLS_E_AGAIN

    #define GNUTLS_E_AGAIN -28

### GNUTLS_E_APPLICATION_ERROR_MAX

    #define GNUTLS_E_APPLICATION_ERROR_MAX -65000

### GNUTLS_E_APPLICATION_ERROR_MIN

    #define GNUTLS_E_APPLICATION_ERROR_MIN -65500

### GNUTLS_E_ASN1_DER_ERROR

    #define GNUTLS_E_ASN1_DER_ERROR -69

### GNUTLS_E_ASN1_DER_OVERFLOW

    #define GNUTLS_E_ASN1_DER_OVERFLOW -77

### GNUTLS_E_ASN1_ELEMENT_NOT_FOUND

    #define GNUTLS_E_ASN1_ELEMENT_NOT_FOUND -67

### GNUTLS_E_ASN1_GENERIC_ERROR

    #define GNUTLS_E_ASN1_GENERIC_ERROR -71

### GNUTLS_E_ASN1_IDENTIFIER_NOT_FOUND

    #define GNUTLS_E_ASN1_IDENTIFIER_NOT_FOUND -68

### GNUTLS_E_ASN1_SYNTAX_ERROR

    #define GNUTLS_E_ASN1_SYNTAX_ERROR -76

### GNUTLS_E_ASN1_TAG_ERROR

    #define GNUTLS_E_ASN1_TAG_ERROR -73

### GNUTLS_E_ASN1_TAG_IMPLICIT

    #define GNUTLS_E_ASN1_TAG_IMPLICIT -74

### GNUTLS_E_ASN1_TYPE_ANY_ERROR

    #define GNUTLS_E_ASN1_TYPE_ANY_ERROR -75

### GNUTLS_E_ASN1_VALUE_NOT_FOUND

    #define GNUTLS_E_ASN1_VALUE_NOT_FOUND -70

### GNUTLS_E_ASN1_VALUE_NOT_VALID

    #define GNUTLS_E_ASN1_VALUE_NOT_VALID -72

### GNUTLS_E_BAD_COOKIE

    #define GNUTLS_E_BAD_COOKIE -214

### GNUTLS_E_BASE64_DECODING_ERROR

    #define GNUTLS_E_BASE64_DECODING_ERROR -34

### GNUTLS_E_BASE64_ENCODING_ERROR

    #define GNUTLS_E_BASE64_ENCODING_ERROR -201

### GNUTLS_E_BASE64_UNEXPECTED_HEADER_ERROR

    #define GNUTLS_E_BASE64_UNEXPECTED_HEADER_ERROR -207

### GNUTLS_E_CERTIFICATE_ERROR

    #define GNUTLS_E_CERTIFICATE_ERROR -43

### GNUTLS_E_CERTIFICATE_KEY_MISMATCH

    #define GNUTLS_E_CERTIFICATE_KEY_MISMATCH -60

### GNUTLS_E_CERTIFICATE_LIST_UNSORTED

    #define GNUTLS_E_CERTIFICATE_LIST_UNSORTED -324

### GNUTLS_E_CHANNEL_BINDING_NOT_AVAILABLE

    #define GNUTLS_E_CHANNEL_BINDING_NOT_AVAILABLE -213

### GNUTLS_E_COMPRESSION_FAILED

    #define GNUTLS_E_COMPRESSION_FAILED -27

### GNUTLS_E_CONSTRAINT_ERROR

    #define GNUTLS_E_CONSTRAINT_ERROR -101

### GNUTLS_E_CRYPTODEV_DEVICE_ERROR

    #define GNUTLS_E_CRYPTODEV_DEVICE_ERROR -212

### GNUTLS_E_CRYPTODEV_IOCTL_ERROR

    #define GNUTLS_E_CRYPTODEV_IOCTL_ERROR -211

### GNUTLS_E_CRYPTO_ALREADY_REGISTERED

    #define GNUTLS_E_CRYPTO_ALREADY_REGISTERED GNUTLS_E_ALREADY_REGISTERED

### GNUTLS_E_CRYPTO_INIT_FAILED

    #define GNUTLS_E_CRYPTO_INIT_FAILED -318

### GNUTLS_E_DB_ERROR

    #define GNUTLS_E_DB_ERROR -30

### GNUTLS_E_DECOMPRESSION_FAILED

    #define GNUTLS_E_DECOMPRESSION_FAILED -26 /* GNUTLS_A_DECOMPRESSION_FAILURE */

### GNUTLS_E_DECRYPTION_FAILED

    #define GNUTLS_E_DECRYPTION_FAILED -24 /* GNUTLS_A_DECRYPTION_FAILED, GNUTLS_A_BAD_RECORD_MAC */

### GNUTLS_E_DH_PRIME_UNACCEPTABLE

    #define GNUTLS_E_DH_PRIME_UNACCEPTABLE -63

### GNUTLS_E_ECC_NO_SUPPORTED_CURVES

    #define GNUTLS_E_ECC_NO_SUPPORTED_CURVES -321

### GNUTLS_E_ECC_UNSUPPORTED_CURVE

    #define GNUTLS_E_ECC_UNSUPPORTED_CURVE -322

### GNUTLS_E_ENCRYPTION_FAILED

    #define GNUTLS_E_ENCRYPTION_FAILED -40

### GNUTLS_E_ERROR_IN_FINISHED_PACKET

    #define GNUTLS_E_ERROR_IN_FINISHED_PACKET -18

### GNUTLS_E_EXPIRED

    #define GNUTLS_E_EXPIRED -29

### GNUTLS_E_FATAL_ALERT_RECEIVED

    #define GNUTLS_E_FATAL_ALERT_RECEIVED -12

### GNUTLS_E_FILE_ERROR

    #define GNUTLS_E_FILE_ERROR -64

### GNUTLS_E_GOT_APPLICATION_DATA

    #define GNUTLS_E_GOT_APPLICATION_DATA -38

### GNUTLS_E_HANDSHAKE_TOO_LARGE

    #define GNUTLS_E_HANDSHAKE_TOO_LARGE -210

### GNUTLS_E_HASH_FAILED

    #define GNUTLS_E_HASH_FAILED -33

### GNUTLS_E_HEARTBEAT_PING_RECEIVED

    #define GNUTLS_E_HEARTBEAT_PING_RECEIVED -293

### GNUTLS_E_HEARTBEAT_PONG_RECEIVED

    #define GNUTLS_E_HEARTBEAT_PONG_RECEIVED -292

### GNUTLS_E_IA_VERIFY_FAILED

    #define GNUTLS_E_IA_VERIFY_FAILED -104

### GNUTLS_E_ILLEGAL_PARAMETER

    #define GNUTLS_E_ILLEGAL_PARAMETER -325

### GNUTLS_E_ILLEGAL_SRP_USERNAME

    #define GNUTLS_E_ILLEGAL_SRP_USERNAME -90

### GNUTLS_E_INCOMPATIBLE_CRYPTO_LIBRARY

    #define GNUTLS_E_INCOMPATIBLE_CRYPTO_LIBRARY -202

### GNUTLS_E_INCOMPATIBLE_GCRYPT_LIBRARY

    #define GNUTLS_E_INCOMPATIBLE_GCRYPT_LIBRARY -202 /* obsolete */

### GNUTLS_E_INCOMPATIBLE_LIBTASN1_LIBRARY

    #define GNUTLS_E_INCOMPATIBLE_LIBTASN1_LIBRARY -203

### GNUTLS_E_INCOMPAT_DSA_KEY_WITH_TLS_PROTOCOL

    #define GNUTLS_E_INCOMPAT_DSA_KEY_WITH_TLS_PROTOCOL -216

### GNUTLS_E_INSUFFICIENT_CRED

    #define GNUTLS_E_INSUFFICIENT_CRED GNUTLS_E_INSUFFICIENT_CREDENTIALS

### GNUTLS_E_INSUFFICIENT_CREDENTIALS

    #define GNUTLS_E_INSUFFICIENT_CREDENTIALS -32

### GNUTLS_E_INSUFICIENT_CRED

    #define GNUTLS_E_INSUFICIENT_CRED GNUTLS_E_INSUFFICIENT_CREDENTIALS /* for backwards compatibility only */

### GNUTLS_E_INSUFICIENT_CREDENTIALS

    #define GNUTLS_E_INSUFICIENT_CREDENTIALS GNUTLS_E_INSUFFICIENT_CREDENTIALS /* for backwards compatibility only */

### GNUTLS_E_INTERNAL_ERROR

    #define GNUTLS_E_INTERNAL_ERROR -59

### GNUTLS_E_INTERRUPTED

    #define GNUTLS_E_INTERRUPTED -52

### GNUTLS_E_INVALID_PASSWORD

    #define GNUTLS_E_INVALID_PASSWORD -99

### GNUTLS_E_INVALID_REQUEST

    #define GNUTLS_E_INVALID_REQUEST -50

### GNUTLS_E_INVALID_SESSION

    #define GNUTLS_E_INVALID_SESSION -10

### GNUTLS_E_KEY_USAGE_VIOLATION

    #define GNUTLS_E_KEY_USAGE_VIOLATION -48

### GNUTLS_E_LARGE_PACKET

    #define GNUTLS_E_LARGE_PACKET -7

### GNUTLS_E_LOCKING_ERROR

    #define GNUTLS_E_LOCKING_ERROR -306

### GNUTLS_E_MAC_VERIFY_FAILED

    #define GNUTLS_E_MAC_VERIFY_FAILED -100 /* for PKCS #12 MAC */

### GNUTLS_E_MEMORY_ERROR

    #define GNUTLS_E_MEMORY_ERROR -25

### GNUTLS_E_MPI_PRINT_FAILED

    #define GNUTLS_E_MPI_PRINT_FAILED -35

### GNUTLS_E_MPI_SCAN_FAILED

    #define GNUTLS_E_MPI_SCAN_FAILED -23

### GNUTLS_E_NO_CERTIFICATE_FOUND

    #define GNUTLS_E_NO_CERTIFICATE_FOUND -49 /* GNUTLS_A_BAD_CERTIFICATE */

### GNUTLS_E_NO_CERTIFICATE_STATUS

    #define GNUTLS_E_NO_CERTIFICATE_STATUS -340

### GNUTLS_E_NO_CIPHER_SUITES

    #define GNUTLS_E_NO_CIPHER_SUITES -87

### GNUTLS_E_NO_COMPRESSION_ALGORITHMS

    #define GNUTLS_E_NO_COMPRESSION_ALGORITHMS -86

### GNUTLS_E_NO_PRIORITIES_WERE_SET

    #define GNUTLS_E_NO_PRIORITIES_WERE_SET -326

### GNUTLS_E_NO_TEMPORARY_DH_PARAMS

    #define GNUTLS_E_NO_TEMPORARY_DH_PARAMS -93

### GNUTLS_E_NO_TEMPORARY_RSA_PARAMS

    #define GNUTLS_E_NO_TEMPORARY_RSA_PARAMS -84

### GNUTLS_E_OCSP_RESPONSE_ERROR

    #define GNUTLS_E_OCSP_RESPONSE_ERROR -341

### GNUTLS_E_OPENPGP_FINGERPRINT_UNSUPPORTED

    #define GNUTLS_E_OPENPGP_FINGERPRINT_UNSUPPORTED -94

### GNUTLS_E_OPENPGP_GETKEY_FAILED

    #define GNUTLS_E_OPENPGP_GETKEY_FAILED -88

### GNUTLS_E_OPENPGP_KEYRING_ERROR

    #define GNUTLS_E_OPENPGP_KEYRING_ERROR -204

### GNUTLS_E_OPENPGP_PREFERRED_KEY_ERROR

    #define GNUTLS_E_OPENPGP_PREFERRED_KEY_ERROR -215

### GNUTLS_E_OPENPGP_SUBKEY_ERROR

    #define GNUTLS_E_OPENPGP_SUBKEY_ERROR -208

### GNUTLS_E_OPENPGP_UID_REVOKED

    #define GNUTLS_E_OPENPGP_UID_REVOKED -79

### GNUTLS_E_PARSING_ERROR

    #define GNUTLS_E_PARSING_ERROR -302

### GNUTLS_E_PKCS11_ATTRIBUTE_ERROR

    #define GNUTLS_E_PKCS11_ATTRIBUTE_ERROR -307

### GNUTLS_E_PKCS11_DATA_ERROR

    #define GNUTLS_E_PKCS11_DATA_ERROR -309

### GNUTLS_E_PKCS11_DEVICE_ERROR

    #define GNUTLS_E_PKCS11_DEVICE_ERROR -308

### GNUTLS_E_PKCS11_ERROR

    #define GNUTLS_E_PKCS11_ERROR -300

### GNUTLS_E_PKCS11_KEY_ERROR

    #define GNUTLS_E_PKCS11_KEY_ERROR -311

### GNUTLS_E_PKCS11_LOAD_ERROR

    #define GNUTLS_E_PKCS11_LOAD_ERROR -301

### GNUTLS_E_PKCS11_PIN_ERROR

    #define GNUTLS_E_PKCS11_PIN_ERROR -303

### GNUTLS_E_PKCS11_PIN_EXPIRED

    #define GNUTLS_E_PKCS11_PIN_EXPIRED -312

### GNUTLS_E_PKCS11_PIN_LOCKED

    #define GNUTLS_E_PKCS11_PIN_LOCKED -313

### GNUTLS_E_PKCS11_REQUESTED_OBJECT_NOT_AVAILBLE

    #define GNUTLS_E_PKCS11_REQUESTED_OBJECT_NOT_AVAILBLE -323

### GNUTLS_E_PKCS11_SESSION_ERROR

    #define GNUTLS_E_PKCS11_SESSION_ERROR -314

### GNUTLS_E_PKCS11_SIGNATURE_ERROR

    #define GNUTLS_E_PKCS11_SIGNATURE_ERROR -315

### GNUTLS_E_PKCS11_SLOT_ERROR

    #define GNUTLS_E_PKCS11_SLOT_ERROR -305

### GNUTLS_E_PKCS11_TOKEN_ERROR

    #define GNUTLS_E_PKCS11_TOKEN_ERROR -316

### GNUTLS_E_PKCS11_UNSUPPORTED_FEATURE_ERROR

    #define GNUTLS_E_PKCS11_UNSUPPORTED_FEATURE_ERROR -310

### GNUTLS_E_PKCS11_USER_ERROR

    #define GNUTLS_E_PKCS11_USER_ERROR -317

### GNUTLS_E_PKCS1_WRONG_PAD

    #define GNUTLS_E_PKCS1_WRONG_PAD -57

### GNUTLS_E_PK_DECRYPTION_FAILED

    #define GNUTLS_E_PK_DECRYPTION_FAILED -45

### GNUTLS_E_PK_ENCRYPTION_FAILED

    #define GNUTLS_E_PK_ENCRYPTION_FAILED -44

### GNUTLS_E_PK_SIGN_FAILED

    #define GNUTLS_E_PK_SIGN_FAILED -46

### GNUTLS_E_PK_SIG_VERIFY_FAILED

    #define GNUTLS_E_PK_SIG_VERIFY_FAILED -89

### GNUTLS_E_PREMATURE_TERMINATION

    #define GNUTLS_E_PREMATURE_TERMINATION -110

### GNUTLS_E_PULL_ERROR

    #define GNUTLS_E_PULL_ERROR -54

### GNUTLS_E_PUSH_ERROR

    #define GNUTLS_E_PUSH_ERROR -53

### GNUTLS_E_RANDOM_FAILED

    #define GNUTLS_E_RANDOM_FAILED -206

### GNUTLS_E_RECEIVED_ILLEGAL_EXTENSION

    #define GNUTLS_E_RECEIVED_ILLEGAL_EXTENSION -58

### GNUTLS_E_RECEIVED_ILLEGAL_PARAMETER

    #define GNUTLS_E_RECEIVED_ILLEGAL_PARAMETER -55 /* GNUTLS_A_ILLEGAL_PARAMETER */

### GNUTLS_E_RECORD_LIMIT_REACHED

    #define GNUTLS_E_RECORD_LIMIT_REACHED -39

### GNUTLS_E_REHANDSHAKE

    #define GNUTLS_E_REHANDSHAKE -37 /* GNUTLS_A_NO_RENEGOTIATION */

### GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE

    #define GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE -56

### GNUTLS_E_SAFE_RENEGOTIATION_FAILED

    #define GNUTLS_E_SAFE_RENEGOTIATION_FAILED -107

### GNUTLS_E_SESSION_EOF

    #define GNUTLS_E_SESSION_EOF -328

### GNUTLS_E_SHORT_MEMORY_BUFFER

    #define GNUTLS_E_SHORT_MEMORY_BUFFER -51

### GNUTLS_E_SRP_PWD_ERROR

    #define GNUTLS_E_SRP_PWD_ERROR -31

### GNUTLS_E_SRP_PWD_PARSING_ERROR

    #define GNUTLS_E_SRP_PWD_PARSING_ERROR -91

### GNUTLS_E_SUCCESS

    #define GNUTLS_E_SUCCESS 0

### GNUTLS_E_TIMEDOUT

    #define GNUTLS_E_TIMEDOUT -319

### GNUTLS_E_TOO_MANY_EMPTY_PACKETS

    #define GNUTLS_E_TOO_MANY_EMPTY_PACKETS -78

### GNUTLS_E_TOO_MANY_HANDSHAKE_PACKETS

    #define GNUTLS_E_TOO_MANY_HANDSHAKE_PACKETS -81

### GNUTLS_E_TPM_ERROR

    #define GNUTLS_E_TPM_ERROR -329

### GNUTLS_E_TPM_KEY_NOT_FOUND

    #define GNUTLS_E_TPM_KEY_NOT_FOUND -333

### GNUTLS_E_TPM_KEY_PASSWORD_ERROR

    #define GNUTLS_E_TPM_KEY_PASSWORD_ERROR -330

### GNUTLS_E_TPM_SESSION_ERROR

    #define GNUTLS_E_TPM_SESSION_ERROR -332

### GNUTLS_E_TPM_SRK_PASSWORD_ERROR

    #define GNUTLS_E_TPM_SRK_PASSWORD_ERROR -331

### GNUTLS_E_TPM_UNINITIALIZED

    #define GNUTLS_E_TPM_UNINITIALIZED -334

### GNUTLS_E_UNEXPECTED_HANDSHAKE_PACKET

    #define GNUTLS_E_UNEXPECTED_HANDSHAKE_PACKET -19

### GNUTLS_E_UNEXPECTED_PACKET

    #define GNUTLS_E_UNEXPECTED_PACKET -15 /* GNUTLS_A_UNEXPECTED_MESSAGE */

### GNUTLS_E_UNEXPECTED_PACKET_LENGTH

    #define GNUTLS_E_UNEXPECTED_PACKET_LENGTH -9 /* GNUTLS_A_RECORD_OVERFLOW */

### GNUTLS_E_UNIMPLEMENTED_FEATURE

    #define GNUTLS_E_UNIMPLEMENTED_FEATURE -1250

### GNUTLS_E_UNKNOWN_ALGORITHM

    #define GNUTLS_E_UNKNOWN_ALGORITHM -105

### GNUTLS_E_UNKNOWN_CIPHER_SUITE

    #define GNUTLS_E_UNKNOWN_CIPHER_SUITE -21 /* GNUTLS_A_HANDSHAKE_FAILURE */

### GNUTLS_E_UNKNOWN_CIPHER_TYPE

    #define GNUTLS_E_UNKNOWN_CIPHER_TYPE -6

### GNUTLS_E_UNKNOWN_COMPRESSION_ALGORITHM

    #define GNUTLS_E_UNKNOWN_COMPRESSION_ALGORITHM -3

### GNUTLS_E_UNKNOWN_HASH_ALGORITHM

    #define GNUTLS_E_UNKNOWN_HASH_ALGORITHM -96

### GNUTLS_E_UNKNOWN_PKCS_BAG_TYPE

    #define GNUTLS_E_UNKNOWN_PKCS_BAG_TYPE -98

### GNUTLS_E_UNKNOWN_PKCS_CONTENT_TYPE

    #define GNUTLS_E_UNKNOWN_PKCS_CONTENT_TYPE -97

### GNUTLS_E_UNKNOWN_PK_ALGORITHM

    #define GNUTLS_E_UNKNOWN_PK_ALGORITHM -80

### GNUTLS_E_UNKNOWN_SRP_USERNAME

    #define GNUTLS_E_UNKNOWN_SRP_USERNAME -109

### GNUTLS_E_UNSAFE_RENEGOTIATION_DENIED

    #define GNUTLS_E_UNSAFE_RENEGOTIATION_DENIED -108

### GNUTLS_E_UNSUPPORTED_CERTIFICATE_TYPE

    #define GNUTLS_E_UNSUPPORTED_CERTIFICATE_TYPE -61 /* GNUTLS_A_UNSUPPORTED_CERTIFICATE */

### GNUTLS_E_UNSUPPORTED_SIGNATURE_ALGORITHM

    #define GNUTLS_E_UNSUPPORTED_SIGNATURE_ALGORITHM -106

### GNUTLS_E_UNSUPPORTED_VERSION_PACKET

    #define GNUTLS_E_UNSUPPORTED_VERSION_PACKET -8 /* GNUTLS_A_PROTOCOL_VERSION */

### GNUTLS_E_UNWANTED_ALGORITHM

    #define GNUTLS_E_UNWANTED_ALGORITHM -22

### GNUTLS_E_USER_ERROR

    #define GNUTLS_E_USER_ERROR -320

### GNUTLS_E_WARNING_ALERT_RECEIVED

    #define GNUTLS_E_WARNING_ALERT_RECEIVED -16

### GNUTLS_E_WARNING_IA_FPHF_RECEIVED

    #define GNUTLS_E_WARNING_IA_FPHF_RECEIVED -103

### GNUTLS_E_WARNING_IA_IPHF_RECEIVED

    #define GNUTLS_E_WARNING_IA_IPHF_RECEIVED -102

### GNUTLS_E_X509_CERTIFICATE_ERROR

    #define GNUTLS_E_X509_CERTIFICATE_ERROR GNUTLS_E_CERTIFICATE_ERROR

### GNUTLS_E_X509_UNKNOWN_SAN

    #define GNUTLS_E_X509_UNKNOWN_SAN -62

### GNUTLS_E_X509_UNSUPPORTED_ATTRIBUTE

    #define GNUTLS_E_X509_UNSUPPORTED_ATTRIBUTE -95

### GNUTLS_E_X509_UNSUPPORTED_CRITICAL_EXTENSION

    #define GNUTLS_E_X509_UNSUPPORTED_CRITICAL_EXTENSION -47

### GNUTLS_E_X509_UNSUPPORTED_EXTENSION

    #define GNUTLS_E_X509_UNSUPPORTED_EXTENSION -327

### GNUTLS_E_X509_UNSUPPORTED_OID

    #define GNUTLS_E_X509_UNSUPPORTED_OID -205

### GNUTLS_HEARTBEAT_WAIT

    #define GNUTLS_HEARTBEAT_WAIT 1

### GNUTLS_KEY_CRL_SIGN

    #define GNUTLS_KEY_CRL_SIGN		2

### GNUTLS_KEY_DATA_ENCIPHERMENT

    #define GNUTLS_KEY_DATA_ENCIPHERMENT 16

### GNUTLS_KEY_DECIPHER_ONLY

    #define GNUTLS_KEY_DECIPHER_ONLY 32768

### GNUTLS_KEY_DIGITAL_SIGNATURE

    #define GNUTLS_KEY_DIGITAL_SIGNATURE 128

### GNUTLS_KEY_ENCIPHER_ONLY

    #define GNUTLS_KEY_ENCIPHER_ONLY 1

### GNUTLS_KEY_KEY_AGREEMENT

    #define GNUTLS_KEY_KEY_AGREEMENT 8

### GNUTLS_KEY_KEY_CERT_SIGN

    #define GNUTLS_KEY_KEY_CERT_SIGN 4

### GNUTLS_KEY_KEY_ENCIPHERMENT

    #define GNUTLS_KEY_KEY_ENCIPHERMENT 32

### GNUTLS_KEY_NON_REPUDIATION

    #define GNUTLS_KEY_NON_REPUDIATION 64

### GNUTLS_MAC_SHA

    #define GNUTLS_MAC_SHA GNUTLS_MAC_SHA1

### GNUTLS_MAX_ALGORITHM_NUM

    #define GNUTLS_MAX_ALGORITHM_NUM 32

### GNUTLS_MAX_SESSION_ID

    #define GNUTLS_MAX_SESSION_ID 32

### GNUTLS_PKCS11_PIN_CONTEXT_SPECIFIC

    #define GNUTLS_PKCS11_PIN_CONTEXT_SPECIFIC GNUTLS_PIN_CONTEXT_SPECIFIC

### GNUTLS_PKCS11_PIN_COUNT_LOW

    #define GNUTLS_PKCS11_PIN_COUNT_LOW  GNUTLS_PIN_COUNT_LOW

### GNUTLS_PKCS11_PIN_FINAL_TRY

    #define GNUTLS_PKCS11_PIN_FINAL_TRY GNUTLS_PIN_FINAL_TRY

### GNUTLS_PKCS11_PIN_SO

    #define GNUTLS_PKCS11_PIN_SO GNUTLS_PIN_SO

### GNUTLS_PKCS11_PIN_USER

    #define GNUTLS_PKCS11_PIN_USER GNUTLS_PIN_USER

### GNUTLS_PKCS11_PIN_WRONG

    #define GNUTLS_PKCS11_PIN_WRONG GNUTLS_PIN_WRONG

### GNUTLS_PK_ECC

    #define GNUTLS_PK_ECC GNUTLS_PK_EC

### GNUTLS_SERVER

    #define GNUTLS_SERVER 1

### GNUTLS_VERSION

    #define GNUTLS_VERSION "3.4.4"

### GNUTLS_VERSION_MAJOR

    #define GNUTLS_VERSION_MAJOR 3

### GNUTLS_VERSION_MINOR

    #define GNUTLS_VERSION_MINOR 4

### GNUTLS_VERSION_NUMBER

    #define GNUTLS_VERSION_NUMBER 0x030404

### GNUTLS_VERSION_PATCH

    #define GNUTLS_VERSION_PATCH 4

### HAVE_SSIZE_T

    #define             HAVE_SSIZE_T

### enum gnutls_alert_description_t

Enumeration of different TLS alerts.

#### Members

GNUTLS_A_CLOSE_NOTIFY | Close notify. |
GNUTLS_A_UNEXPECTED_MESSAGE | Unexpected message. |
GNUTLS_A_BAD_RECORD_MAC | Bad record MAC. |
GNUTLS_A_DECRYPTION_FAILED | Decryption failed. |
GNUTLS_A_RECORD_OVERFLOW | Record overflow. |
GNUTLS_A_DECOMPRESSION_FAILURE | Decompression failed. |
GNUTLS_A_HANDSHAKE_FAILURE | Handshake failed. |
GNUTLS_A_SSL3_NO_CERTIFICATE | No certificate. |
GNUTLS_A_BAD_CERTIFICATE | Certificate is bad. |
GNUTLS_A_UNSUPPORTED_CERTIFICATE | Certificate is not supported. |
GNUTLS_A_CERTIFICATE_REVOKED | Certificate was revoked. |
GNUTLS_A_CERTIFICATE_EXPIRED | Certificate is expired. |
GNUTLS_A_CERTIFICATE_UNKNOWN | Unknown certificate. |
GNUTLS_A_ILLEGAL_PARAMETER | Illegal parameter. |
GNUTLS_A_UNKNOWN_CA | CA is unknown. |
GNUTLS_A_ACCESS_DENIED | Access was denied. |
GNUTLS_A_DECODE_ERROR | Decode error. |
GNUTLS_A_DECRYPT_ERROR | Decrypt error. |
GNUTLS_A_EXPORT_RESTRICTION | Export restriction. |
GNUTLS_A_PROTOCOL_VERSION | Error in protocol version. |
GNUTLS_A_INSUFFICIENT_SECURITY | Insufficient security. |
GNUTLS_A_INTERNAL_ERROR | Internal error. |
GNUTLS_A_INAPPROPRIATE_FALLBACK | Inappropriate fallback, |
GNUTLS_A_USER_CANCELED | User canceled. |
GNUTLS_A_NO_RENEGOTIATION | No renegotiation is allowed. |
GNUTLS_A_UNSUPPORTED_EXTENSION | An unsupported extension was sent. |
GNUTLS_A_CERTIFICATE_UNOBTAINABLE | Could not retrieve the specified certificate. |
GNUTLS_A_UNRECOGNIZED_NAME | The server name sent was not recognized. |
GNUTLS_A_UNKNOWN_PSK_IDENTITY | The SRP/PSK username is missing or not known. |
GNUTLS_A_NO_APPLICATION_PROTOCOL | The ALPN protocol requested is not supported by the peer. |

### enum gnutls_alert_level_t

Enumeration of different TLS alert severities.

#### Members

GNUTLS_AL_WARNING | Alert of warning severity. |
GNUTLS_AL_FATAL | Alert of fatal severity. |

### struct gnutls_certificate_credentials_st

    struct gnutls_certificate_credentials_st;

### enum gnutls_certificate_print_formats_t

Enumeration of different certificate printing variants.

#### Members

GNUTLS_CRT_PRINT_FULL | Full information about certificate. |
GNUTLS_CRT_PRINT_ONELINE | Information about certificate in one line. |
GNUTLS_CRT_PRINT_UNSIGNED_FULL | All info for an unsigned certificate. |
GNUTLS_CRT_PRINT_COMPACT | Information about certificate name in one line, plus identification of the public key. |
GNUTLS_CRT_PRINT_FULL_NUMBERS | Full information about certificate and include easy to parse public key parameters. |

### enum gnutls_certificate_request_t

Enumeration of certificate request types.

#### Members

GNUTLS_CERT_IGNORE | Ignore certificate. |
GNUTLS_CERT_REQUEST | Request certificate. |
GNUTLS_CERT_REQUIRE | Require certificate. |

### enum gnutls_certificate_status_t

Enumeration of certificate status codes. Note that the status bits may have different meanings in OpenPGP keys and X.509 certificate verification.

#### Members

GNUTLS_CERT_INVALID | The certificate is not signed by one of the known authorities or the signature is invalid (deprecated by the flags `GNUTLS_CERT_SIGNATURE_FAILURE` and `GNUTLS_CERT_SIGNER_NOT_FOUND`). |
GNUTLS_CERT_REVOKED | Certificate is revoked by its authority. In X.509 this will be set only if CRLs are checked. |
GNUTLS_CERT_SIGNER_NOT_FOUND | The certificate's issuer is not known. This is the case if the issuer is not included in the trusted certificate list. |
GNUTLS_CERT_SIGNER_NOT_CA | The certificate's signer was not a CA. This may happen if this was a version 1 certificate, which is common with some CAs, or a version 3 certificate without the basic constrains extension. |
GNUTLS_CERT_INSECURE_ALGORITHM | The certificate was signed using an insecure algorithm such as MD2 or MD5. These algorithms have been broken and should not be trusted. |
GNUTLS_CERT_NOT_ACTIVATED | The certificate is not yet activated. |
GNUTLS_CERT_EXPIRED | The certificate has expired. |
GNUTLS_CERT_SIGNATURE_FAILURE | The signature verification failed. |
GNUTLS_CERT_REVOCATION_DATA_SUPERSEDED | The revocation data are old and have been superseded. |
GNUTLS_CERT_UNEXPECTED_OWNER | The owner is not the expected one. |
GNUTLS_CERT_REVOCATION_DATA_ISSUED_IN_FUTURE | The revocation data have a future issue date. |
GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE | The certificate's signer constraints were violated. |
GNUTLS_CERT_MISMATCH | The certificate presented isn't the expected one (TOFU) |
GNUTLS_CERT_PURPOSE_MISMATCH | The certificate or an intermediate does not match the intended purpose (extended key usage). |

### enum gnutls_certificate_type_t

Enumeration of different certificate types.

#### Members

GNUTLS_CRT_UNKNOWN | Unknown certificate type. |
GNUTLS_CRT_X509 | X.509 Certificate. |
GNUTLS_CRT_OPENPGP | OpenPGP certificate. |
GNUTLS_CRT_RAW | Raw public key (SubjectPublicKey) |

### enum gnutls_channel_binding_t

Enumeration of support channel binding types.

#### Members

GNUTLS_CB_TLS_UNIQUE | "tls-unique" (RFC 5929) channel binding |

### enum gnutls_cipher_algorithm_t

Enumeration of different symmetric encryption algorithms.

#### Members

GNUTLS_CIPHER_UNKNOWN | Unknown algorithm. |
GNUTLS_CIPHER_NULL | NULL algorithm. |
GNUTLS_CIPHER_ARCFOUR_128 | ARCFOUR stream cipher with 128-bit keys. |
GNUTLS_CIPHER_3DES_CBC | 3DES in CBC mode. |
GNUTLS_CIPHER_AES_128_CBC | AES in CBC mode with 128-bit keys. |
GNUTLS_CIPHER_AES_256_CBC | AES in CBC mode with 256-bit keys. |
GNUTLS_CIPHER_ARCFOUR_40 | ARCFOUR stream cipher with 40-bit keys. |
GNUTLS_CIPHER_CAMELLIA_128_CBC | Camellia in CBC mode with 128-bit keys. |
GNUTLS_CIPHER_CAMELLIA_256_CBC | Camellia in CBC mode with 256-bit keys. |
GNUTLS_CIPHER_AES_192_CBC | AES in CBC mode with 192-bit keys. |
GNUTLS_CIPHER_AES_128_GCM | AES in GCM mode with 128-bit keys. |
GNUTLS_CIPHER_AES_256_GCM | AES in GCM mode with 256-bit keys. |
GNUTLS_CIPHER_CAMELLIA_192_CBC | Camellia in CBC mode with 192-bit keys. |
GNUTLS_CIPHER_SALSA20_256 | Salsa20 with 256-bit keys. |
GNUTLS_CIPHER_ESTREAM_SALSA20_256 | Estream's Salsa20 variant with 256-bit keys. |
GNUTLS_CIPHER_CAMELLIA_128_GCM | CAMELLIA in GCM mode with 128-bit keys. |
GNUTLS_CIPHER_CAMELLIA_256_GCM | CAMELLIA in GCM mode with 256-bit keys. |
GNUTLS_CIPHER_RC2_40_CBC | RC2 in CBC mode with 40-bit keys. |
GNUTLS_CIPHER_DES_CBC | DES in CBC mode (56-bit keys). |
GNUTLS_CIPHER_AES_128_CCM | AES in CCM mode with 128-bit keys. |
GNUTLS_CIPHER_AES_256_CCM | AES in CCM mode with 256-bit keys. |
GNUTLS_CIPHER_AES_128_CCM_8 | AES in CCM mode with 64-bit tag and 128-bit keys. |
GNUTLS_CIPHER_AES_256_CCM_8 | AES in CCM mode with 64-bit tag and 256-bit keys. |
GNUTLS_CIPHER_CHACHA20_POLY1305 | The Chacha20 cipher with the Poly1305 authenticator (AEAD). |
GNUTLS_CIPHER_IDEA_PGP_CFB | IDEA in CFB mode. |
GNUTLS_CIPHER_3DES_PGP_CFB | 3DES in CFB mode. |
GNUTLS_CIPHER_CAST5_PGP_CFB | CAST5 in CFB mode. |
GNUTLS_CIPHER_BLOWFISH_PGP_CFB | Blowfish in CFB mode. |
GNUTLS_CIPHER_SAFER_SK128_PGP_CFB | Safer-SK in CFB mode with 128-bit keys. |
GNUTLS_CIPHER_AES128_PGP_CFB | AES in CFB mode with 128-bit keys. |
GNUTLS_CIPHER_AES192_PGP_CFB | AES in CFB mode with 192-bit keys. |
GNUTLS_CIPHER_AES256_PGP_CFB | AES in CFB mode with 256-bit keys. |
GNUTLS_CIPHER_TWOFISH_PGP_CFB | Twofish in CFB mode. |

### enum gnutls_close_request_t

Enumeration of how TLS session should be terminated. See `gnutls_bye()`.

#### Members

GNUTLS_SHUT_RDWR | Disallow further receives/sends. |
GNUTLS_SHUT_WR | Disallow further sends. |

### enum gnutls_compression_method_t

Enumeration of different TLS compression methods.

#### Members

GNUTLS_COMP_UNKNOWN | Unknown compression method. |
GNUTLS_COMP_NULL | The NULL compression method (no compression). |
GNUTLS_COMP_DEFLATE | The DEFLATE compression method from zlib. |
GNUTLS_COMP_ZLIB | Same as `GNUTLS_COMP_DEFLATE`. |

### gnutls_cred_set

    #define gnutls_cred_set gnutls_credentials_set

### enum gnutls_credentials_type_t

Enumeration of different credential types.

#### Members

GNUTLS_CRD_CERTIFICATE | Certificate credential. |
GNUTLS_CRD_ANON | Anonymous credential. |
GNUTLS_CRD_SRP | SRP credential. |
GNUTLS_CRD_PSK | PSK credential. |
GNUTLS_CRD_IA | IA credential. |

### struct gnutls_dh_params_int

    struct gnutls_dh_params_int;

### gnutls_dh_params_t

    typedef struct gnutls_dh_params_int *gnutls_dh_params_t;

### enum gnutls_digest_algorithm_t

Enumeration of different digest (hash) algorithms.

#### Members

GNUTLS_DIG_UNKNOWN | Unknown hash algorithm. |
GNUTLS_DIG_NULL | NULL hash algorithm (empty output). |
GNUTLS_DIG_MD5 | MD5 algorithm. |
GNUTLS_DIG_SHA1 | SHA-1 algorithm. |
GNUTLS_DIG_RMD160 | RMD160 algorithm. |
GNUTLS_DIG_MD2 | MD2 algorithm. |
GNUTLS_DIG_SHA256 | SHA-256 algorithm. |
GNUTLS_DIG_SHA384 | SHA-384 algorithm. |
GNUTLS_DIG_SHA512 | SHA-512 algorithm. |
GNUTLS_DIG_SHA224 | SHA-224 algorithm. |

### enum gnutls_ecc_curve_t

Enumeration of ECC curves.

#### Members

GNUTLS_ECC_CURVE_INVALID | Cannot be known |
GNUTLS_ECC_CURVE_SECP224R1 | the SECP224R1 curve |
GNUTLS_ECC_CURVE_SECP256R1 | the SECP256R1 curve |
GNUTLS_ECC_CURVE_SECP384R1 | the SECP384R1 curve |
GNUTLS_ECC_CURVE_SECP521R1 | the SECP521R1 curve |
GNUTLS_ECC_CURVE_SECP192R1 | the SECP192R1 curve |

### enum gnutls_handshake_description_t

Enumeration of different TLS handshake packets.

#### Members

GNUTLS_HANDSHAKE_HELLO_REQUEST | Hello request. |
GNUTLS_HANDSHAKE_CLIENT_HELLO | Client hello. |
GNUTLS_HANDSHAKE_SERVER_HELLO | Server hello. |
GNUTLS_HANDSHAKE_HELLO_VERIFY_REQUEST | DTLS Hello verify request. |
GNUTLS_HANDSHAKE_NEW_SESSION_TICKET | New session ticket. |
GNUTLS_HANDSHAKE_CERTIFICATE_PKT | Certificate packet. |
GNUTLS_HANDSHAKE_SERVER_KEY_EXCHANGE | Server key exchange. |
GNUTLS_HANDSHAKE_CERTIFICATE_REQUEST | Certificate request. |
GNUTLS_HANDSHAKE_SERVER_HELLO_DONE | Server hello done. |
GNUTLS_HANDSHAKE_CERTIFICATE_VERIFY | Certificate verify. |
GNUTLS_HANDSHAKE_CLIENT_KEY_EXCHANGE | Client key exchange. |
GNUTLS_HANDSHAKE_FINISHED | Finished. |
GNUTLS_HANDSHAKE_CERTIFICATE_STATUS | Certificate status (OCSP). |
GNUTLS_HANDSHAKE_SUPPLEMENTAL | Supplemental. |
GNUTLS_HANDSHAKE_CHANGE_CIPHER_SPEC | Change Cipher Spec. |
GNUTLS_HANDSHAKE_CLIENT_HELLO_V2 | SSLv2 Client Hello. |

### enum gnutls_kx_algorithm_t

Enumeration of different key exchange algorithms.

#### Members

GNUTLS_KX_UNKNOWN | Unknown key-exchange algorithm. |
GNUTLS_KX_RSA | RSA key-exchange algorithm. |
GNUTLS_KX_DHE_DSS | DHE-DSS key-exchange algorithm. |
GNUTLS_KX_DHE_RSA | DHE-RSA key-exchange algorithm. |
GNUTLS_KX_ANON_DH | Anon-DH key-exchange algorithm. |
GNUTLS_KX_SRP | SRP key-exchange algorithm. |
GNUTLS_KX_RSA_EXPORT | RSA-EXPORT key-exchange algorithm (defunc). |
GNUTLS_KX_SRP_RSA | SRP-RSA key-exchange algorithm. |
GNUTLS_KX_SRP_DSS | SRP-DSS key-exchange algorithm. |
GNUTLS_KX_PSK | PSK key-exchange algorithm. |
GNUTLS_KX_DHE_PSK | DHE-PSK key-exchange algorithm. |
GNUTLS_KX_ANON_ECDH | Anon-ECDH key-exchange algorithm. |
GNUTLS_KX_ECDHE_RSA | ECDHE-RSA key-exchange algorithm. |
GNUTLS_KX_ECDHE_ECDSA | ECDHE-ECDSA key-exchange algorithm. |
GNUTLS_KX_ECDHE_PSK | ECDHE-PSK key-exchange algorithm. |
GNUTLS_KX_RSA_PSK | RSA-PSK key-exchange algorithm. |

### enum gnutls_mac_algorithm_t

Enumeration of different Message Authentication Code (MAC) algorithms.

#### Members

GNUTLS_MAC_UNKNOWN | Unknown MAC algorithm. |
GNUTLS_MAC_NULL | NULL MAC algorithm (empty output). |
GNUTLS_MAC_MD5 | HMAC-MD5 algorithm. |
GNUTLS_MAC_SHA1 | HMAC-SHA-1 algorithm. |
GNUTLS_MAC_RMD160 | HMAC-RMD160 algorithm. |
GNUTLS_MAC_MD2 | HMAC-MD2 algorithm. |
GNUTLS_MAC_SHA256 | HMAC-SHA-256 algorithm. |
GNUTLS_MAC_SHA384 | HMAC-SHA-384 algorithm. |
GNUTLS_MAC_SHA512 | HMAC-SHA-512 algorithm. |
GNUTLS_MAC_SHA224 | HMAC-SHA-224 algorithm. |
GNUTLS_MAC_AEAD | MAC implicit through AEAD cipher. |
GNUTLS_MAC_UMAC_96 | The UMAC-96 MAC algorithm. |
GNUTLS_MAC_UMAC_128 | The UMAC-128 MAC algorithm. |

### gnutls_openpgp_crt_int

    typedef struct {
    	cdk_kbnode_t knode;
    	uint8_t preferred_keyid[GNUTLS_OPENPGP_KEYID_SIZE];
    	int preferred_set;
    } gnutls_openpgp_crt_int;

### enum gnutls_openpgp_crt_status_t

Enumeration of ways to send OpenPGP certificate.

#### Members

GNUTLS_OPENPGP_CERT | Send entire certificate. |
GNUTLS_OPENPGP_CERT_FINGERPRINT | Send only certificate fingerprint. |

### gnutls_openpgp_crt_t

    typedef struct gnutls_openpgp_crt_int *gnutls_openpgp_crt_t;

### gnutls_openpgp_keyring_int

    typedef struct {
    	cdk_keydb_hd_t db;
    } gnutls_openpgp_keyring_int;

### gnutls_openpgp_keyring_t

    typedef struct gnutls_openpgp_keyring_int *gnutls_openpgp_keyring_t;

### gnutls_openpgp_privkey_int

    typedef struct {
    	cdk_kbnode_t knode;
    	uint8_t preferred_keyid[GNUTLS_OPENPGP_KEYID_SIZE];
    	int preferred_set;
    } gnutls_openpgp_privkey_int;

### gnutls_openpgp_privkey_t

    typedef struct gnutls_openpgp_privkey_int *gnutls_openpgp_privkey_t;

### enum gnutls_params_type_t

Enumeration of different TLS session parameter types.

#### Members

GNUTLS_PARAMS_RSA_EXPORT | Session RSA-EXPORT parameters (defunc). |
GNUTLS_PARAMS_DH | Session Diffie-Hellman parameters. |
GNUTLS_PARAMS_ECDH | Session Elliptic-Curve Diffie-Hellman parameters. |

### gnutls_pem_base64_decode_alloc

    #define gnutls_pem_base64_decode_alloc gnutls_pem_base64_decode2

### gnutls_pem_base64_encode_alloc

    #define gnutls_pem_base64_encode_alloc gnutls_pem_base64_encode2

### enum gnutls_pin_flag_t

Enumeration of different flags that are input to the PIN function.

#### Members

GNUTLS_PIN_USER | The PIN for the user. |
GNUTLS_PIN_SO | The PIN for the security officer (admin). |
GNUTLS_PIN_FINAL_TRY | This is the final try before blocking. |
GNUTLS_PIN_COUNT_LOW | Few tries remain before token blocks. |
GNUTLS_PIN_CONTEXT_SPECIFIC | The PIN is for a specific action and key like signing. |
GNUTLS_PIN_WRONG | Last given PIN was not correct. |

### enum gnutls_pk_algorithm_t

Enumeration of different public-key algorithms.

#### Members

GNUTLS_PK_UNKNOWN | Unknown public-key algorithm. |
GNUTLS_PK_RSA | RSA public-key algorithm. |
GNUTLS_PK_DSA | DSA public-key algorithm. |
GNUTLS_PK_DH | Diffie-Hellman algorithm. Used to generate parameters. |
GNUTLS_PK_EC | Elliptic curve algorithm. Used to generate parameters. |

### struct gnutls_pkcs11_privkey_st

    struct gnutls_pkcs11_privkey_st;

### gnutls_pkcs11_privkey_t

    typedef struct gnutls_pkcs11_privkey_st *gnutls_pkcs11_privkey_t;

### struct gnutls_priority_st

    struct gnutls_priority_st {
    	priority_st cipher;
    	priority_st mac;
    	priority_st kx;
    	priority_st compression;
    	priority_st protocol;
    	priority_st cert_type;
    	priority_st sign_algo;
    	priority_st supported_ecc;

    	/* to disable record padding */
    	bool no_extensions;
    	bool no_ext_master_secret;
    	bool allow_large_records;
    	unsigned int dumbfw;
    	safe_renegotiation_t sr;
    	bool min_record_version;
    	bool server_precedence;
    	bool allow_wrong_pms;
    	bool no_tickets;
    	bool no_etm;
    	bool have_cbc;
    	/* Whether stateless compression will be used */
    	bool stateless_compression;
    	unsigned int additional_verify_flags;

    	/* The session's expected security level.
    	 * Will be used to determine the minimum DH bits,
    	 * (or the acceptable certificate security level).
    	 */
    	gnutls_sec_param_t level;
    	unsigned int dh_prime_bits; /* old (deprecated) variable */

    	/* TLS_FALLBACK_SCSV */
    	bool fallback;
    };

### gnutls_priority_t

    typedef struct gnutls_priority_st *gnutls_priority_t;

### enum gnutls_privkey_type_t

Enumeration of different private key types.

#### Members

GNUTLS_PRIVKEY_X509 | X.509 private key, gnutls_x509_privkey_t. |
GNUTLS_PRIVKEY_OPENPGP | OpenPGP private key, gnutls_openpgp_privkey_t. |
GNUTLS_PRIVKEY_PKCS11 | PKCS11 private key, gnutls_pkcs11_privkey_t. |
GNUTLS_PRIVKEY_EXT | External private key, operating using callbacks. |

### enum gnutls_protocol_t

Enumeration of different SSL/TLS protocol versions.

#### Members

GNUTLS_SSL3 | SSL version 3.0. |
GNUTLS_TLS1_0 | TLS version 1.0. |
GNUTLS_TLS1 | Same as `GNUTLS_TLS1_0`. |
GNUTLS_TLS1_1 | TLS version 1.1. |
GNUTLS_TLS1_2 | TLS version 1.2. |
GNUTLS_DTLS0_9 | DTLS version 0.9 (Cisco AnyConnect / OpenSSL 0.9.8e). |
GNUTLS_DTLS1_0 | DTLS version 1.0. |
GNUTLS_DTLS1_2 | DTLS version 1.2. |
GNUTLS_DTLS_VERSION_MIN |  |
GNUTLS_DTLS_VERSION_MAX |  |
GNUTLS_TLS_VERSION_MAX |  |
GNUTLS_VERSION_UNKNOWN | Unknown SSL/TLS version. |

### enum gnutls_psk_key_flags

Enumeration of different PSK key flags.

#### Members

GNUTLS_PSK_KEY_RAW | PSK-key in raw format. |
GNUTLS_PSK_KEY_HEX | PSK-key in hex format. |

### enum gnutls_random_art_t

Enumeration of different random art types.

#### Members

GNUTLS_RANDOM_ART_OPENSSH | OpenSSH-style random art. |

### gnutls_read

    #define gnutls_read gnutls_record_recv

### gnutls_rsa_params_t

    typedef struct gnutls_x509_privkey_int *gnutls_rsa_params_t;

### enum gnutls_sec_param_t

Enumeration of security parameters for passive attacks.

#### Members

GNUTLS_SEC_PARAM_UNKNOWN | Cannot be known |
GNUTLS_SEC_PARAM_INSECURE | Less than 42 bits of security |
GNUTLS_SEC_PARAM_EXPORT | 42 bits of security |
GNUTLS_SEC_PARAM_VERY_WEAK | 64 bits of security |
GNUTLS_SEC_PARAM_WEAK | 72 bits of security |
GNUTLS_SEC_PARAM_LOW | 80 bits of security |
GNUTLS_SEC_PARAM_LEGACY | 96 bits of security |
GNUTLS_SEC_PARAM_MEDIUM | 112 bits of security (used to be `GNUTLS_SEC_PARAM_NORMAL`) |
GNUTLS_SEC_PARAM_HIGH | 128 bits of security |
GNUTLS_SEC_PARAM_ULTRA | 192 bits of security |

### enum gnutls_server_name_type_t

Enumeration of different server name types.

#### Members

GNUTLS_NAME_DNS | Domain Name System name type. |

### struct gnutls_session_int

    struct gnutls_session_int {
    	security_parameters_st security_parameters;
    	record_parameters_st *record_parameters[MAX_EPOCH_INDEX];
    	internals_st internals;
    	gnutls_key_st key;
    };

### gnutls_session_t

    typedef struct gnutls_session_int *gnutls_session_t;

### gnutls_sign_algorithm_get_name

    #define gnutls_sign_algorithm_get_name gnutls_sign_get_name

### enum gnutls_sign_algorithm_t

Enumeration of different digital signature algorithms.

#### Members

GNUTLS_SIGN_UNKNOWN | Unknown signature algorithm. |
GNUTLS_SIGN_RSA_SHA1 | Digital signature algorithm RSA with SHA-1 |
GNUTLS_SIGN_RSA_SHA | Same as `GNUTLS_SIGN_RSA_SHA1`. |
GNUTLS_SIGN_DSA_SHA1 | Digital signature algorithm DSA with SHA-1 |
GNUTLS_SIGN_DSA_SHA | Same as `GNUTLS_SIGN_DSA_SHA1`. |
GNUTLS_SIGN_RSA_MD5 | Digital signature algorithm RSA with MD5. |
GNUTLS_SIGN_RSA_MD2 | Digital signature algorithm RSA with MD2. |
GNUTLS_SIGN_RSA_RMD160 | Digital signature algorithm RSA with RMD-160. |
GNUTLS_SIGN_RSA_SHA256 | Digital signature algorithm RSA with SHA-256. |
GNUTLS_SIGN_RSA_SHA384 | Digital signature algorithm RSA with SHA-384. |
GNUTLS_SIGN_RSA_SHA512 | Digital signature algorithm RSA with SHA-512. |
GNUTLS_SIGN_RSA_SHA224 | Digital signature algorithm RSA with SHA-224. |
GNUTLS_SIGN_DSA_SHA224 | Digital signature algorithm DSA with SHA-224 |
GNUTLS_SIGN_DSA_SHA256 | Digital signature algorithm DSA with SHA-256 |
GNUTLS_SIGN_ECDSA_SHA1 | ECDSA with SHA1. |
GNUTLS_SIGN_ECDSA_SHA224 | Digital signature algorithm ECDSA with SHA-224. |
GNUTLS_SIGN_ECDSA_SHA256 | Digital signature algorithm ECDSA with SHA-256. |
GNUTLS_SIGN_ECDSA_SHA384 | Digital signature algorithm ECDSA with SHA-384. |
GNUTLS_SIGN_ECDSA_SHA512 | Digital signature algorithm ECDSA with SHA-512. |
GNUTLS_SIGN_DSA_SHA384 | Digital signature algorithm DSA with SHA-384 |
GNUTLS_SIGN_DSA_SHA512 | Digital signature algorithm DSA with SHA-512 |

### gnutls_srp_base64_decode_alloc

    #define gnutls_srp_base64_decode_alloc gnutls_srp_base64_decode2

### gnutls_srp_base64_encode_alloc

    #define gnutls_srp_base64_encode_alloc gnutls_srp_base64_encode2

### enum gnutls_srtp_profile_t

Enumeration of different SRTP protection profiles.

#### Members

GNUTLS_SRTP_AES128_CM_HMAC_SHA1_80 | 128 bit AES with a 80 bit HMAC-SHA1 |
GNUTLS_SRTP_AES128_CM_HMAC_SHA1_32 | 128 bit AES with a 32 bit HMAC-SHA1 |
GNUTLS_SRTP_NULL_HMAC_SHA1_80 | NULL cipher with a 80 bit HMAC-SHA1 |
GNUTLS_SRTP_NULL_HMAC_SHA1_32 | NULL cipher with a 32 bit HMAC-SHA1 |

### enum gnutls_supplemental_data_format_type_t

Enumeration of different supplemental data types (RFC 4680).

#### Members

GNUTLS_SUPPLEMENTAL_UNKNOWN | Unknown data format |

### struct gnutls_tdb_int

    struct gnutls_tdb_int;

### gnutls_tdb_t

    typedef struct gnutls_tdb_int *gnutls_tdb_t;

### gnutls_transport_ptr_t

    typedef void *gnutls_transport_ptr_t;

### gnutls_write

    #define gnutls_write gnutls_record_send

### gnutls_x509_crl_int

    typedef struct {
    	ASN1_TYPE crl;

    	unsigned expanded;
    	/* This is used to optimize reads by gnutls_x509_crl_get_crt_serial2() */
    	ASN1_TYPE rcache;
    	unsigned rcache_idx;
    	int use_extensions;

    	gnutls_datum_t der;
    	gnutls_datum_t raw_issuer_dn;
    } gnutls_x509_crl_int;

### gnutls_x509_crl_t

    typedef struct gnutls_x509_crl_int *gnutls_x509_crl_t;

### gnutls_x509_crq_int

    typedef struct {
    	ASN1_TYPE crq;
    } gnutls_x509_crq_int;

### gnutls_x509_crq_t

    typedef struct gnutls_x509_crq_int *gnutls_x509_crq_t;

### enum gnutls_x509_crt_fmt_t

Enumeration of different certificate encoding formats.

#### Members

GNUTLS_X509_FMT_DER | X.509 certificate in DER format (binary). |
GNUTLS_X509_FMT_PEM | X.509 certificate in PEM format (text). |

### gnutls_x509_crt_int

    typedef struct {
    	ASN1_TYPE cert;
    	int use_extensions;
    	int expanded;		/* a certificate has been expanded */

    	/* These two cached values allow fast calls to
    	 * get_raw_*_dn(). */
    	gnutls_datum_t raw_dn;
    	gnutls_datum_t raw_issuer_dn;
    	gnutls_datum_t raw_spki;

    	gnutls_datum_t der;
    	struct pin_info_st pin;

    	/* backwards compatibility for gnutls_x509_crt_get_subject()
    	 * and gnutls_x509_crt_get_issuer() */
    	gnutls_x509_dn_st dn;
    	gnutls_x509_dn_st idn;
    } gnutls_x509_crt_int;

### gnutls_x509_crt_t

    typedef struct gnutls_x509_crt_int *gnutls_x509_crt_t;

### gnutls_x509_privkey_int

    typedef struct {
    	/* the size of params depends on the public
    	 * key algorithm
    	 */
    	gnutls_pk_params_st params;

    	gnutls_pk_algorithm_t pk_algorithm;
    	unsigned expanded;

    	ASN1_TYPE key;
    	struct pin_info_st pin;
    } gnutls_x509_privkey_int;

### gnutls_x509_privkey_t

    typedef struct gnutls_x509_privkey_int *gnutls_x509_privkey_t;

### enum gnutls_x509_subject_alt_name_t

Enumeration of different subject alternative names types.

#### Members

GNUTLS_SAN_DNSNAME | DNS-name SAN. |
GNUTLS_SAN_RFC822NAME | E-mail address SAN. |
GNUTLS_SAN_URI | URI SAN. |
GNUTLS_SAN_IPADDRESS | IP address SAN. |
GNUTLS_SAN_OTHERNAME | OtherName SAN. |
GNUTLS_SAN_DN | DN SAN. |
GNUTLS_SAN_OTHERNAME_XMPP | Virtual SAN, used by gnutls_x509_crt_get_subject_alt_othername_oid. |