gnutls

gnutls

Synopsis

#define             GNUTLS_CIPHER_ARCFOUR
#define             GNUTLS_CIPHER_RIJNDAEL_128_CBC
#define             GNUTLS_CIPHER_RIJNDAEL_256_CBC
#define             GNUTLS_CIPHER_RIJNDAEL_CBC
#define             GNUTLS_CLIENT
#define             GNUTLS_DATAGRAM
#define             GNUTLS_DEFAULT_HANDSHAKE_TIMEOUT
#define             GNUTLS_DIG_SHA
#define             GNUTLS_HEARTBEAT_WAIT
#define             GNUTLS_MAC_SHA
#define             GNUTLS_MAX_ALGORITHM_NUM
#define             GNUTLS_NONBLOCK
#define             GNUTLS_NO_EXTENSIONS
#define             GNUTLS_PK_ECC
#define             GNUTLS_RECORD_WAIT
#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;
gnutls_alert_description_t gnutls_alert_get             (gnutls_session_t session);
const char *        gnutls_alert_get_name               (gnutls_alert_description_t alert);
const char *        gnutls_alert_get_strname            (gnutls_alert_description_t alert);
enum                gnutls_alert_level_t;
int                 gnutls_alert_send                   (gnutls_session_t session,
                                                         gnutls_alert_level_t level,
                                                         gnutls_alert_description_t desc);
int                 gnutls_alert_send_appropriate       (gnutls_session_t session,
                                                         int err);
int                 gnutls_bye                          (gnutls_session_t session,
                                                         gnutls_close_request_t how);
enum                gnutls_certificate_print_formats_t;
enum                gnutls_certificate_request_t;
enum                gnutls_certificate_status_t;
gnutls_certificate_type_t gnutls_certificate_type_get   (gnutls_session_t session);
gnutls_certificate_type_t gnutls_certificate_type_get_id
                                                        (const char *name);
const char *        gnutls_certificate_type_get_name    (gnutls_certificate_type_t type);
const gnutls_certificate_type_t * gnutls_certificate_type_list
                                                        (void);
enum                gnutls_certificate_type_t;
enum                gnutls_channel_binding_t;
enum                gnutls_cipher_algorithm_t;
gnutls_cipher_algorithm_t gnutls_cipher_get             (gnutls_session_t session);
gnutls_cipher_algorithm_t gnutls_cipher_get_id          (const char *name);
const char *        gnutls_cipher_get_name              (gnutls_cipher_algorithm_t algorithm);
const gnutls_cipher_algorithm_t * gnutls_cipher_list    (void);
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);
enum                gnutls_close_request_t;
gnutls_compression_method_t gnutls_compression_get      (gnutls_session_t session);
gnutls_compression_method_t gnutls_compression_get_id   (const char *name);
const char *        gnutls_compression_get_name         (gnutls_compression_method_t algorithm);
const gnutls_compression_method_t * gnutls_compression_list
                                                        (void);
enum                gnutls_compression_method_t;
enum                gnutls_credentials_type_t;
void                gnutls_deinit                       (gnutls_session_t session);
struct              gnutls_dh_params_int;
typedef             gnutls_dh_params_t;
enum                gnutls_digest_algorithm_t;
gnutls_ecc_curve_t  gnutls_ecc_curve_get                (gnutls_session_t session);
const char *        gnutls_ecc_curve_get_name           (gnutls_ecc_curve_t curve);
int                 gnutls_ecc_curve_get_size           (gnutls_ecc_curve_t curve);
const gnutls_ecc_curve_t * gnutls_ecc_curve_list        (void);
enum                gnutls_ecc_curve_t;
struct              gnutls_ecdh_params_int;
typedef             gnutls_ecdh_params_t;
int                 gnutls_error_is_fatal               (int error);
int                 gnutls_error_to_alert               (int err,
                                                         int *level);
int                 gnutls_handshake                    (gnutls_session_t session);
enum                gnutls_handshake_description_t;
gnutls_handshake_description_t gnutls_handshake_get_last_in
                                                        (gnutls_session_t session);
gnutls_handshake_description_t gnutls_handshake_get_last_out
                                                        (gnutls_session_t session);
void                gnutls_handshake_set_private_extensions
                                                        (gnutls_session_t session,
                                                         int allow);
int                 gnutls_handshake_set_random         (gnutls_session_t session,
                                                         const gnutls_datum_t *random);
void                gnutls_handshake_set_timeout        (gnutls_session_t session,
                                                         unsigned int ms);
