![]() |
![]() |
![]() |
GnuTLS API Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
#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_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
); size_t gnutls_cipher_get_key_size (gnutls_cipher_algorithm_t algorithm
); 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
); 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
); size_t gnutls_mac_get_key_size (gnutls_mac_algorithm_t algorithm
); 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_disable_padding (gnutls_session_t session
); 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
); #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; struct gnutls_x509_privkey_int;
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.
Close notify. | |
Unexpected message. | |
Bad record MAC. | |
Decryption failed. | |
Record overflow. | |
Decompression failed. | |
Handshake failed. | |
No certificate. | |
Certificate is bad. | |
Certificate is not supported. | |
Certificate was revoked. | |
Certificate is expired. | |
Unknown certificate. | |
Illegal parameter. | |
CA is unknown. | |
Access was denied. | |
Decode error. | |
Decrypt error. | |
Export restriction. | |
Error in protocol version. | |
Insufficient security. | |
Internal error. | |
User canceled. | |
No renegotiation is allowed. | |
An unsupported extension was sent. | |
Could not retrieve the specified certificate. | |
The server name sent was not recognized. | |
The SRP/PSK username is missing or not known. | |
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.
|
is a gnutls_session_t structure. |
Returns : |
the last alert received, a gnutls_alert_description_t value. |
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()
.
|
is an alert number. |
Returns : |
string corresponding to gnutls_alert_description_t value. |
const char * gnutls_alert_get_strname (gnutls_alert_description_t alert
);
This function will return a string of the name of the alert.
|
is an alert number. |
Returns : |
string corresponding to gnutls_alert_description_t value. |
Since 3.0
typedef enum { GNUTLS_AL_WARNING = 1, GNUTLS_AL_FATAL } gnutls_alert_level_t;
Enumeration of different TLS alert severities.
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.
|
is a gnutls_session_t structure. |
|
is the level of the alert |
|
is the alert description |
Returns : |
On success, GNUTLS_E_SUCCESS (0) is returned, otherwise
an error code is returned. |
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.
|
is a gnutls_session_t structure. |
|
is an integer |
Returns : |
On success, GNUTLS_E_SUCCESS (0) is returned, otherwise
an error code is returned. |
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()
.
|
is a gnutls_session_t structure. |
|
is an integer |
Returns : |
GNUTLS_E_SUCCESS on success, or an error code, see
function documentation for entire semantics. |
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.
Full information about certificate. | |
Information about certificate in one line. | |
All info for an unsigned certificate. | |
Information about certificate name in one line, plus identification of the public key. | |
Full information about certificate and include easy to parse public key parameters. |
typedef enum { GNUTLS_CERT_IGNORE = 0, GNUTLS_CERT_REQUEST = 1, GNUTLS_CERT_REQUIRE = 2 } gnutls_certificate_request_t;
Enumeration of certificate request types.
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.
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 ).
|
|
Certificate is revoked by its authority. In X.509 this will be set only if CRLs are checked. | |
The certificate's issuer is not known. This is the case if the issuer is not included in the trusted certificate list. | |
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. | |
The certificate was signed using an insecure algorithm such as MD2 or MD5. These algorithms have been broken and should not be trusted. | |
The certificate is not yet activated. | |
The certificate has expired. | |
The signature verification failed. | |
The revocation data are old and have been superseded. | |
The owner is not the expected one. | |
The revocation data have a future issue date. | |
The certificate's signer constraints were violated. | |
The certificate presented isn't the expected one (TOFU) |
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.
|
is a gnutls_session_t structure. |
Returns : |
the currently used gnutls_certificate_type_t certificate type. |
gnutls_certificate_type_t gnutls_certificate_type_get_id
(const char *name
);
The names are compared in a case insensitive way.
|
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. |
const char * gnutls_certificate_type_get_name (gnutls_certificate_type_t type
);
Convert a gnutls_certificate_type_t type to a string.
|
is a certificate type |
Returns : |
a string that contains the name of the specified
certificate type, or NULL in case of unknown types. |
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. |
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.
typedef enum { GNUTLS_CB_TLS_UNIQUE } gnutls_channel_binding_t;
Enumeration of support channel binding types.
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, /* 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.
Unknown algorithm. | |
NULL algorithm. | |
ARCFOUR stream cipher with 128-bit keys. | |
3DES in CBC mode. | |
AES in CBC mode with 128-bit keys. | |
AES in CBC mode with 256-bit keys. | |
ARCFOUR stream cipher with 40-bit keys. | |
Camellia in CBC mode with 128-bit keys. | |
Camellia in CBC mode with 256-bit keys. | |
RC2 in CBC mode with 40-bit keys. | |
DES in CBC mode (56-bit keys). | |
AES in CBC mode with 192-bit keys. | |
AES in GCM mode with 128-bit keys. | |
AES in GCM mode with 256-bit keys. | |
Camellia in CBC mode with 192-bit keys. | |
IDEA in CFB mode. | |
3DES in CFB mode. | |
CAST5 in CFB mode. | |
Blowfish in CFB mode. | |
Safer-SK in CFB mode with 128-bit keys. | |
AES in CFB mode with 128-bit keys. | |
AES in CFB mode with 192-bit keys. | |
AES in CFB mode with 256-bit keys. | |
Twofish in CFB mode. |
gnutls_cipher_algorithm_t gnutls_cipher_get (gnutls_session_t session
);
Get currently used cipher.
|
is a gnutls_session_t structure. |
Returns : |
the currently used cipher, a gnutls_cipher_algorithm_t type. |
gnutls_cipher_algorithm_t gnutls_cipher_get_id (const char *name
);
The names are compared in a case insensitive way.
|
is a cipher algorithm name |
Returns : |
return a gnutls_cipher_algorithm_t value corresponding to
the specified cipher, or GNUTLS_CIPHER_UNKNOWN on error. |
size_t gnutls_cipher_get_key_size (gnutls_cipher_algorithm_t algorithm
);
Get key size for cipher.
|
is an encryption algorithm |
Returns : |
length (in bytes) of the given cipher's key size, or 0 if the given cipher is invalid. |
const char * gnutls_cipher_get_name (gnutls_cipher_algorithm_t algorithm
);
Convert a gnutls_cipher_algorithm_t type to a string.
|
is an encryption algorithm |
Returns : |
a pointer to a string that contains the name of the
specified cipher, or NULL . |
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. |
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.
|
index of cipher suite to get information about, starts on 0. |
|
output buffer with room for 2 bytes, indicating cipher suite value |
|
output variable indicating key exchange algorithm, or NULL . |
|
output variable indicating cipher, or NULL . |
|
output variable indicating MAC algorithm, or NULL . |
|
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. |
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_compression_method_t gnutls_compression_get (gnutls_session_t session
);
Get currently used compression algorithm.
|
is a gnutls_session_t structure. |
Returns : |
the currently used compression method, a gnutls_compression_method_t value. |
gnutls_compression_method_t gnutls_compression_get_id (const char *name
);
The names are compared in a case insensitive way.
|
is a compression method name |
Returns : |
an id of the specified in a string compression method, or
GNUTLS_COMP_UNKNOWN on error. |
const char * gnutls_compression_get_name (gnutls_compression_method_t algorithm
);
Convert a gnutls_compression_method_t value to a string.
|
is a Compression algorithm |
Returns : |
a pointer to a string that contains the name of the
specified compression algorithm, or NULL . |
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. |
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.
Unknown compression method. | |
The NULL compression method (no compression). | |
The DEFLATE compression method from zlib. | |
Same as GNUTLS_COMP_DEFLATE .
|
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.
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.
|
is a gnutls_session_t structure. |
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.
Unknown hash algorithm. | |
NULL hash algorithm (empty output). | |
MD5 algorithm. | |
SHA-1 algorithm. | |
RMD160 algorithm. | |
MD2 algorithm. | |
SHA-256 algorithm. | |
SHA-384 algorithm. | |
SHA-512 algorithm. | |
SHA-224 algorithm. |
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.
|
is a gnutls_session_t structure. |
Returns : |
the currently used curve, a gnutls_ecc_curve_t type. |
Since 3.0
const char * gnutls_ecc_curve_get_name (gnutls_ecc_curve_t curve
);
Convert a gnutls_ecc_curve_t value to a string.
|
is an ECC curve |
Returns : |
a string that contains the name of the specified
curve or NULL . |
Since 3.0
int gnutls_ecc_curve_get_size (gnutls_ecc_curve_t curve
);
Returns the size in bytes of the curve.
|
is an ECC curve |
Returns : |
a the size or (0). |
Since 3.0
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. |
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.
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. 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 the record layer or the handshake layer.
|
is a GnuTLS error code, a negative error code |
Returns : |
1 if the error code is fatal, for positive error values,
0 is returned. For unknown error values, -1 is returned. |
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.
|
is a negative integer |
|
the alert level will be stored there |
Returns : |
the alert code to use for a particular error code. |
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.
|
is a gnutls_session_t structure. |
Returns : |
GNUTLS_E_SUCCESS on success, otherwise a negative error code. |
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.
Hello request. | |
Client hello. | |
Server hello. | |
DTLS Hello verify request. | |
New session ticket. | |
Certificate packet. | |
Server key exchange. | |
Certificate request. | |
Server hello done. | |
Certificate verify. | |
Client key exchange. | |
Finished. | |
Certificate status (OCSP). | |
Supplemental. | |
Change Cipher Spec. | |
SSLv2 Client Hello. |
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.
|
is a gnutls_session_t structure. |
Returns : |
the last handshake message type received, a
gnutls_handshake_description_t . |
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.
|
is a gnutls_session_t structure. |
Returns : |
the last handshake message type sent, a
gnutls_handshake_description_t . |
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 advertized 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.
|
is a gnutls_session_t structure. |
|
is an integer (0 or 1) |
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).
|
is a gnutls_session_t structure. |
|
is a timeout value in milliseconds |
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.
|
is a gnutls_session_t structure. |
|
is the length of the ping payload. |
|
if flags is GNUTLS_HEARTBEAT_WAIT then this sets the number of retransmissions. Use zero for indefinite (until timeout). |
|
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
int gnutls_heartbeat_pong (gnutls_session_t session
,unsigned int flags
);
This function replies to a ping by sending a pong to the peer.
|
is a gnutls_session_t structure. |
|
should be zero |
Returns : |
GNUTLS_E_SUCCESS on success, otherwise a negative error code. |
Since 3.1.2
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.
|
is a pointer to a gnutls_session_t structure. |
|
indicate if this session is to be used for server or client. |
Returns : |
GNUTLS_E_SUCCESS on success, or an error code. |
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_algorithm_t;
Enumeration of different key exchange algorithms.
Unknown key-exchange algorithm. | |
RSA key-exchange algorithm. | |
DHE-DSS key-exchange algorithm. | |
DHE-RSA key-exchange algorithm. | |
Anon-DH key-exchange algorithm. | |
SRP key-exchange algorithm. | |
RSA-EXPORT key-exchange algorithm (defunc). | |
SRP-RSA key-exchange algorithm. | |
SRP-DSS key-exchange algorithm. | |
PSK key-exchange algorithm. | |
DHE-PSK key-exchange algorithm. | |
Anon-ECDH key-exchange algorithm. | |
ECDHE-RSA key-exchange algorithm. | |
ECDHE-ECDSA key-exchange algorithm. | |
ECDHE-PSK key-exchange algorithm. |
gnutls_kx_algorithm_t gnutls_kx_get (gnutls_session_t session
);
Get currently used key exchange algorithm.
|
is a gnutls_session_t structure. |
Returns : |
the key exchange algorithm used in the last handshake, a gnutls_kx_algorithm_t value. |
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.
|
is a KX name |
Returns : |
an id of the specified KX algorithm, or GNUTLS_KX_UNKNOWN
on error. |
const char * gnutls_kx_get_name (gnutls_kx_algorithm_t algorithm
);
Convert a gnutls_kx_algorithm_t value to a string.
|
is a key exchange algorithm |
Returns : |
a pointer to a string that contains the name of the
specified key exchange algorithm, or NULL . |
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. |
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.
Unknown MAC algorithm. | |
NULL MAC algorithm (empty output). | |
HMAC-MD5 algorithm. | |
HMAC-SHA-1 algorithm. | |
HMAC-RMD160 algorithm. | |
HMAC-MD2 algorithm. | |
HMAC-SHA-256 algorithm. | |
HMAC-SHA-384 algorithm. | |
HMAC-SHA-512 algorithm. | |
HMAC-SHA-224 algorithm. | |
MAC implicit through AEAD cipher. | |
gnutls_mac_algorithm_t gnutls_mac_get (gnutls_session_t session
);
Get currently used MAC algorithm.
|
is a gnutls_session_t structure. |
Returns : |
the currently used mac algorithm, a gnutls_mac_algorithm_t value. |
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.
|
is a MAC algorithm name |
Returns : |
a gnutls_mac_algorithm_t id of the specified MAC
algorithm string, or GNUTLS_MAC_UNKNOWN on failures. |
size_t gnutls_mac_get_key_size (gnutls_mac_algorithm_t algorithm
);
Returns the size of the MAC key used in TLS.
|
is an encryption algorithm |
Returns : |
length (in bytes) of the given MAC key size, or 0 if the given MAC algorithm is invalid. |
const char * gnutls_mac_get_name (gnutls_mac_algorithm_t algorithm
);
Convert a gnutls_mac_algorithm_t value to a string.
|
is a MAC algorithm |
Returns : |
a string that contains the name of the specified MAC
algorithm, or NULL . |
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. |
typedef enum { GNUTLS_OPENPGP_CERT = 0, GNUTLS_OPENPGP_CERT_FINGERPRINT = 1 } gnutls_openpgp_crt_status_t;
Enumeration of ways to send OpenPGP certificate.
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.
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.
|
is a GnuTLS error code, a negative error code |
const char * gnutls_pk_algorithm_get_name (gnutls_pk_algorithm_t algorithm
);
Convert a gnutls_pk_algorithm_t value to a string.
|
is a pk algorithm |
Returns : |
a string that contains the name of the specified public
key algorithm, or NULL . |
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_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.
|
is a public key algorithm |
|
is the number of bits |
Returns : |
The security parameter. |
Since 2.12.0
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
.
|
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
const char * gnutls_pk_get_name (gnutls_pk_algorithm_t algorithm
);
Convert a gnutls_pk_algorithm_t value to a string.
|
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
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_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.
|
is a public key algorithm |
|
a hash algorithm |
Returns : |
return a gnutls_sign_algorithm_t value, or GNUTLS_SIGN_UNKNOWN on error. |
gnutls_protocol_t gnutls_protocol_get_id (const char *name
);
The names are compared in a case insensitive way.
|
is a protocol name |
Returns : |
an id of the specified protocol, or
GNUTLS_VERSION_UNKNOWN on error. |
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. |
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.
SSL version 3.0. | |
TLS version 1.0. | |
Same as GNUTLS_TLS1_0 .
|
|
TLS version 1.1. | |
TLS version 1.2. | |
DTLS version 0.9 (Cisco AnyConnect / OpenSSL 0.9.8e). | |
DTLS version 1.0. | |
DTLS version 1.2. | |
Unknown SSL/TLS version. |
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()
.
|
is a gnutls_session_t structure. |
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.
|
is a gnutls_session_t structure. |
Returns : |
GNUTLS_E_SUCCESS on success, otherwise a negative error code. |
const char * gnutls_sec_param_get_name (gnutls_sec_param_t param
);
Convert a gnutls_sec_param_t value to a string.
|
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
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.
Less than 42 bits of security | |
42 bits of security | |
64 bits of security | |
72 bits of security | |
Cannot be known | |
80 bits of security | |
96 bits of security | |
112 bits of security | |
128 bits of security | |
192 bits of security |
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
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.
|
is a gnutls_session_t structure. |
Returns : |
The sign algorithm or GNUTLS_SIGN_UNKNOWN . |
Since 3.1.1
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.
|
is a gnutls_session_t structure. |
|
is an index of the signature algorithm to return |
|
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
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.
Unknown signature algorithm. | |
Digital signature algorithm RSA with SHA-1 | |
Same as GNUTLS_SIGN_RSA_SHA1 .
|
|
Digital signature algorithm DSA with SHA-1 | |
Same as GNUTLS_SIGN_DSA_SHA1 .
|
|
Digital signature algorithm RSA with MD5. | |
Digital signature algorithm RSA with MD2. | |
Digital signature algorithm RSA with RMD-160. | |
Digital signature algorithm RSA with SHA-256. | |
Digital signature algorithm RSA with SHA-384. | |
Digital signature algorithm RSA with SHA-512. | |
Digital signature algorithm RSA with SHA-224. | |
Digital signature algorithm DSA with SHA-224 | |
Digital signature algorithm DSA with SHA-256 | |
ECDSA with SHA1. | |
Digital signature algorithm ECDSA with SHA-224. | |
Digital signature algorithm ECDSA with SHA-256. | |
Digital signature algorithm ECDSA with SHA-384. | |
Digital signature algorithm ECDSA with SHA-512. |
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.
|
is a signature algorithm |
Returns : |
return a gnutls_digest_algorithm_t value, or GNUTLS_DIG_UNKNOWN on error. |
Since 3.1.1
gnutls_sign_algorithm_t gnutls_sign_get_id (const char *name
);
The names are compared in a case insensitive way.
|
is a sign algorithm name |
Returns : |
return a gnutls_sign_algorithm_t value corresponding to
the specified algorithm, or GNUTLS_SIGN_UNKNOWN on error. |
const char * gnutls_sign_get_name (gnutls_sign_algorithm_t algorithm
);
Convert a gnutls_sign_algorithm_t value to a string.
|
is a sign algorithm |
Returns : |
a string that contains the name of the specified sign
algorithm, or NULL . |
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.
|
is a signature algorithm |
Returns : |
return a gnutls_pk_algorithm_t value, or GNUTLS_PK_UNKNOWN on error. |
Since 3.1.1
int gnutls_sign_is_secure (gnutls_sign_algorithm_t algorithm
);
|
is a sign algorithm |
Returns : |
Non-zero if the provided signature algorithm is considered to be secure. |
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. |
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.
|
is a GnuTLS error code, a negative error code |
Returns : |
A string explaining the GnuTLS error message. |
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".
|
is an error returned by a gnutls function. |
Returns : |
A string corresponding to the symbol name of the error code. |
Since 2.6.0
typedef enum { GNUTLS_X509_FMT_DER = 0, GNUTLS_X509_FMT_PEM = 1 } gnutls_x509_crt_fmt_t;
Enumeration of different certificate encoding formats.