int                 gnutls_heartbeat_ping               (gnutls_session_t session,
                                                         size_t data_size,
                                                         unsigned int max_tries,
                                                         unsigned int flags);
int                 gnutls_heartbeat_pong               (gnutls_session_t session,
                                                         unsigned int flags);
int                 gnutls_init                         (gnutls_session_t *session,
                                                         unsigned int flags);
enum                gnutls_kx_algorithm_t;
gnutls_kx_algorithm_t gnutls_kx_get                     (gnutls_session_t session);
gnutls_kx_algorithm_t gnutls_kx_get_id                  (const char *name);
const char *        gnutls_kx_get_name                  (gnutls_kx_algorithm_t algorithm);
const gnutls_kx_algorithm_t * gnutls_kx_list            (void);
enum                gnutls_mac_algorithm_t;
gnutls_mac_algorithm_t gnutls_mac_get                   (gnutls_session_t session);
gnutls_mac_algorithm_t gnutls_mac_get_id                (const char *name);
const char *        gnutls_mac_get_name                 (gnutls_mac_algorithm_t algorithm);
const gnutls_mac_algorithm_t * gnutls_mac_list          (void);
enum                gnutls_openpgp_crt_status_t;
enum                gnutls_params_type_t;
void                gnutls_perror                       (int error);
const char *        gnutls_pk_algorithm_get_name        (gnutls_pk_algorithm_t algorithm);
enum                gnutls_pk_algorithm_t;
gnutls_sec_param_t  gnutls_pk_bits_to_sec_param         (gnutls_pk_algorithm_t algo,
                                                         unsigned int bits);
gnutls_pk_algorithm_t gnutls_pk_get_id                  (const char *name);
const char *        gnutls_pk_get_name                  (gnutls_pk_algorithm_t algorithm);
const gnutls_pk_algorithm_t * gnutls_pk_list            (void);
gnutls_sign_algorithm_t gnutls_pk_to_sign               (gnutls_pk_algorithm_t pk,
                                                         gnutls_digest_algorithm_t hash);
struct              gnutls_priority_st;
typedef             gnutls_priority_t;
gnutls_protocol_t   gnutls_protocol_get_id              (const char *name);
const gnutls_protocol_t * gnutls_protocol_list          (void);
enum                gnutls_protocol_t;
void                gnutls_record_cork                  (gnutls_session_t session);
void                gnutls_record_disable_padding       (gnutls_session_t session);
void                gnutls_record_set_timeout           (gnutls_session_t session,
                                                         unsigned int ms);
int                 gnutls_record_uncork                (gnutls_session_t session,
                                                         unsigned int flags);
int                 gnutls_rehandshake                  (gnutls_session_t session);
typedef             gnutls_rsa_params_t;
const char *        gnutls_sec_param_get_name           (gnutls_sec_param_t param);
enum                gnutls_sec_param_t;
return              gnutls_sec_param_to_pk_bits         (GNUTLS_PK_DH Param1);
struct              gnutls_session_int;
typedef             gnutls_session_t;
int                 gnutls_sign_algorithm_get           (gnutls_session_t session);
int                 gnutls_sign_algorithm_get_client    (gnutls_session_t session);
#define             gnutls_sign_algorithm_get_name
int                 gnutls_sign_algorithm_get_requested (gnutls_session_t session,
                                                         size_t indx,
                                                         gnutls_sign_algorithm_t *algo);
enum                gnutls_sign_algorithm_t;
gnutls_digest_algorithm_t gnutls_sign_get_hash_algorithm
                                                        (gnutls_sign_algorithm_t sign);
gnutls_sign_algorithm_t gnutls_sign_get_id              (const char *name);
const char *        gnutls_sign_get_name                (gnutls_sign_algorithm_t algorithm);
gnutls_pk_algorithm_t gnutls_sign_get_pk_algorithm      (gnutls_sign_algorithm_t sign);
int                 gnutls_sign_is_secure               (gnutls_sign_algorithm_t algorithm);
const gnutls_sign_algorithm_t * gnutls_sign_list        (void);
const char *        gnutls_strerror                     (int error);
const char *        gnutls_strerror_name                (int error);
typedef             gnutls_transport_ptr_t;
enum                gnutls_x509_crt_fmt_t;
                    gnutls_x509_privkey_int;

Description

Details

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_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_DIG_SHA

#define GNUTLS_DIG_SHA GNUTLS_DIG_SHA1


GNUTLS_HEARTBEAT_WAIT

#define GNUTLS_HEARTBEAT_WAIT 1


GNUTLS_MAC_SHA

#define GNUTLS_MAC_SHA GNUTLS_MAC_SHA1


GNUTLS_MAX_ALGORITHM_NUM

#define GNUTLS_MAX_ALGORITHM_NUM 32


GNUTLS_NONBLOCK

#define GNUTLS_NONBLOCK (1<<3)


GNUTLS_NO_EXTENSIONS

#define GNUTLS_NO_EXTENSIONS (1<<4)


GNUTLS_PK_ECC

#define GNUTLS_PK_ECC GNUTLS_PK_EC


GNUTLS_RECORD_WAIT

#define GNUTLS_RECORD_WAIT 1


GNUTLS_SERVER

#define GNUTLS_SERVER 1


GNUTLS_VERSION

#define GNUTLS_VERSION "3.2.8"


GNUTLS_VERSION_MAJOR

#define GNUTLS_VERSION_MAJOR 3


GNUTLS_VERSION_MINOR

#define GNUTLS_VERSION_MINOR 2


GNUTLS_VERSION_NUMBER

#define GNUTLS_VERSION_NUMBER 0x030208


GNUTLS_VERSION_PATCH

#define GNUTLS_VERSION_PATCH 8


HAVE_SSIZE_T

#define             HAVE_SSIZE_T


enum gnutls_alert_description_t

typedef enum {
	GNUTLS_A_CLOSE_NOTIFY,
	GNUTLS_A_UNEXPECTED_MESSAGE = 10,
	GNUTLS_A_BAD_RECORD_MAC = 20,
	GNUTLS_A_DECRYPTION_FAILED,
	GNUTLS_A_RECORD_OVERFLOW,
	GNUTLS_A_DECOMPRESSION_FAILURE = 30,
	GNUTLS_A_HANDSHAKE_FAILURE = 40,
	GNUTLS_A_SSL3_NO_CERTIFICATE = 41,
	GNUTLS_A_BAD_CERTIFICATE = 42,
	GNUTLS_A_UNSUPPORTED_CERTIFICATE,
	GNUTLS_A_CERTIFICATE_REVOKED,
	GNUTLS_A_CERTIFICATE_EXPIRED,
	GNUTLS_A_CERTIFICATE_UNKNOWN,
	GNUTLS_A_ILLEGAL_PARAMETER,
	GNUTLS_A_UNKNOWN_CA,
	GNUTLS_A_ACCESS_DENIED,
	GNUTLS_A_DECODE_ERROR = 50,
	GNUTLS_A_DECRYPT_ERROR,
	GNUTLS_A_EXPORT_RESTRICTION = 60,
	GNUTLS_A_PROTOCOL_VERSION = 70,
	GNUTLS_A_INSUFFICIENT_SECURITY,
	GNUTLS_A_INTERNAL_ERROR = 80,
	GNUTLS_A_USER_CANCELED = 90,
	GNUTLS_A_NO_RENEGOTIATION = 100,
	GNUTLS_A_UNSUPPORTED_EXTENSION = 110,
	GNUTLS_A_CERTIFICATE_UNOBTAINABLE = 111,
	GNUTLS_A_UNRECOGNIZED_NAME = 112,
	GNUTLS_A_UNKNOWN_PSK_IDENTITY = 115,
	GNUTLS_A_NO_APPLICATION_PROTOCOL = 120,
} gnutls_alert_description_t;

Enumeration of different TLS alerts.

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_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


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.

session :

is a gnutls_session_t structure.

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().

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.

alert :

is an alert number.

Returns :

string corresponding to gnutls_alert_description_t value.

Since 3.0


enum gnutls_alert_level_t

typedef enum {
	GNUTLS_AL_WARNING = 1,
	GNUTLS_AL_FATAL
} gnutls_alert_level_t;

Enumeration of different TLS alert severities.

GNUTLS_AL_WARNING

Alert of warning severity.

GNUTLS_AL_FATAL

Alert of fatal severity.

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.

session :

is a gnutls_session_t structure.

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.

session :

is a gnutls_session_t structure.

err :

is an integer

Returns :

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

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().

session :

is a gnutls_session_t structure.

how :

is an integer

Returns :

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

enum gnutls_certificate_print_formats_t

typedef enum {
	GNUTLS_CRT_PRINT_FULL = 0,
	GNUTLS_CRT_PRINT_ONELINE = 1,
	GNUTLS_CRT_PRINT_UNSIGNED_FULL = 2,
	GNUTLS_CRT_PRINT_COMPACT = 3,
	GNUTLS_CRT_PRINT_FULL_NUMBERS = 4,
} gnutls_certificate_print_formats_t;

Enumeration of different certificate printing variants.

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

typedef enum {
	GNUTLS_CERT_IGNORE = 0,
	GNUTLS_CERT_REQUEST = 1,
	GNUTLS_CERT_REQUIRE = 2
} gnutls_certificate_request_t;

Enumeration of certificate request types.

GNUTLS_CERT_IGNORE

Ignore certificate.

GNUTLS_CERT_REQUEST

Request certificate.

GNUTLS_CERT_REQUIRE

Require certificate.

enum gnutls_certificate_status_t

typedef enum {
	GNUTLS_CERT_INVALID = 1 << 1,
	GNUTLS_CERT_REVOKED = 1 << 5,
	GNUTLS_CERT_SIGNER_NOT_FOUND = 1 << 6,
	GNUTLS_CERT_SIGNER_NOT_CA = 1 << 7,
	GNUTLS_CERT_INSECURE_ALGORITHM = 1 << 8,
	GNUTLS_CERT_NOT_ACTIVATED = 1 << 9,
	GNUTLS_CERT_EXPIRED = 1 << 10,
	GNUTLS_CERT_SIGNATURE_FAILURE = 1 << 11,
	GNUTLS_CERT_REVOCATION_DATA_SUPERSEDED = 1 << 12,
	GNUTLS_CERT_UNEXPECTED_OWNER = 1 << 14,
	GNUTLS_CERT_REVOCATION_DATA_ISSUED_IN_FUTURE = 1 << 15,
	GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE = 1 << 16,
	GNUTLS_CERT_MISMATCH = 1 << 17,
} 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.

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_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.

session :

is a gnutls_session_t structure.

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.

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.

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.

enum gnutls_certificate_type_t

typedef enum {
	GNUTLS_CRT_UNKNOWN = 0,
	GNUTLS_CRT_X509 = 1,
	GNUTLS_CRT_OPENPGP = 2,
	GNUTLS_CRT_RAW = 3
} gnutls_certificate_type_t;

Enumeration of different certificate types.

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

typedef enum {
	GNUTLS_CB_TLS_UNIQUE
} gnutls_channel_binding_t;

Enumeration of support channel binding types.

GNUTLS_CB_TLS_UNIQUE

"tls-unique" (RFC 5929) channel binding

enum gnutls_cipher_algorithm_t

typedef enum {
	GNUTLS_CIPHER_UNKNOWN = 0,
	GNUTLS_CIPHER_NULL = 1,
	GNUTLS_CIPHER_ARCFOUR_128 = 2,
	GNUTLS_CIPHER_3DES_CBC = 3,
	GNUTLS_CIPHER_AES_128_CBC = 4,
	GNUTLS_CIPHER_AES_256_CBC = 5,
	GNUTLS_CIPHER_ARCFOUR_40 = 6,
	GNUTLS_CIPHER_CAMELLIA_128_CBC = 7,
	GNUTLS_CIPHER_CAMELLIA_256_CBC = 8,
	GNUTLS_CIPHER_RC2_40_CBC = 90,
	GNUTLS_CIPHER_DES_CBC = 91,
	GNUTLS_CIPHER_AES_192_CBC = 92,
	GNUTLS_CIPHER_AES_128_GCM = 93,
	GNUTLS_CIPHER_AES_256_GCM = 94,
	GNUTLS_CIPHER_CAMELLIA_192_CBC = 95,
	GNUTLS_CIPHER_SALSA20_256 = 96,
	GNUTLS_CIPHER_ESTREAM_SALSA20_256 = 97,
	GNUTLS_CIPHER_CAMELLIA_128_GCM = 98,
	GNUTLS_CIPHER_CAMELLIA_256_GCM = 99,

	/* used only for PGP internals. Ignored in TLS/SSL
	 */
	GNUTLS_CIPHER_IDEA_PGP_CFB = 200,
	GNUTLS_CIPHER_3DES_PGP_CFB = 201,
	GNUTLS_CIPHER_CAST5_PGP_CFB = 202,
	GNUTLS_CIPHER_BLOWFISH_PGP_CFB = 203,
	GNUTLS_CIPHER_SAFER_SK128_PGP_CFB = 204,
	GNUTLS_CIPHER_AES128_PGP_CFB = 205,
	GNUTLS_CIPHER_AES192_PGP_CFB = 206,
	GNUTLS_CIPHER_AES256_PGP_CFB = 207,
	GNUTLS_CIPHER_TWOFISH_PGP_CFB = 208
} gnutls_cipher_algorithm_t;

Enumeration of different symmetric encryption algorithms.

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_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_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

GNUTLS_CIPHER_ESTREAM_SALSA20_256

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_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.

gnutls_cipher_get ()

gnutls_cipher_algorithm_t gnutls_cipher_get             (gnutls_session_t session);

Get currently used cipher.

session :

is a gnutls_session_t structure.

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.

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_name ()

const char *        gnutls_cipher_get_name              (gnutls_cipher_algorithm_t algorithm);

Convert a gnutls_cipher_algorithm_t type to a string.

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_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.

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.

enum gnutls_close_request_t

typedef enum {
	GNUTLS_SHUT_RDWR = 0,
	GNUTLS_SHUT_WR = 1
} gnutls_close_request_t;

Enumeration of how TLS session should be terminated. See gnutls_bye().

GNUTLS_SHUT_RDWR

Disallow further receives/sends.

GNUTLS_SHUT_WR

Disallow further sends.

gnutls_compression_get ()

gnutls_compression_method_t gnutls_compression_get      (gnutls_session_t session);

Get currently used compression algorithm.

session :

is a gnutls_session_t structure.

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.

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.

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.

enum gnutls_compression_method_t

typedef enum {
	GNUTLS_COMP_UNKNOWN = 0,
	GNUTLS_COMP_NULL = 1,
	GNUTLS_COMP_DEFLATE = 2,
	GNUTLS_COMP_ZLIB = GNUTLS_COMP_DEFLATE,
} gnutls_compression_method_t;

Enumeration of different TLS compression methods.

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.

enum gnutls_credentials_type_t

typedef enum {
	GNUTLS_CRD_CERTIFICATE = 1,
	GNUTLS_CRD_ANON,
	GNUTLS_CRD_SRP,
	GNUTLS_CRD_PSK,
	GNUTLS_CRD_IA
} gnutls_credentials_type_t;

Enumeration of different credential types.

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.

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.

session :

is a gnutls_session_t structure.

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

typedef enum {
	GNUTLS_DIG_UNKNOWN = GNUTLS_MAC_UNKNOWN,
	GNUTLS_DIG_NULL = GNUTLS_MAC_NULL,
	GNUTLS_DIG_MD5 = GNUTLS_MAC_MD5,
	GNUTLS_DIG_SHA1 = GNUTLS_MAC_SHA1,
	GNUTLS_DIG_RMD160 = GNUTLS_MAC_RMD160,
	GNUTLS_DIG_MD2 = GNUTLS_MAC_MD2,
	GNUTLS_DIG_SHA256 = GNUTLS_MAC_SHA256,
	GNUTLS_DIG_SHA384 = GNUTLS_MAC_SHA384,
	GNUTLS_DIG_SHA512 = GNUTLS_MAC_SHA512,
	GNUTLS_DIG_SHA224 = GNUTLS_MAC_SHA224
	    /* If you add anything here, make sure you align with
	       gnutls_mac_algorithm_t. */
} gnutls_digest_algorithm_t;

Enumeration of different digest (hash) algorithms.

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.

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.

session :

is a gnutls_session_t structure.

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.

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.

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.

enum gnutls_ecc_curve_t

typedef enum {
	GNUTLS_ECC_CURVE_INVALID = 0,
	GNUTLS_ECC_CURVE_SECP224R1,
	GNUTLS_ECC_CURVE_SECP256R1,
	GNUTLS_ECC_CURVE_SECP384R1,
	GNUTLS_ECC_CURVE_SECP521R1,
	GNUTLS_ECC_CURVE_SECP192R1,
} gnutls_ecc_curve_t;

Enumeration of ECC curves.

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

struct gnutls_ecdh_params_int

struct gnutls_ecdh_params_int;


gnutls_ecdh_params_t

typedef struct gnutls_ecdh_params_int *gnutls_ecdh_params_t;


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).

error :

is a GnuTLS error code, a negative error code

Returns :

zero on non fatal errors or positive error values. Non-zero on fatal error codes.

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.

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_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 such as GNUTLS_E_AGAIN and GNUTLS_E_INTERRUPTED interrupt the handshake procedure, which should be resumed later. Call this function again, until it returns 0; cf. gnutls_record_get_direction() and gnutls_error_is_fatal().

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 might also mean that some data were pending.

session :

is a gnutls_session_t structure.

Returns :

GNUTLS_E_SUCCESS on success, otherwise a negative error code.

enum gnutls_handshake_description_t

typedef enum {
	GNUTLS_HANDSHAKE_HELLO_REQUEST = 0,
	GNUTLS_HANDSHAKE_CLIENT_HELLO = 1,
	GNUTLS_HANDSHAKE_SERVER_HELLO = 2,
	GNUTLS_HANDSHAKE_HELLO_VERIFY_REQUEST = 3,
	GNUTLS_HANDSHAKE_NEW_SESSION_TICKET = 4,
	GNUTLS_HANDSHAKE_CERTIFICATE_PKT = 11,
	GNUTLS_HANDSHAKE_SERVER_KEY_EXCHANGE = 12,
	GNUTLS_HANDSHAKE_CERTIFICATE_REQUEST = 13,
	GNUTLS_HANDSHAKE_SERVER_HELLO_DONE = 14,
	GNUTLS_HANDSHAKE_CERTIFICATE_VERIFY = 15,
	GNUTLS_HANDSHAKE_CLIENT_KEY_EXCHANGE = 16,
	GNUTLS_HANDSHAKE_FINISHED = 20,
	GNUTLS_HANDSHAKE_CERTIFICATE_STATUS = 22,
	GNUTLS_HANDSHAKE_SUPPLEMENTAL = 23,
	GNUTLS_HANDSHAKE_CHANGE_CIPHER_SPEC = 254,
	GNUTLS_HANDSHAKE_CLIENT_HELLO_V2 = 1024,
} gnutls_handshake_description_t;

Enumeration of different TLS handshake packets.

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.

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.

session :

is a gnutls_session_t structure.

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.

session :

is a gnutls_session_t structure.

Returns :

the last handshake message type sent, a gnutls_handshake_description_t.

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.

session :

is a gnutls_session_t structure.

allow :

is an integer (0 or 1)

gnutls_handshake_set_random ()

int                 gnutls_handshake_set_random         (gnutls_session_t session,
                                                         const gnutls_datum_t *random);

This function will explicitly set the server or client hello random value in the subsequent TLS handshake. The random value should be a 32-byte value.

Note that this function should not normally be used as gnutls will select automatically a random value for the handshake.

This function should not be used when resuming a session.

session :

is a gnutls_session_t structure.

random :

a random value of 32-bytes

Returns :

GNUTLS_E_SUCCESS on success, or an error code. Since 3.1.9

gnutls_handshake_set_timeout ()

void                gnutls_handshake_set_timeout        (gnutls_session_t session,
                                                         unsigned int ms);

This function sets the timeout for the handshake process to the provided value. Use an ms value of zero to disable timeout.

Note that in order for the timeout to be enforced gnutls_transport_set_pull_timeout_function() must be set (it is set by default in most systems).

session :

is a gnutls_session_t structure.

ms :

is a timeout value in milliseconds

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.

session :

is a gnutls_session_t structure.

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.

session :

is a gnutls_session_t structure.

flags :

should be zero

Returns :

GNUTLS_E_SUCCESS on success, otherwise a negative error code.

Since 3.1.2


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 and GNUTLS_SERVER. For a DTLS entity, the flags GNUTLS_DATAGRAM and GNUTLS_NONBLOCK are also available. The latter flag will enable a non-blocking operation of the DTLS timers.

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.

session :

is a pointer to a gnutls_session_t structure.

flags :

indicate if this session is to be used for server or client.

Returns :

GNUTLS_E_SUCCESS on success, or an error code.

enum gnutls_kx_algorithm_t

typedef enum {
	GNUTLS_KX_UNKNOWN = 0,
	GNUTLS_KX_RSA = 1,
	GNUTLS_KX_DHE_DSS = 2,
	GNUTLS_KX_DHE_RSA = 3,
	GNUTLS_KX_ANON_DH = 4,
	GNUTLS_KX_SRP = 5,
	GNUTLS_KX_RSA_EXPORT = 6,
	GNUTLS_KX_SRP_RSA = 7,
	GNUTLS_KX_SRP_DSS = 8,
	GNUTLS_KX_PSK = 9,
	GNUTLS_KX_DHE_PSK = 10,
	GNUTLS_KX_ANON_ECDH = 11,
	GNUTLS_KX_ECDHE_RSA = 12,
	GNUTLS_KX_ECDHE_ECDSA = 13,
	GNUTLS_KX_ECDHE_PSK = 14,
	GNUTLS_KX_RSA_PSK = 15,
} gnutls_kx_algorithm_t;

Enumeration of different key exchange algorithms.

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.

gnutls_kx_get ()

gnutls_kx_algorithm_t gnutls_kx_get                     (gnutls_session_t session);

Get currently used key exchange algorithm.

session :

is a gnutls_session_t structure.

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.

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.

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.

enum gnutls_mac_algorithm_t

typedef enum {
	GNUTLS_MAC_UNKNOWN = 0,
	GNUTLS_MAC_NULL = 1,
	GNUTLS_MAC_MD5 = 2,
	GNUTLS_MAC_SHA1 = 3,
	GNUTLS_MAC_RMD160 = 4,
	GNUTLS_MAC_MD2 = 5,
	GNUTLS_MAC_SHA256 = 6,
	GNUTLS_MAC_SHA384 = 7,
	GNUTLS_MAC_SHA512 = 8,
	GNUTLS_MAC_SHA224 = 9,
	/* If you add anything here, make sure you align with
	   gnutls_digest_algorithm_t. */
	GNUTLS_MAC_AEAD = 200, /* indicates that MAC is on the cipher */
	GNUTLS_MAC_UMAC_96 = 201,
	GNUTLS_MAC_UMAC_128 = 202,
} gnutls_mac_algorithm_t;

Enumeration of different Message Authentication Code (MAC) algorithms.

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_mac_get ()

gnutls_mac_algorithm_t gnutls_mac_get                   (gnutls_session_t session);

Get currently used MAC algorithm.

session :

is a gnutls_session_t structure.

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.

name :

is a MAC algorithm name

Returns :

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

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.


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.

enum gnutls_openpgp_crt_status_t

typedef enum {
	GNUTLS_OPENPGP_CERT = 0,
	GNUTLS_OPENPGP_CERT_FINGERPRINT = 1
} gnutls_openpgp_crt_status_t;

Enumeration of ways to send OpenPGP certificate.

GNUTLS_OPENPGP_CERT

Send entire certificate.

GNUTLS_OPENPGP_CERT_FINGERPRINT

Send only certificate fingerprint.

enum gnutls_params_type_t

typedef enum {
	GNUTLS_PARAMS_RSA_EXPORT = 1,
	GNUTLS_PARAMS_DH = 2,
	GNUTLS_PARAMS_ECDH = 3,
} gnutls_params_type_t;

Enumeration of different TLS session parameter types.

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_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.

error :

is a GnuTLS error code, a negative error code

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.

algorithm :

is a pk algorithm

Returns :

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

enum gnutls_pk_algorithm_t

typedef enum {
	GNUTLS_PK_UNKNOWN = 0,
	GNUTLS_PK_RSA = 1,
	GNUTLS_PK_DSA = 2,
	GNUTLS_PK_DH = 3,
	GNUTLS_PK_EC = 4,
} gnutls_pk_algorithm_t;

Enumeration of different public-key algorithms.

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.

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.

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.

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.

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.

pk :

is a public key algorithm

hash :

a hash algorithm

Returns :

return a gnutls_sign_algorithm_t value, or GNUTLS_SIGN_UNKNOWN on error.

struct gnutls_priority_st

struct gnutls_priority_st;


gnutls_priority_t

typedef struct gnutls_priority_st *gnutls_priority_t;


gnutls_protocol_get_id ()

gnutls_protocol_t   gnutls_protocol_get_id              (const char *name);

The names are compared in a case insensitive way.

name :

is a protocol name

Returns :

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

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.

enum gnutls_protocol_t

typedef enum {
	GNUTLS_SSL3 = 1,
	GNUTLS_TLS1_0 = 2,
	GNUTLS_TLS1 = GNUTLS_TLS1_0,
	GNUTLS_TLS1_1 = 3,
	GNUTLS_TLS1_2 = 4,
	GNUTLS_DTLS0_9 = 6, /* FIXME: at some point change it to 200 */
	GNUTLS_DTLS1_0 = 5, /* 201 */
	GNUTLS_DTLS1_2 = 202,
	GNUTLS_DTLS_VERSION_MIN = GNUTLS_DTLS1_0,
	GNUTLS_DTLS_VERSION_MAX = GNUTLS_DTLS1_2,
	GNUTLS_TLS_VERSION_MAX = GNUTLS_TLS1_2,
	GNUTLS_VERSION_UNKNOWN = 0xff /* change it to 0xffff */
} gnutls_protocol_t;

Enumeration of different SSL/TLS protocol versions.

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.

gnutls_record_cork ()

void                gnutls_record_cork                  (gnutls_session_t session);


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().

session :

is a gnutls_session_t structure.

gnutls_record_set_timeout ()

void                gnutls_record_set_timeout           (gnutls_session_t session,
                                                         unsigned int ms);

This function sets the receive timeout for the record layer to the provided value. Use an ms value of zero to disable timeout (the default).

Note that in order for the timeout to be enforced gnutls_transport_set_pull_timeout_function() must be set (it is set by default in most systems).

session :

is a gnutls_session_t structure.

ms :

is a timeout value in milliseconds

Since 3.1.7


gnutls_record_uncork ()

int                 gnutls_record_uncork                (gnutls_session_t session,
                                                         unsigned int flags);


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 will should 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.

session :

is a gnutls_session_t structure.

Returns :

GNUTLS_E_SUCCESS on success, otherwise a negative error code.

gnutls_rsa_params_t

typedef struct gnutls_x509_privkey_int *gnutls_rsa_params_t;


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.

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


enum gnutls_sec_param_t

typedef enum {
	GNUTLS_SEC_PARAM_INSECURE = -20,
	GNUTLS_SEC_PARAM_EXPORT = -15,
	GNUTLS_SEC_PARAM_VERY_WEAK = -12,
	GNUTLS_SEC_PARAM_WEAK = -10,
	GNUTLS_SEC_PARAM_UNKNOWN = 0,
	GNUTLS_SEC_PARAM_LOW = 1,
	GNUTLS_SEC_PARAM_LEGACY = 2,
	GNUTLS_SEC_PARAM_NORMAL = 3,
	GNUTLS_SEC_PARAM_HIGH = 4,
	GNUTLS_SEC_PARAM_ULTRA = 5,
} gnutls_sec_param_t;

Enumeration of security parameters for passive attacks.

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_UNKNOWN

Cannot be known

GNUTLS_SEC_PARAM_LOW

80 bits of security

GNUTLS_SEC_PARAM_LEGACY

96 bits of security

GNUTLS_SEC_PARAM_NORMAL

112 bits of security

GNUTLS_SEC_PARAM_HIGH

128 bits of security

GNUTLS_SEC_PARAM_ULTRA

192 bits of security

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


struct gnutls_session_int

struct gnutls_session_int;


gnutls_session_t

typedef struct gnutls_session_int *gnutls_session_t;


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.

session :

is a gnutls_session_t structure.

Returns :

The sign algorithm or GNUTLS_SIGN_UNKNOWN.

Since 3.1.1


gnutls_sign_algorithm_get_client ()

int                 gnutls_sign_algorithm_get_client    (gnutls_session_t session);

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

session :

is a gnutls_session_t structure.

Returns :

The sign algorithm or GNUTLS_SIGN_UNKNOWN.

Since 3.1.11


gnutls_sign_algorithm_get_name

#define gnutls_sign_algorithm_get_name gnutls_sign_get_name


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.

session :

is a gnutls_session_t structure.

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


enum gnutls_sign_algorithm_t

typedef enum {
	GNUTLS_SIGN_UNKNOWN = 0,
	GNUTLS_SIGN_RSA_SHA1 = 1,
	GNUTLS_SIGN_RSA_SHA = GNUTLS_SIGN_RSA_SHA1,
	GNUTLS_SIGN_DSA_SHA1 = 2,
	GNUTLS_SIGN_DSA_SHA = GNUTLS_SIGN_DSA_SHA1,
	GNUTLS_SIGN_RSA_MD5 = 3,
	GNUTLS_SIGN_RSA_MD2 = 4,
	GNUTLS_SIGN_RSA_RMD160 = 5,
	GNUTLS_SIGN_RSA_SHA256 = 6,
	GNUTLS_SIGN_RSA_SHA384 = 7,
	GNUTLS_SIGN_RSA_SHA512 = 8,
	GNUTLS_SIGN_RSA_SHA224 = 9,
	GNUTLS_SIGN_DSA_SHA224 = 10,
	GNUTLS_SIGN_DSA_SHA256 = 11,
	GNUTLS_SIGN_ECDSA_SHA1 = 12,
	GNUTLS_SIGN_ECDSA_SHA224 = 13,
	GNUTLS_SIGN_ECDSA_SHA256 = 14,
	GNUTLS_SIGN_ECDSA_SHA384 = 15,
	GNUTLS_SIGN_ECDSA_SHA512 = 16,
} gnutls_sign_algorithm_t;

Enumeration of different digital signature algorithms.

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_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.

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.

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.

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.

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);

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_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.

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".

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_transport_ptr_t

typedef void *gnutls_transport_ptr_t;


enum gnutls_x509_crt_fmt_t

typedef enum {
	GNUTLS_X509_FMT_DER = 0,
	GNUTLS_X509_FMT_PEM = 1
} gnutls_x509_crt_fmt_t;

Enumeration of different certificate encoding formats.

GNUTLS_X509_FMT_DER

X.509 certificate in DER format (binary).

GNUTLS_X509_FMT_PEM

X.509 certificate in PEM format (text).

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;

	ASN1_TYPE key;
} gnutls_x509_privkey_int;