| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| 9.1 Core Functions | ||
| 9.2 X.509 Certificate Functions | ||
| 9.3 GnuTLS-extra Functions | ||
| 9.4 OpenPGP Functions | ||
| 9.5 TLS Inner Application (TLS/IA) Functions | ||
| 9.6 Error Codes and Descriptions |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The prototypes for the following functions lie in `gnutls/gnutls.h'.
alert: is an alert number gnutls_session_t structure.
This function will return a string that describes the given alert
number, or NULL. See gnutls_alert_get().
Returns: string corresponding to gnutls_alert_description_t value.
session: is a gnutls_session_t structure.
This function will return the last alert number received. This
function should be called if GNUTLS_E_WARNING_ALERT_RECEIVED or
GNUTLS_E_FATAL_ALERT_RECEIVED has been returned by a gnutls
function. The peer may send alerts if he thinks some things were
not right. Check gnutls.h for the available alert descriptions.
If no alert has been received the returned value is undefined.
Returns: returns the last alert received, a
gnutls_alert_description_t value.
session: is a gnutls_session_t structure.
err: is an integer
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.
Returns: On success, GNUTLS_E_SUCCESS (0) is returned, otherwise
an error code is returned.
session: is a gnutls_session_t structure.
level: is the level of the alert
desc: is the alert description
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.
Returns: On success, GNUTLS_E_SUCCESS (0) is returned, otherwise
an error code is returned.
sc: is a pointer to an gnutls_anon_client_credentials_t structure.
This structure is complex enough to manipulate directly thus this helper function is provided in order to allocate it.
Returns: GNUTLS_E_SUCCESS on success, or an error code.
sc: is a pointer to an gnutls_anon_server_credentials_t structure.
This structure is complex enough to manipulate directly thus this helper function is provided in order to allocate it.
Returns: GNUTLS_E_SUCCESS on success, or an error code.
sc: is an gnutls_anon_client_credentials_t structure.
This structure is complex enough to manipulate directly thus this helper function is provided in order to free (deallocate) it.
sc: is an gnutls_anon_server_credentials_t structure.
This structure is complex enough to manipulate directly thus this helper function is provided in order to free (deallocate) it.
res: is a gnutls_anon_server_credentials_t structure
func: is the function to be called
This function will set a callback in order for the server to get the diffie hellman or RSA parameters for anonymous authentication. The callback should return zero on success.
res: is a gnutls_anon_server_credentials_t structure
dh_params: is a structure that holds diffie hellman parameters.
This function will set the diffie hellman parameters for an anonymous server to use. These parameters will be used in Anonymous Diffie Hellman cipher suites.
res: is a gnutls_certificate_credentials_t structure
func: is the function to be called
This function will set a callback in order for the server to get the diffie hellman parameters for anonymous authentication. The callback should return zero on success.
session: is a gnutls_session_t structure.
Returns the type of credentials that were used for client authentication. The returned information is to be used to distinguish the function used to access authentication data.
Returns: The type of credentials for the client authentication
schema, an gnutls_credentials_type_t type.
session: is a gnutls_session_t structure.
Returns type of credentials for the current authentication schema. The returned information is to be used to distinguish the function used to access authentication data.
Eg. for CERTIFICATE ciphersuites (key exchange algorithms: KX_RSA, KX_DHE_RSA), the same function are to be used to access the authentication data.
Returns: The type of credentials for the current authentication
schema, an gnutls_credentials_type_t type.
session: is a gnutls_session_t structure.
Returns the type of credentials that were used for server authentication. The returned information is to be used to distinguish the function used to access authentication data.
Returns: The type of credentials for the server authentication
schema, an gnutls_credentials_type_t type.
session: is a gnutls_session_t structure.
how: is an integer
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 then the TLS connection gets
terminated and further receives and sends will be disallowed. If
the return value is zero you may continue using the connection.
GNUTLS_SHUT_RDWR actually sends an alert containing a close
request and waits for the peer to reply with the same message.
In case of GNUTLS_SHUT_WR then the TLS connection 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, thus causing a transmission error to the peer. This error cannot be distinguished from a malicious party prematurely terminating the session, thus this behavior is not recommended.
This function may also return GNUTLS_E_AGAIN or
GNUTLS_E_INTERRUPTED; cf. gnutls_record_get_direction().
Returns: GNUTLS_E_SUCCESS on success, or an error code, see
function documentation for entire semantics.
session: is a gnutls session
This function will return the peer's certificate activation time. This is the creation time for openpgp keys.
Returns: (time_t)-1 on error.
Deprecated: gnutls_certificate_verify_peers2() now verifies activation times.
res: is a pointer to an gnutls_certificate_credentials_t structure.
This structure is complex enough to manipulate directly thus this helper function is provided in order to allocate it.
Returns: GNUTLS_E_SUCCESS on success, or an error code.
session: is a gnutls session
Get whether client certificate is requested or not.
Returns: 0 if the peer (server) did not request client authentication or 1 otherwise, or a negative value in case of error.
cred: is a gnutls_certificate_credentials_t structure.
func: is the callback function
This function sets a callback to be called in order to retrieve the certificate to be used in the handshake. The callback's function prototype is: int (*callback)(gnutls_session_t, const gnutls_datum_t* req_ca_dn, int nreqs, const gnutls_pk_algorithm_t* pk_algos, int pk_algos_length, gnutls_retr_st* st);
req_ca_cert is only used in X.509 certificates.
Contains a list with the CA names that the server considers trusted.
Normally we should send a certificate that is signed
by one of these CAs. These names are DER encoded. To get a more
meaningful value use the function gnutls_x509_rdn_get().
pk_algos contains a list with server's acceptable signature algorithms.
The certificate returned should support the server's given algorithms.
st should contain the certificates and private keys.
If the callback function is provided then gnutls will call it, in the handshake, after the certificate request message has been received.
The callback function should set the certificate list to be sent, and return 0 on success. If no certificate was selected then the number of certificates should be set to zero. The value (-1) indicates error and the handshake will be terminated.
session: is a gnutls session
This function will return the peer's certificate expiration time.
Returns: (time_t)-1 on error.
Deprecated: gnutls_certificate_verify_peers2() now verifies expiration times.
sc: is an gnutls_certificate_credentials_t structure.
This function will delete all the CA name in the given credentials. Clients may call this to save some memory since in client side the CA names are not used.
CA names are used by servers to advertize the CAs they support to clients.
sc: is an gnutls_certificate_credentials_t structure.
This function will delete all the CAs associated
with the given credentials. Servers that do not use
gnutls_certificate_verify_peers2() may call this to
save some memory.
sc: is an gnutls_certificate_credentials_t structure.
This structure is complex enough to manipulate directly thus this helper function is provided in order to free (deallocate) it.
This function does not free any temporary parameters associated with this structure (ie RSA and DH parameters are not freed by this function).
sc: is an gnutls_certificate_credentials_t structure.
This function will delete all the CRLs associated with the given credentials.
sc: is an gnutls_certificate_credentials_t structure.
This function will delete all the keys and the certificates associated with the given credentials. This function must not be called when a TLS negotiation that uses the credentials is in progress.
sc: is an gnutls_certificate_credentials_t structure.
This function will export the OpenPGP keyring associated with the given credentials.
Since: 2.4.0
session: is a gnutls session
Get the certificate as sent to the peer, in the last handshake. These certificates are in raw format. In X.509 this is a certificate list. In OpenPGP this is a single certificate.
Returns: return a pointer to a gnutls_datum_t containing our
certificates, or NULL in case of an error or if no certificate
was used.
session: is a gnutls session
list_size: is the length of the certificate list
Get the peer's raw certificate (chain) as sent by the peer. These certificates are in raw format (DER encoded for X.509). In case of a X.509 then a certificate list may be present. The first certificate in the list is the peer's certificate, following the issuer's certificate, then the issuer's issuer etc.
In case of OpenPGP keys a single key will be returned in raw format.
Returns: return a pointer to a gnutls_datum_t containing our
certificates, or NULL in case of an error or if no certificate
was used.
sc: is an gnutls_certificate_credentials_t structure.
x509_ca_list: will point to the CA list. Should be treated as constant
ncas: the number of CAs
This function will export all the CAs associated with the given credentials.
Since: 2.4.0
sc: is an gnutls_certificate_credentials_t structure.
x509_crl_list: the exported CRL list. Should be treated as constant
ncrls: the number of exported CRLs
This function will export all the CRLs associated with the given credentials.
Since: 2.4.0
session: is a pointer to a gnutls_session_t structure.
status: is 0 or 1
If status is non zero, this function will order gnutls not to send the rdnSequence in the certificate request message. That is the server will not advertize it's trusted CAs to the peer. If status is zero then the default behaviour will take effect, which is to advertize the server's trusted CAs.
This function has no effect in clients, and in authentication methods other than certificate with X.509 certificates.
session: is an gnutls_session_t structure.
req: is one of GNUTLS_CERT_REQUEST, GNUTLS_CERT_REQUIRE
This function specifies if we (in case of a server) are going
to send a certificate request message to the client. If req
is GNUTLS_CERT_REQUIRE then the server will return an error if
the peer does not provide a certificate. If you do not
call this function then the client will not be asked to
send a certificate.
cred: is a gnutls_certificate_credentials_t structure.
func: is the callback function
This function sets a callback to be called in order to retrieve the certificate to be used in the handshake. The callback's function prototype is: int (*callback)(gnutls_session_t, gnutls_retr_st* st);
st should contain the certificates and private keys.
If the callback function is provided then gnutls will call it, in the handshake, after the certificate request message has been received.
The callback function should set the certificate list to be sent, and return 0 on success. The value (-1) indicates error and the handshake will be terminated.
res: is a gnutls_certificate_credentials_t structure
dh_params: is a structure that holds diffie hellman parameters.
This function will set the diffie hellman parameters for a certificate server to use. These parameters will be used in Ephemeral Diffie Hellman cipher suites. Note that only a pointer to the parameters are stored in the certificate handle, so if you deallocate the parameters before the certificate is deallocated, you must change the parameters stored in the certificate first.
res: is a gnutls_certificate_credentials_t structure
func: is the function to be called
This function will set a callback in order for the server to get the diffie hellman or RSA parameters for certificate authentication. The callback should return zero on success.
res: is a gnutls_certificate_credentials_t structure
rsa_params: is a structure that holds temporary RSA parameters.
This function will set the temporary RSA parameters for a certificate server to use. These parameters will be used in RSA-EXPORT cipher suites.
res: is a gnutls_certificate_credentials_t structure
flags: are the flags
This function will set the flags to be used at verification of the
certificates. Flags must be OR of the
gnutls_certificate_verify_flags enumerations.
res: is a gnutls_certificate_credentials structure
max_bits: is the number of bits of an acceptable certificate (default 8200)
max_depth: is maximum depth of the verification of a certificate chain (default 5)
This function will set some upper limits for the default
verification function, gnutls_certificate_verify_peers2(), to avoid
denial of service attacks. You can set them to zero to disable
limits.
res: is an gnutls_certificate_credentials_t structure.
crlfile: is a file containing the list of verified CRLs (DER or PEM list)
type: is PEM or DER
This function adds the trusted CRLs in order to verify client or server
certificates. In case of a client this is not required
to be called if the certificates are not verified using
gnutls_certificate_verify_peers2().
This function may be called multiple times.
Returns: number of CRLs processed or a negative value on error.
res: is an gnutls_certificate_credentials_t structure.
CRL: is a list of trusted CRLs. They should have been verified before.
type: is DER or PEM
This function adds the trusted CRLs in order to verify client or
server certificates. In case of a client this is not required to
be called if the certificates are not verified using
gnutls_certificate_verify_peers2(). This function may be called
multiple times.
Returns: number of CRLs processed, or a negative value on error.
res: is an gnutls_certificate_credentials_t structure.
crl_list: is a list of trusted CRLs. They should have been verified before.
crl_list_size: holds the size of the crl_list
This function adds the trusted CRLs in order to verify client or
server certificates. In case of a client this is not required to
be called if the certificates are not verified using
gnutls_certificate_verify_peers2(). This function may be called
multiple times.
Returns: GNUTLS_E_SUCCESS on success, or an error code.
Since: 2.4.0
res: is an gnutls_certificate_credentials_t structure.
CERTFILE: is a file that containing the certificate list (path) for the specified private key, in PKCS7 format, or a list of certificates
KEYFILE: is a file that contains the private key
type: is PEM or DER
This function sets a certificate/private key pair in the gnutls_certificate_credentials_t structure. This function may be called more than once (in case multiple keys/certificates exist for the server).
Currently only PKCS-1 encoded RSA and DSA private keys are accepted by this function.
Returns: GNUTLS_E_SUCCESS on success, or an error code.
res: is an gnutls_certificate_credentials_t structure.
cert: contains a certificate list (path) for the specified private key
key: is the private key, or NULL
type: is PEM or DER
This function sets a certificate/private key pair in the gnutls_certificate_credentials_t structure. This function may be called more than once (in case multiple keys/certificates exist for the server).
Currently are supported: RSA PKCS-1 encoded private keys, DSA private keys.
DSA private keys are encoded the OpenSSL way, which is an ASN.1 DER sequence of 6 INTEGERs - version, p, q, g, pub, priv.
Note that the keyUsage (2.5.29.15) PKIX extension in X.509 certificates is supported. This means that certificates intended for signing cannot be used for ciphersuites that require encryption.
If the certificate and the private key are given in PEM encoding then the strings that hold their values must be null terminated.
The key may be NULL if you are using a sign callback, see
gnutls_sign_callback_set().
Returns: GNUTLS_E_SUCCESS on success, or an error code.
res: is an gnutls_certificate_credentials_t structure.
cert_list: contains a certificate list (path) for the specified private key
cert_list_size: holds the size of the certificate list
key: is a gnutls_x509_privkey_t key
This function sets a certificate/private key pair in the gnutls_certificate_credentials_t structure. This function may be called more than once (in case multiple keys/certificates exist for the server).
Returns: GNUTLS_E_SUCCESS on success, or an error code.
Since: 2.4.0
res: is an gnutls_certificate_credentials_t structure.
pkcs12file: filename of file containing PKCS12 blob.
type: is PEM or DER of the pkcs12file.
password: optional password used to decrypt PKCS12 file, bags and keys.
This function sets a certificate/private key pair and/or a CRL in the gnutls_certificate_credentials_t structure. This function may be called more than once (in case multiple keys/certificates exist for the server).
MAC: ed PKCS12 files are supported. Encrypted PKCS12 bags are
supported. Encrypted PKCS8 private keys are supported. However,
only password based security, and the same password for all
operations, are supported.
The private keys may be RSA PKCS1 or DSA private keys encoded in
the OpenSSL way.
PKCS12 file may contain many keys and/or certificates, and there
is no way to identify which key/certificate pair you want. You
should make sure the PKCS12 file only contain one key/certificate
pair and/or one CRL.
It is believed that the limitations of this function is acceptable for most usage, and that any more flexibility would introduce complexity that would make it harder to use this functionality at all.
Returns: GNUTLS_E_SUCCESS on success, or an error code.
res: is an gnutls_certificate_credentials_t structure.
cafile: is a file containing the list of trusted CAs (DER or PEM list)
type: is PEM or DER
This function adds the trusted CAs in order to verify client or
server certificates. In case of a client this is not required to
be called if the certificates are not verified using
gnutls_certificate_verify_peers2(). This function may be called
multiple times.
In case of a server the names of the CAs set here will be sent to
the client if a certificate request is sent. This can be disabled
using gnutls_certificate_send_x509_rdn_sequence().
Returns: number of certificates processed, or a negative value on error.
res: is an gnutls_certificate_credentials_t structure.
ca: is a list of trusted CAs or a DER certificate
type: is DER or PEM
This function adds the trusted CAs in order to verify client or
server certificates. In case of a client this is not required to
be called if the certificates are not verified using
gnutls_certificate_verify_peers2(). This function may be called
multiple times.
In case of a server the CAs set here will be sent to the client if
a certificate request is sent. This can be disabled using
gnutls_certificate_send_x509_rdn_sequence().
Returns: the number of certificates processed or a negative value on error.
res: is an gnutls_certificate_credentials_t structure.
ca_list: is a list of trusted CAs
ca_list_size: holds the size of the CA list
This function adds the trusted CAs in order to verify client
or server certificates. In case of a client this is not required
to be called if the certificates are not verified using
gnutls_certificate_verify_peers2().
This function may be called multiple times.
In case of a server the CAs set here will be sent to the client if
a certificate request is sent. This can be disabled using
gnutls_certificate_send_x509_rdn_sequence().
Returns: GNUTLS_E_SUCCESS on success, or an error code.
Since: 2.4.0
name: is a certificate type name
The names are compared in a case insensitive way.
Returns: an gnutls_certificate_type_t for the specified in a
string certificate type, or GNUTLS_CRT_UNKNOWN on error.
type: is a certificate type
Convert a gnutls_certificate_type_t type to a string.
Returns: a string that contains the name of the specified
certificate type, or NULL in case of unknown types.
session: is a gnutls_session_t structure.
The certificate type is by default X.509, unless it is negotiated as a TLS extension.
Returns: the currently used gnutls_certificate_type_t certificate
type.
Get a list of certificate types. Note that to be able to use
OpenPGP certificates, you must link to libgnutls-extra and call
gnutls_global_init_extra().
Returns: a zero-terminated list of gnutls_certificate_type_t
integers indicating the available certificate types.
session: is a gnutls_session_t structure.
list: is a 0 terminated list of gnutls_certificate_type_t elements.
Sets the priority on the certificate types supported by gnutls. Priority is higher for elements specified before others. After specifying the types you want, you must append a 0. Note that the certificate type priority is set on the client. The server does not use the cert type priority except for disabling types that were not specified.
Returns: GNUTLS_E_SUCCESS on success, or an error code.
session: is a gnutls session
status: is the output of the verification
This function will try to verify the peer's certificate and return
its status (trusted, invalid etc.). The value of status should
be one or more of the gnutls_certificate_status_t enumerated
elements bitwise or'd. To avoid denial of service attacks some
default upper limits regarding the certificate key size and chain
size are set. To override them use
gnutls_certificate_set_verify_limits().
Note that you must also check the peer's name in order to check if the verified certificate belongs to the actual peer.
This is the same as gnutls_x509_crt_list_verify() and uses the
loaded CAs in the credentials as trusted CAs.
Note that some commonly used X.509 Certificate Authorities are
still using Version 1 certificates. If you want to accept them,
you need to call gnutls_certificate_set_verify_flags() with, e.g.,
GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT parameter.
Returns: a negative error code on error and zero on success.
session: is a gnutls session
This function will try to verify the peer's certificate and return its status (trusted, invalid etc.). However you must also check the peer's name in order to check if the verified certificate belongs to the actual peer.
The return value should be one or more of the gnutls_certificate_status_t enumerated elements bitwise or'd, or a negative value on error.
This is the same as gnutls_x509_crt_list_verify().
Deprecated: Use gnutls_certificate_verify_peers2() instead.
req_version: the version to check
Check that the version of the library is at minimum the requested one and return the version string; return NULL if the condition is not satisfied. If a NULL is passed to this function, no check is done, but the version string is simply returned.
See LIBGNUTLS_VERSION for a suitable req_version string.
Return value: Version string of run-time library, or NULL if the
run-time library does not meet the required version number. If
NULL is passed to this function no check is done and only the
version string is returned.
name: is a MAC algorithm name
The names are compared in a case insensitive way.
Returns: return a gnutls_cipher_algorithm_t value corresponding to
the specified cipher, or GNUTLS_CIPHER_UNKNOWN on error.
algorithm: is an encryption algorithm
Get key size for cipher.
Returns: length (in bytes) of the given cipher's key size, or 0 if the given cipher is invalid.
algorithm: is an encryption algorithm
Convert a gnutls_cipher_algorithm_t type to a string.
Returns: a pointer to a string that contains the name of the
specified cipher, or NULL.
session: is a gnutls_session_t structure.
Get currently used cipher.
Returns: the currently used cipher, an gnutls_cipher_algorithm_t
type.
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., PKCS8 or similar).
Returns: a zero-terminated list of gnutls_cipher_algorithm_t
integers indicating the available ciphers.
session: is a gnutls_session_t structure.
list: is a 0 terminated list of gnutls_cipher_algorithm_t elements.
Sets the priority on the ciphers supported by gnutls. Priority is higher for elements specified before others. After specifying the ciphers you want, you must append a 0. Note that the priority is set on the client. The server does not use the algorithm's priority except for disabling algorithms that were not specified.
Returns: GNUTLS_E_SUCCESS on success, or an error code.
kx_algorithm: is a Key exchange algorithm
cipher_algorithm: is a cipher algorithm
mac_algorithm: is a MAC algorithm
Note that the full cipher suite name must be prepended by TLS or SSL depending of the protocol in use.
Returns: a string that contains the name of a TLS cipher suite,
specified by the given algorithms, or 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.
version: output variable indicating TLS protocol version, or NULL.
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.
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.
name: is a compression method name
The names are compared in a case insensitive way.
Returns: an id of the specified in a string compression method, or
GNUTLS_COMP_UNKNOWN on error.
algorithm: is a Compression algorithm
Convert a gnutls_compression_method_t value to a string.
Returns: a pointer to a string that contains the name of the
specified compression algorithm, or NULL.
session: is a gnutls_session_t structure.
Get currently used compression algorithm.
Returns: the currently used compression method, a
gnutls_compression_method_t value.
Get a list of compression methods. Note that to be able to use LZO
compression, you must link to libgnutls-extra and call
gnutls_global_init_extra().
Returns: a zero-terminated list of gnutls_compression_method_t
integers indicating the available compression methods.
session: is a gnutls_session_t structure.
list: is a 0 terminated list of gnutls_compression_method_t elements.
Sets the priority on the compression algorithms supported by gnutls. Priority is higher for elements specified before others. After specifying the algorithms you want, you must append a 0. Note that the priority is set on the client. The server does not use the algorithm's priority except for disabling algorithms that were not specified.
TLS 1.0 does not define any compression algorithms except NULL. Other compression algorithms are to be considered as gnutls extensions.
Returns: GNUTLS_E_SUCCESS on success, or an error code.
session: is a gnutls_session_t structure.
Clears all the credentials previously set in this session.
session: is a gnutls_session_t structure.
type: is the type of the credentials
cred: is a pointer to a structure.
Sets the needed credentials for the specified type.
Eg username, password - or public and private keys etc.
The (void* cred) parameter is a structure that depends on the
specified type and on the current session (client or server).
[ In order to minimize memory usage, and share credentials between
several threads gnutls keeps a pointer to cred, and not the whole cred
structure. Thus you will have to keep the structure allocated until
you call gnutls_deinit(). ]
For GNUTLS_CRD_ANON cred should be gnutls_anon_client_credentials_t in case of a client. In case of a server it should be gnutls_anon_server_credentials_t.
For GNUTLS_CRD_SRP cred should be gnutls_srp_client_credentials_t in case of a client, and gnutls_srp_server_credentials_t, in case of a server.
For GNUTLS_CRD_CERTIFICATE cred should be gnutls_certificate_credentials_t.
priority: is the priority of the interface
version: should be set to GNUTLS_CRYPTO_API_VERSION
s: is a structure holding new interface's data
This function will register an interface for gnutls to operate on big integers. Any interface registered will override the included interface. The interface with the lowest priority will be used by gnutls.
Note that the bigint interface must interoperate with the public
key interface. Thus if this interface is updated the
gnutls_crypto_pk_register() should also be used.
This function should be called before gnutls_global_init().
For simplicity you can use the convenience gnutls_crypto_bigint_register()
macro.
Returns: GNUTLS_E_SUCCESS on success, otherwise an error.
Since: 2.6.0
priority: is the priority of the cipher interface
version: should be set to GNUTLS_CRYPTO_API_VERSION
s: is a structure holding new interface's data
This function will register a cipher interface to be used by gnutls. Any interface registered will override the included engine and by convention kernel implemented interfaces should have priority of 90. The interface with the lowest priority will be used by gnutls.
This function should be called before gnutls_global_init().
For simplicity you can use the convenience
gnutls_crypto_cipher_register() macro.
Returns: GNUTLS_E_SUCCESS on success, otherwise an error.
Since: 2.6.0
priority: is the priority of the digest interface
version: should be set to GNUTLS_CRYPTO_API_VERSION
s: is a structure holding new interface's data
This function will register a digest interface to be used by gnutls. Any interface registered will override the included engine and by convention kernel implemented interfaces should have priority of 90. The interface with the lowest priority will be used by gnutls.
This function should be called before gnutls_global_init().
For simplicity you can use the convenience
gnutls_crypto_digest_register() macro.
Returns: GNUTLS_E_SUCCESS on success, otherwise an error.
Since: 2.6.0
priority: is the priority of the mac interface
version: should be set to GNUTLS_CRYPTO_API_VERSION
s: is a structure holding new interface's data
This function will register a mac interface to be used by gnutls. Any interface registered will override the included engine and by convention kernel implemented interfaces should have priority of 90. The interface with the lowest priority will be used by gnutls.
This function should be called before gnutls_global_init().
For simplicity you can use the convenience
gnutls_crypto_mac_register() macro.
Returns: GNUTLS_E_SUCCESS on success, otherwise an error.
Since: 2.6.0
priority: is the priority of the interface
version: should be set to GNUTLS_CRYPTO_API_VERSION
s: is a structure holding new interface's data
This function will register an interface for gnutls to operate on public key operations. Any interface registered will override the included interface. The interface with the lowest priority will be used by gnutls.
Note that the bigint interface must interoperate with the bigint
interface. Thus if this interface is updated the
gnutls_crypto_bigint_register() should also be used.
This function should be called before gnutls_global_init().
For simplicity you can use the convenience gnutls_crypto_pk_register()
macro.
Returns: GNUTLS_E_SUCCESS on success, otherwise an error.
Since: 2.6.0
priority: is the priority of the generator
version: should be set to GNUTLS_CRYPTO_API_VERSION
s: is a structure holding new generator's data
This function will register a random generator to be used by gnutls. Any generator registered will override the included generator and by convention kernel implemented generators have priority of 90. The generator with the lowest priority will be used by gnutls.
This function should be called before gnutls_global_init().
For simplicity you can use the convenience
gnutls_crypto_rnd_register() macro.
Returns: GNUTLS_E_SUCCESS on success, otherwise an error.
Since: 2.6.0
algorithm: is the gnutls algorithm identifier
priority: is the priority of the algorithm
version: should be set to GNUTLS_CRYPTO_API_VERSION
s: is a structure holding new cipher's data
This function will register a cipher algorithm to be used by gnutls. Any algorithm registered will override the included algorithms and by convention kernel implemented algorithms have priority of 90. The algorithm with the lowest priority will be used by gnutls.
This function should be called before gnutls_global_init().
For simplicity you can use the convenience
gnutls_crypto_single_cipher_register() macro.
Returns: GNUTLS_E_SUCCESS on success, otherwise an error.
Since: 2.6.0
algorithm: is the gnutls algorithm identifier
priority: is the priority of the algorithm
version: should be set to GNUTLS_CRYPTO_API_VERSION
s: is a structure holding new algorithms's data
This function will register a digest (hash) algorithm to be used by gnutls. Any algorithm registered will override the included algorithms and by convention kernel implemented algorithms have priority of 90. The algorithm with the lowest priority will be used by gnutls.
This function should be called before gnutls_global_init().
For simplicity you can use the convenience
gnutls_crypto_single_digest_register() macro.
Returns: GNUTLS_E_SUCCESS on success, otherwise an error.
Since: 2.6.0
algorithm: is the gnutls algorithm identifier
priority: is the priority of the algorithm
version: should be set to GNUTLS_CRYPTO_API_VERSION
s: is a structure holding new algorithms's data
This function will register a MAC algorithm to be used by gnutls. Any algorithm registered will override the included algorithms and by convention kernel implemented algorithms have priority of 90. The algorithm with the lowest priority will be used by gnutls.
This function should be called before gnutls_global_init().
For simplicity you can use the convenience
gnutls_crypto_single_mac_register() macro.
Returns: GNUTLS_E_SUCCESS on success, otherwise an error.
Since: 2.6.0
session: is a gnutls_session_t structure.
session_entry: is the session data (not key)
Check if database entry has expired. This function is to be used when you want to clear unnesessary session which occupy space in your backend.
Returns: Returns GNUTLS_E_EXPIRED, if the database entry has
expired or 0 otherwise.
session: is a gnutls_session_t structure.
Get db function pointer.
Returns: the pointer that will be sent to db store, retrieve and delete functions, as the first argument.
session: is a gnutls_session_t structure.
This function will remove the current session data from the
session database. This will prevent future handshakes reusing
these session data. This function should be called if a session
was terminated abnormally, and before gnutls_deinit() is called.
Normally gnutls_deinit() will remove abnormally terminated
sessions.
session: is a gnutls_session_t structure.
seconds: is the number of seconds.
Set the expiration time for resumed sessions. The default is 3600 (one hour) at the time writing this.
session: is a gnutls_session_t structure.
ptr: is the pointer
Sets the pointer that will be provided to db store, retrieve and delete functions, as the first argument.
session: is a gnutls_session_t structure.
rem_func: is the function.
Sets the function that will be used to remove data from the resumed sessions database. This function must return 0 on success.
The first argument to rem_func() will be null unless
gnutls_db_set_ptr() has been called.
session: is a gnutls_session_t structure.
retr_func: is the function.
Sets the function that will be used to retrieve data from the resumed sessions database. This function must return a gnutls_datum_t containing the data on success, or a gnutls_datum_t containing null and 0 on failure.
The datum's data must be allocated using the function
gnutls_malloc().
The first argument to retr_func() will be null unless
gnutls_db_set_ptr() has been called.
session: is a gnutls_session_t structure.
store_func: is the function
Sets the function that will be used to store data from the resumed sessions database. This function must remove 0 on success.
The first argument to store_func() will be null unless
gnutls_db_set_ptr() has been called.
session: is a gnutls_session_t structure.
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
raw_gen: will hold the generator.
raw_prime: will hold the prime.
This function will return the group parameters used in the last
Diffie Hellman authentication with the peer. These are the prime
and the generator used. This function should be used for both
anonymous and ephemeral diffie Hellman. The output parameters must
be freed with gnutls_free().
Returns: On success, GNUTLS_E_SUCCESS (0) is returned, otherwise
an error code is returned.
session: is a gnutls session
Get the Diffie-Hellman public key bit size. Can be used for both anonymous and ephemeral diffie Hellman.
Returns: the public key bit size used in the last Diffie Hellman authentication with the peer, or a negative value in case of error.
session: is a gnutls session
This function will return the bits of the prime used in the last Diffie Hellman authentication with the peer. Should be used for both anonymous and ephemeral diffie Hellman.
Returns: On success, GNUTLS_E_SUCCESS (0) is returned, otherwise
an error code is returned.
session: is a gnutls session
raw_key: will hold the public key.
This function will return the peer's public key used in the last
Diffie Hellman authentication. This function should be used for
both anonymous and ephemeral diffie Hellman. The output
parameters must be freed with gnutls_free().
Returns: On success, GNUTLS_E_SUCCESS (0) is returned, otherwise
an error code is returned.
session: is a gnutls session
This function will return the bits used in the last Diffie Hellman authentication with the peer. Should be used for both anonymous and ephemeral diffie Hellman.
Returns: On success, GNUTLS_E_SUCCESS (0) is returned, otherwise
an error code is returned.
dst: Is the destination structure, which should be initialized.
src: Is the source structure
This function will copy the DH parameters structure from source to destination.
dh_params: Is a structure that holds the prime numbers
This function will deinitialize the DH parameters structure.
params: Holds the DH parameters
format: the format of output params. One of PEM or DER.
params_data: will contain a PKCS3 DHParams structure PEM or DER encoded
params_data_size: holds the size of params_data (and will be replaced by the actual size of parameters)
This function will export the given dh parameters to a PKCS3 DHParams structure. This is the format generated by "openssl dhparam" tool. If the buffer provided is not long enough to hold the output, then GNUTLS_E_SHORT_MEMORY_BUFFER will be returned.
If the structure is PEM encoded, it will have a header of "BEGIN DH PARAMETERS".
In case of failure a negative value will be returned, and 0 on success.
params: Holds the DH parameters
prime: will hold the new prime
generator: will hold the new generator
bits: if non null will hold is the prime's number of bits
This function will export the pair of prime and generator for use in
the Diffie-Hellman key exchange. The new parameters will be allocated using
gnutls_malloc() and will be stored in the appropriate datum.
params: Is the structure that the DH parameters will be stored
bits: is the prime's number of bits
This function will generate a new pair of prime and generator for use in
the Diffie-Hellman key exchange. The new parameters will be allocated using
gnutls_malloc() and will be stored in the appropriate datum.
This function is normally slow.
Note that the bits value should be one of 768, 1024, 2048, 3072 or 4096. Also note that the DH parameters are only useful to servers. Since clients use the parameters sent by the server, it's of no use to call this in client side.
params: A structure where the parameters will be copied to
pkcs3_params: should contain a PKCS3 DHParams structure PEM or DER encoded
format: the format of params. PEM or DER.
This function will extract the DHParams found in a PKCS3 formatted structure. This is the format generated by "openssl dhparam" tool.
If the structure is PEM encoded, it should have a header of "BEGIN DH PARAMETERS".
In case of failure a negative value will be returned, and 0 on success.
dh_params: Is a structure that will hold the prime numbers
prime: holds the new prime
generator: holds the new generator
This function will replace the pair of prime and generator for use in the Diffie-Hellman key exchange. The new parameters should be stored in the appropriate gnutls_datum.
dh_params: Is a structure that will hold the prime numbers
This function will initialize the DH parameters structure.
session: is a gnutls_session_t structure.
bits: is the number of bits
This function sets the number of bits, for use in an Diffie Hellman key exchange. This is used both in DH ephemeral and DH anonymous cipher suites. This will set the minimum size of the prime that will be used for the handshake.
In the client side it sets the minimum accepted number of bits. If
a server sends a prime with less bits than that
GNUTLS_E_DH_PRIME_UNACCEPTABLE will be returned by the handshake.
error: is a GnuTLS error code, a negative value
If a GnuTLS function returns a negative value you may feed that value to this function to see if the error condition is fatal.
Note that you may want to check the error code manually, since some non-fatal errors to the protocol may be fatal for you program.
This function is only useful if you are dealing with errors from the record layer or the handshake layer.
Returns: 1 if the error code is fatal, for positive error values,
0 is returned. For unknown error values, -1 is returned.
err: is a negative integer
level: the alert level will be stored there
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.
Returns: the alert code to use for a particular error code.
type: the 16-bit integer referring to the extension type
name: human printable name of the extension used for debugging
parse_type: either GNUTLS_EXT_TLS or GNUTLS_EXT_APPLICATION.
recv_func: a function to receive extension data
send_func: a function to send extension data
This function is used to register a new TLS extension handler.
Returns: GNUTLS_E_SUCCESS on success, or an error code.
Since: 2.6.0
algo: is a digest algorithm
data: is the data
result: is the place where the result will be copied (may be null).
result_size: should hold the size of the result. The actual size of the returned result will also be copied there.
This function will calculate a fingerprint (actually a hash), of the given data. The result is not printable data. You should convert it to hex, or to something else printable.
This is the usual way to calculate a fingerprint of an X.509 DER encoded certificate. Note however that the fingerprint of an OpenPGP is not just a hash and cannot be calculated with this function.
Returns: On success, GNUTLS_E_SUCCESS (0) is returned, otherwise
an error code is returned.
This function will free data pointed by ptr.
The deallocation function used is the one set by gnutls_global_set_mem_functions().
This function deinitializes the global data, that were initialized
using gnutls_global_init().
Note! This function is not thread safe. See the discussion for
gnutls_global_init() for more information.
This function initializes the global data to defaults. Every
gnutls application has a global data which holds common parameters
shared by gnutls session structures. You should call
gnutls_global_deinit() when gnutls usage is no longer needed
Note that this function will also initialize libgcrypt, if it has not been initialized before. Thus if you want to manually initialize libgcrypt you must do it before calling this function. This is useful in cases you want to disable libgcrypt's internal lockings etc.
This function increment a global counter, so that
gnutls_global_deinit() only releases resources when it has been
called as many times as gnutls_global_init(). This is useful when
GnuTLS is used by more than one library in an application. This
function can be called many times, but will only do something the
first time.
Note! This function is not thread safe. If two threads call this function simultaneously, they can cause a race between checking the global counter and incrementing it, causing both threads to execute the library initialization code. That would lead to a memory leak. To handle this, your application could invoke this function after aquiring a thread mutex. To ignore the potential memory leak is also an option.
Returns: On success, GNUTLS_E_SUCCESS (zero) is returned,
otherwise an error code is returned.
log_func: it's a log function
This is the function where you set the logging function gnutls is going to use. This function only accepts a character array. Normally you may not use this function since it is only used for debugging purposes.
gnutls_log_func is of the form, void (*gnutls_log_func)( int level, const char*);
level: it's an integer from 0 to 9.
This is the function that allows you to set the log level. The level is an integer between 0 and 9. Higher values mean more verbosity. The default value is 0. Larger values should only be used with care, since they may reveal sensitive information.
Use a log level over 10 to enable all debugging options.
alloc_func: it's the default memory allocation function. Like malloc().
secure_alloc_func: This is the memory allocation function that will be used for sensitive data.
is_secure_func: a function that returns 0 if the memory given is not secure. May be NULL.
realloc_func: A realloc function
free_func: The function that frees allocated data. Must accept a NULL pointer.
This is the function were you set the memory allocation functions gnutls
is going to use. By default the libc's allocation functions (malloc(), free()),
are used by gnutls, to allocate both sensitive and not sensitive data.
This function is provided to set the memory allocation functions to
something other than the defaults (ie the gcrypt allocation functions).
This function must be called before gnutls_global_init() is called.
session: is a gnutls_session_t structure.
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.
Returns: the last handshake message type received, a
gnutls_handshake_description_t.
session: is a gnutls_session_t structure.
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.
Returns: the last handshake message type sent, a
gnutls_handshake_description_t.
session: is a gnutls_session_t structure.
max: is the maximum number.
This function will set the maximum size of all handshake messages.
Handshakes over this size are rejected with
GNUTLS_E_HANDSHAKE_TOO_LARGE error code. The default value is
48kb which is typically large enough. Set this to 0 if you do not
want to set an upper limit.
The reason for restricting the handshake message sizes are to limit Denial of Service attacks.
func: is the function to be called
This function will set a callback to be called after the client hello has been received (callback valid in server side only). This allows the server to adjust settings based on received extensions.
Those settings could be ciphersuites, requesting certificate, or anything else except for version negotiation (this is done before the hello message is parsed).
This callback must return 0 on success or a gnutls error code to terminate the handshake.
Warning: You should not use this function to terminate the handshake based on client input unless you know what you are doing. Before the handshake is finished there is no way to know if there is a man-in-the-middle attack being performed.
session: is a gnutls_session_t structure.
allow: is an integer (0 or 1)
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.
Unless this function is called with the option to allow (1), then no compression algorithms, like LZO. That is because these algorithms are not yet defined in any RFC or even internet draft.
Enabling the private ciphersuites when talking to other than gnutls servers and clients may cause interoperability problems.
session: is a gnutls_session_t structure.
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 later be resumed. 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.
Returns: GNUTLS_E_SUCCESS on success, otherwise an error.
hex_data: string with data in hex format
hex_size: size of hex data
bin_data: output array with binary data
bin_size: when calling *bin_size should hold size of bin_data,
on return will hold actual size of bin_data.
Convert a buffer with hex data to binary data.
Returns: GNUTLS_E_SUCCESS on success, otherwise an error.
Since: 2.4.0
hex_data: contain the encoded data
result: the place where decoded data will be copied
result_size: holds the size of the result
This function will decode the given encoded data, using the hex encoding used by PSK password files.
Note that hex_data should be null terminated.
Returns: GNUTLS_E_SHORT_MEMORY_BUFFER if the buffer given is not
long enough, or 0 on success.
data: contain the raw data
result: the place where hex data will be copied
result_size: holds the size of the result
This function will convert the given data to printable data, using the hex encoding, as used in the PSK password files.
Returns: GNUTLS_E_SHORT_MEMORY_BUFFER if the buffer given is not
long enough, or 0 on success.
session: is a pointer to a gnutls_session_t structure.
con_end: indicate if this session is to be used for server or client.
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 zero on success.
con_end can be one of GNUTLS_CLIENT and GNUTLS_SERVER.
Returns: GNUTLS_E_SUCCESS on success, or an error code.
name: is a KX name
Convert a string to a gnutls_kx_algorithm_t value. The names are
compared in a case insensitive way.
Returns: an id of the specified KX algorithm, or GNUTLS_KX_UNKNOWN
on error.
algorithm: is a key exchange algorithm
Convert a gnutls_kx_algorithm_t value to a string.
Returns: a pointer to a string that contains the name of the
specified key exchange algorithm, or NULL.
session: is a gnutls_session_t structure.
Get currently used key exchange algorithm.
Returns: the key exchange algorithm used in the last handshake, a
gnutls_kx_algorithm_t value.
Get a list of supported key exchange algorithms.
Returns: a zero-terminated list of gnutls_kx_algorithm_t integers
indicating the available key exchange algorithms.
session: is a gnutls_session_t structure.
list: is a 0 terminated list of gnutls_kx_algorithm_t elements.
Sets the priority on the key exchange algorithms supported by gnutls. Priority is higher for elements specified before others. After specifying the algorithms you want, you must append a 0. Note that the priority is set on the client. The server does not use the algorithm's priority except for disabling algorithms that were not specified.
Returns: GNUTLS_E_SUCCESS on success, or an error code.
name: is a MAC algorithm name
Convert a string to a gnutls_mac_algorithm_t value. The names are
compared in a case insensitive way.
Returns: an gnutls_mac_algorithm_tid of the specified in a string
MAC algorithm, or GNUTLS_MAC_UNKNOWN on failures.
algorithm: is an encryption algorithm
Get size of MAC key.
Returns: length (in bytes) of the given MAC key size, or 0 if the given MAC algorithm is invalid.
algorithm: is a MAC algorithm
Convert a gnutls_mac_algorithm_t value to a string.
Returns: a string that contains the name of the specified MAC
algorithm, or NULL.
session: is a gnutls_session_t structure.
Get currently used MAC algorithm.
Returns: the currently used mac algorithm, a
gnutls_mac_algorithm_t value.
Get a list of hash algorithms for use as MACs. Note that not necessarily all MACs are supported in TLS cipher suites. For example, MD2 is not supported as a cipher suite, but is supported for other purposes (e.g., X.509 signature verification or similar).
Returns: Return a zero-terminated list of gnutls_mac_algorithm_t
integers indicating the available MACs.
session: is a gnutls_session_t structure.
list: is a 0 terminated list of gnutls_mac_algorithm_t elements.
Sets the priority on the mac algorithms supported by gnutls. Priority is higher for elements specified before others. After specifying the algorithms you want, you must append a 0. Note that the priority is set on the client. The server does not use the algorithm's priority except for disabling algorithms that were not specified.
Returns: GNUTLS_E_SUCCESS on success, or an error code.
This function will allocate 's' bytes data, and return a pointer to memory. This function is supposed to be used by callbacks.
The allocation function used is the one set by gnutls_global_set_mem_functions().
session: is a pointer to a gnutls_session_t structure.
status: is one of GNUTLS_OPENPGP_CERT, or GNUTLS_OPENPGP_CERT_FINGERPRINT
This function will order gnutls to send the key fingerprint instead of the key in the initial handshake procedure. This should be used with care and only when there is indication or knowledge that the server can obtain the client's key.
session: is a gnutls_session_t structure.
len: length of Opaque PRF data to use in client.
data: Opaque PRF data to use in client.
Request that the client should attempt to negotiate the Opaque PRF Input TLS extension, using the given data as the client's Opaque PRF input.
The data is copied into the session context after this call, so you may de-allocate it immediately after calling this function.
session: is a gnutls_session_t structure.
cb: function pointer to Opaque PRF extension server callback.
userdata: hook passed to callback function for passing application state.
Request that the server should attempt to accept the Opaque PRF
Input TLS extension. If the client requests the extension, the
provided callback cb will be invoked. The callback must have the
following prototype:
int callback (gnutls_session_t session, void *userdata, size_t oprfi_len, const unsigned char *in_oprfi, unsigned char *out_oprfi);
The callback can inspect the client-provided data in the input parameters, and specify its own opaque prf input data in the output variable. The function must return 0 on success, otherwise the handshake will be aborted.
header: The PEM header (eg. CERTIFICATE)
b64_data: contains the encoded data
result: the place where decoded data lie
This function will decode the given encoded data. The decoded data will be allocated, and stored into result. If the header given is non null this function will search for "---BEGIN header" and decode only this part. Otherwise it will decode the first PEM packet found.
You should use gnutls_free() to free the returned data.
Returns: On success, GNUTLS_E_SUCCESS (0) is returned, otherwise
an error code is returned.
header: A null terminated string with the PEM header (eg. CERTIFICATE)
b64_data: contain the encoded data
result: the place where decoded data will be copied
result_size: holds the size of the result
This function will decode the given encoded data. If the header given is non null this function will search for "---BEGIN header" and decode only this part. Otherwise it will decode the first PEM packet found.
Returns: On success GNUTLS_E_SUCCESS (0) is returned,
GNUTLS_E_SHORT_MEMORY_BUFFER is returned if the buffer given is
not long enough, or 0 on success.
msg: is a message to be put in the encoded header
data: contains the raw data
result: will hold the newly allocated encoded data
This function will convert the given data to printable data, using the base64 encoding. This is the encoding used in PEM messages. This function will allocate the required memory to hold the encoded data.
You should use gnutls_free() to free the returned data.
Returns: On success, GNUTLS_E_SUCCESS (0) is returned, otherwise
an error code is returned.
msg: is a message to be put in the header
data: contain the raw data
result: the place where base64 data will be copied
result_size: holds the size of the result
This function will convert the given data to printable data, using the base64 encoding. This is the encoding used in PEM messages.
The output string will be null terminated, although the size will not include the terminating null.
Returns: On success GNUTLS_E_SUCCESS (0) is returned,
GNUTLS_E_SHORT_MEMORY_BUFFER is returned if the buffer given is
not long enough, or 0 on success.
error: is a GnuTLS error code, a negative value
This function is like perror(). The only difference is that it
accepts an error number returned by a gnutls function.
algorithm: is a pk algorithm
Convert a gnutls_pk_algorithm_t value to a string.
Returns: a string that contains the name of the specified public
key algorithm, or NULL.
name: is a string containing a public key algorithm 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.
Returns: an gnutls_pk_algorithm_tid of the specified in a string
public key algorithm, or GNUTLS_PK_UNKNOWN on failures.
Since: 2.6.0
algorithm: is a public key algorithm
Convert a gnutls_pk_algorithm_t value to a string.
Returns: a pointer to a string that contains the name of the
specified public key algorithm, or NULL.
Since: 2.6.0
Get a list of supported public key algorithms.
Returns: a zero-terminated list of gnutls_pk_algorithm_t integers
indicating the available ciphers.
Since: 2.6.0
session: is a gnutls_session_t structure.
label_size: length of the label variable.
label: label used in PRF computation, typically a short string.
seed_size: length of the seed variable.
seed: optional extra data to seed the PRF with.
outsize: size of pre-allocated output buffer to hold the output.
out: pre-allocate buffer to hold the generated data.
Apply the TLS Pseudo-Random-Function (PRF) using the master secret on some data.
The label variable usually contain a string denoting the purpose
for the generated data. The seed usually contain data such as the
client and server random, perhaps together with some additional
data that is added to guarantee uniqueness of the output for a
particular purpose.
Because the output is not guaranteed to be unique for a particular
session unless seed include the client random and server random
fields (the PRF would output the same data on another connection
resumed from the first one), it is not recommended to use this
function directly. The gnutls_prf() function seed the PRF with the
client and server random fields directly, and is recommended if you
want to generate pseudo random data unique for each session.
Returns: GNUTLS_E_SUCCESS on success, or an error code.
session: is a gnutls_session_t structure.
label_size: length of the label variable.
label: label used in PRF computation, typically a short string.
server_random_first: non-0 if server random field should be first in seed
extra_size: length of the extra variable.
extra: optional extra data to seed the PRF with.
outsize: size of pre-allocated output buffer to hold the output.
out: pre-allocate buffer to hold the generated data.
Apply the TLS Pseudo-Random-Function (PRF) using the master secret on some data, seeded with the client and server random fields.
The label variable usually contain a string denoting the purpose
for the generated data. The server_random_first indicate whether
the client random field or the server random field should be first
in the seed. Non-0 indicate that the server random field is first,
0 that the client random field is first.
The extra variable can be used to add more data to the seed, after
the random variables. It can be used to tie make sure the
generated output is strongly connected to some additional data
(e.g., a string used in user authentication).
The output is placed in *OUT, which must be pre-allocated.
Returns: GNUTLS_E_SUCCESS on success, or an error code.
priority_cache: is a gnutls_prioritity_t structure.
Deinitializes the priority cache.
priority_cache: is a gnutls_prioritity_t structure.
priorities: is a string describing priorities
err_pos: In case of an error this will have the position in the string the error occured
Sets priorities for the ciphers, key exchange methods, macs and
compression methods. This is to avoid using the
gnutls_*_priority() functions.
The priorities option allows you to specify a semi-colon
separated list of the cipher priorities to enable.
Unless the first keyword is "NONE" the defaults are:
Protocols: TLS1.1, TLS1.0, and SSL3.0.
Compression: NULL.
Certificate types: X.509, OpenPGP.
You can also use predefined sets of ciphersuites: "PERFORMANCE" all the "secure" ciphersuites are enabled, limited to 128 bit ciphers and sorted by terms of speed performance.
"NORMAL" option enables all "secure" ciphersuites. The 256-bit ciphers are included as a fallback only. The ciphers are sorted by security margin.
"SECURE128" flag enables all "secure" ciphersuites with ciphers up to 128 bits, sorted by security margin.
"SECURE256" flag enables all "secure" ciphersuites including the 256 bit ciphers, sorted by security margin.
"EXPORT" all the ciphersuites are enabled, including the low-security 40 bit ciphers.
"NONE" nothing is enabled. This disables even protocols and compression methods.
Special keywords: "!" or "-" appended with an algorithm will remove this algorithm.
"+" appended with an algorithm will add this algorithm.
"COMPAT" will enable compatibility features for a server.
"SSL3_RECORD_VERSION" will use SSL3.0 record version in client hello.
To avoid collisions in order to specify a compression algorithm in this string you have to prefix it with "COMP-", protocol versions with "VERS-" and certificate types with "CTYPE-". All other algorithms don't need a prefix.
For key exchange algorithms when in NORMAL or SECURE levels the perfect forward secrecy algorithms take precendence of the other protocols. In all cases all the supported key exchange algorithms are enabled (except for the RSA-EXPORT which is only enabled in EXPORT level).
Note that although one can select very long key sizes (such as 256 bits) for symmetric algorithms, to actually increase security the public key algorithms have to use longer key sizes as well.
Examples: "NORMAL:!AES-128-CBC",
"EXPORT:!VERS-TLS1.0:+COMP-DEFLATE:+CTYPE-OPENPGP",
"NONE:+VERS-TLS1.0:+AES-128-CBC:+RSA:+SHA1:+COMP-NULL", "NORMAL",
"NORMAL:COMPAT".
For all the current available algorithms and protocols use "gnutls-cli -l" to get a listing.
Returns: On syntax error GNUTLS_E_INVALID_REQUEST is returned,
GNUTLS_E_SUCCESS on success, or an error code.
session: is a gnutls_session_t structure.
priorities: is a string describing priorities
err_pos: In case of an error this will have the position in the string the error occured
Sets the priorities to use on the ciphers, key exchange methods,
macs and compression methods. This function avoids keeping a
priority cache and is used to directly set string priorities to a
TLS session. For documentation check the gnutls_priority_init().
Returns: On syntax error GNUTLS_E_INVALID_REQUEST is returned,
GNUTLS_E_SUCCESS on success, or an error code.
session: is a gnutls_session_t structure.
priority: is a gnutls_priority_t structure.
Sets the priorities to use on the ciphers, key exchange methods, macs and compression methods.
Returns: GNUTLS_E_SUCCESS on success, or an error code.
name: is a protocol name
The names are compared in a case insensitive way.
Returns: an id of the specified protocol, or
GNUTLS_VERSION_UNKNOWN on error.
version: is a (gnutls) version number
Convert a gnutls_protocol_t value to a string.
Returns: a string that contains the name of the specified TLS
version (e.g., "TLS1.0"), or NULL.
session: is a gnutls_session_t structure.
Get TLS version, a gnutls_protocol_t value.
Returns: the version of the currently used protocol.
Get a list of supported protocols, e.g. SSL 3.0, TLS 1.0 etc.
Returns: a zero-terminated list of gnutls_protocol_t integers
indicating the available protocols.
session: is a gnutls_session_t structure.
list: is a 0 terminated list of gnutls_protocol_t elements.
Sets the priority on the protocol versions supported by gnutls. This function actually enables or disables protocols. Newer protocol versions always have highest priority.
Returns: GNUTLS_E_SUCCESS on success, or an error code.
sc: is a pointer to an gnutls_psk_server_credentials_t structure.
This structure is complex enough to manipulate directly thus this helper function is provided in order to allocate it.
Returns: GNUTLS_E_SUCCESS on success, or an error code.
sc: is a pointer to an gnutls_psk_server_credentials_t structure.
This structure is complex enough to manipulate directly thus this helper function is provided in order to allocate it.
Returns: GNUTLS_E_SUCCESS on success, or an error code.
session: is a gnutls session
The PSK identity hint may give the client help in deciding which username to use. This should only be called in case of PSK authentication and in case of a client.
Returns: the identity hint of the peer, or NULL in case of an error.
Since: 2.4.0
sc: is an gnutls_psk_client_credentials_t structure.
This structure is complex enough to manipulate directly thus this helper function is provided in order to free (deallocate) it.
sc: is an gnutls_psk_server_credentials_t structure.
This structure is complex enough to manipulate directly thus this helper function is provided in order to free (deallocate) it.
password: zero terminated string containing password.
psk_identity: zero terminated string with PSK identity.
psk_identity_hint: zero terminated string with PSK identity hint.
output_key: output variable, contains newly allocated *data pointer.
This function will derive a PSK key from a password, for use with the Netconf protocol.
Returns: GNUTLS_E_SUCCESS on success, or an error code.
Since: 2.4.0
session: is a gnutls session
This should only be called in case of PSK authentication and in case of a server.
Returns: the username of the peer, or NULL in case of an error.
cred: is a gnutls_psk_server_credentials_t structure.
func: is the callback function
This function can be used to set a callback to retrieve the username and password for client PSK authentication. The callback's function form is: int (*callback)(gnutls_session_t, char** username, gnutls_datum_t* key);
The username and key->data must be allocated using gnutls_malloc().
username should be ASCII strings or UTF-8 strings prepared using
the "SASLprep" profile of "stringprep".
The callback function will be called once per handshake.
The callback function should return 0 on success. -1 indicates an error.
res: is an gnutls_psk_client_credentials_t structure.
username: is the user's zero-terminated userid
key: is the user's key
This function sets the username and password, in a
gnutls_psk_client_credentials_t structure. Those will be used in
PSK authentication. username should be an ASCII string or UTF-8
strings prepared using the "SASLprep" profile of "stringprep".
The key can be either in raw byte format or in Hex (not with the
'0x' prefix).
Returns: GNUTLS_E_SUCCESS on success, or an error code.
res: is a gnutls_psk_server_credentials_t structure
func: is the function to be called
This function will set a callback in order for the server to get the diffie hellman or RSA parameters for psk authentication. The callback should return zero on success.
res: is an gnutls_psk_server_credentials_t structure.
password_file: is the PSK password file (passwd.psk)
This function sets the password file, in a
gnutls_psk_server_credentials_t structure. This password file
holds usernames and keys and will be used for PSK authentication.
Returns: GNUTLS_E_SUCCESS on success, or an error code.
cred: is a gnutls_psk_server_credentials_t structure.
func: is the callback function
This function can be used to set a callback to retrieve the user's PSK credentials. The callback's function form is: int (*callback)(gnutls_session_t, const char* username, gnutls_datum_t* key);
username contains the actual username.
The key must be filled in using the gnutls_malloc().
In case the callback returned a negative number then gnutls will assume that the username does not exist.
The callback function will only be called once per handshake. The callback function should return 0 on success, while -1 indicates an error.
res: is an gnutls_psk_server_credentials_t structure.
hint: is the PSK identity hint string
This function sets the identity hint, in a
gnutls_psk_server_credentials_t structure. This hint is sent to
the client to help it chose a good PSK credential (i.e., username
and password).
Returns: GNUTLS_E_SUCCESS on success, or an error code.
Since: 2.4.0
res: is a gnutls_psk_server_credentials_t structure
dh_params: is a structure that holds diffie hellman parameters.
This function will set the diffie hellman parameters for an anonymous server to use. These parameters will be used in Diffie Hellman with PSK cipher suites.
res: is a gnutls_certificate_credentials_t structure
func: is the function to be called
This function will set a callback in order for the server to get the diffie hellman parameters for PSK authentication. The callback should return zero on success.
session: is a gnutls_session_t structure.
This function checks if there are any data to receive
in the gnutls buffers. Returns the size of that data or 0.
Notice that you may also use select() to check for data in
a TCP connection, instead of this function.
(gnutls leaves some data in the tcp buffer in order for select
to work).
session: is a gnutls_session_t structure.
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.
Normally only servers that require maximum compatibility with everything out there, need to call this function.
session: is a gnutls_session_t structure.
This function provides information about the internals of the
record protocol and is only useful if a prior gnutls function call
(e.g. gnutls_handshake()) was interrupted for some reason, that
is, if a function returned GNUTLS_E_INTERRUPTED or
GNUTLS_E_AGAIN. In such a case, you might want to call select()
or poll() before calling the interrupted gnutls function again. To
tell you whether a file descriptor should be selected for either
reading or writing, gnutls_record_get_direction() returns 0 if the
interrupted function was trying to read data, and 1 if it was
trying to write data.
Returns: 0 if trying to read data, 1 if trying to write data.
session: is a gnutls_session_t structure.
This function returns the maximum record packet size in this connection. The maximum record size is negotiated by the client after the first handshake message.
session: is a gnutls_session_t structure.
data: the buffer that the data will be read into
sizeofdata: the number of requested bytes
This function has the similar semantics with recv(). The only
difference is that is accepts a GNUTLS session, and uses different
error codes.
In the special case that a server requests a renegotiation, the
client may receive an error code of GNUTLS_E_REHANDSHAKE. This
message may be simply ignored, replied with an alert containing
NO_RENEGOTIATION, or replied with a new handshake, depending on
the client's will.
If EINTR is returned by the internal push function (the default
is recv()) then GNUTLS_E_INTERRUPTED will be returned. If
GNUTLS_E_INTERRUPTED or GNUTLS_E_AGAIN is returned, you must
call this function again to get the data. See also
gnutls_record_get_direction().
A server may also receive GNUTLS_E_REHANDSHAKE when a client has
initiated a handshake. In that case the server can only initiate a
handshake or terminate the connection.
Returns: the number of bytes received and zero on EOF. A negative
error code is returned in case of an error. The number of bytes
received might be less than sizeofdata.
session: is a gnutls_session_t structure.
data: contains the data to send
sizeofdata: is the length of the data
This function has the similar semantics with send(). The only
difference is that is accepts a GNUTLS session, and uses different
error codes.
Note that if the send buffer is full, send() will block this
function. See the send() documentation for full information. You
can replace the default push function by using
gnutls_transport_set_ptr2() with a call to send() with a
MSG_DONTWAIT flag if blocking is a problem.
If the EINTR is returned by the internal push function (the
default is send()} then GNUTLS_E_INTERRUPTED will be returned. If
GNUTLS_E_INTERRUPTED or GNUTLS_E_AGAIN is returned, you must
call this function again, with the same parameters; alternatively
you could provide a NULL pointer for data, and 0 for
size. cf. gnutls_record_get_direction().
Returns: the number of bytes sent, or a negative error code. The
number of bytes sent might be less than sizeofdata. The maximum
number of bytes this function can send in a single call depends on
the negotiated maximum record size.
session: is a gnutls_session_t structure.
size: is the new size
This function sets the maximum record packet size in this connection. This property can only be set to clients. The server may choose not to accept the requested size.
Acceptable values are 512(=2^9), 1024(=2^10), 2048(=2^11) and 4096(=2^12). Returns 0 on success. The requested record size does get in effect immediately only while sending data. The receive part will take effect after a successful handshake.
This function uses a TLS extension called 'max record size'. Not all TLS implementations use or even understand this extension.
session: is a gnutls_session_t structure.
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.
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.
Returns: GNUTLS_E_SUCCESS on success, otherwise an error.
session: is a gnutls session
Get the export RSA parameter's modulus size.
Returns: the bits used in the last RSA-EXPORT key exchange with the peer, or a negative value in case of error.
session: is a gnutls session
exponent: will hold the exponent.
modulus: will hold the modulus.
This function will return the peer's public key exponent and
modulus used in the last RSA-EXPORT authentication. The output
parameters must be freed with gnutls_free().
Returns: On success, GNUTLS_E_SUCCESS (0) is returned, otherwise
an error code is returned.
dst: Is the destination structure, which should be initialized.
src: Is the source structure
This function will copy the RSA parameters structure from source to destination.
rsa_params: Is a structure that holds the parameters
This function will deinitialize the RSA parameters structure.
params: Holds the RSA parameters
format: the format of output params. One of PEM or DER.
params_data: will contain a PKCS1 RSAPublicKey structure PEM or DER encoded
params_data_size: holds the size of params_data (and will be replaced by the actual size of parameters)
This function will export the given RSA parameters to a PKCS1 RSAPublicKey structure. If the buffer provided is not long enough to hold the output, then GNUTLS_E_SHORT_MEMORY_BUFFER will be returned.
If the structure is PEM encoded, it will have a header of "BEGIN RSA PRIVATE KEY".
In case of failure a negative value will be returned, and 0 on success.
params: a structure that holds the rsa parameters
m: will hold the modulus
e: will hold the public exponent
d: will hold the private exponent
p: will hold the first prime (p)
q: will hold the second prime (q)
u: will hold the coefficient
bits: if non null will hold the prime's number of bits
This function will export the RSA parameters found in the given
structure. The new parameters will be allocated using
gnutls_malloc() and will be stored in the appropriate datum.
params: The structure where the parameters will be stored
bits: is the prime's number of bits
This function will generate new temporary RSA parameters for use in RSA-EXPORT ciphersuites. This function is normally slow.
Note that if the parameters are to be used in export cipher suites the bits value should be 512 or less. Also note that the generation of new RSA parameters is only useful to servers. Clients use the parameters sent by the server, thus it's no use calling this in client side.
params: A structure where the parameters will be copied to
pkcs1_params: should contain a PKCS1 RSAPublicKey structure PEM or DER encoded
format: the format of params. PEM or DER.
This function will extract the RSAPublicKey found in a PKCS1 formatted structure.
If the structure is PEM encoded, it should have a header of "BEGIN RSA PRIVATE KEY".
In case of failure a negative value will be returned, and 0 on success.
rsa_params: Is a structure will hold the parameters
m: holds the modulus
e: holds the public exponent
d: holds the private exponent
p: holds the first prime (p)
q: holds the second prime (q)
u: holds the coefficient
This function will replace the parameters in the given structure. The new parameters should be stored in the appropriate gnutls_datum.
rsa_params: Is a structure that will hold the parameters
This function will initialize the temporary RSA parameters structure.
session: is a gnutls_session_t structure.
data: will hold the data
data_length: will hold the data length. Must hold the maximum size of data.
type: will hold the server name indicator type
indx: is the index of the server_name
This function will allow you to get the name indication (if any), a client has sent. The name indication may be any of the enumeration gnutls_server_name_type_t.
If type is GNUTLS_NAME_DNS, then this function is to be used by servers
that support virtual hosting, and the data will be a null terminated UTF-8 string.
If data has not enough size to hold the server name GNUTLS_E_SHORT_MEMORY_BUFFER
is returned, and data_length will hold the required size.
index is used to retrieve more than one server names (if sent by the client).
The first server name has an index of 0, the second 1 and so on. If no name with the given
index exists GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE is returned.
session: is a gnutls_session_t structure.
type: specifies the indicator type
name: is a string that contains the server name.
name_length: holds the length of name
This function is to be used by clients that want to inform (via a TLS extension mechanism) the server of the name they connected to. This should be used by clients that connect to servers that do virtual hosting.
The value of name depends on the ind type. In case of GNUTLS_NAME_DNS,
an ASCII or UTF-8 null terminated string, without the trailing dot, is expected.
IPv4 or IPv6 addresses are not permitted.
session: is a gnutls_session_t structure.
This function can be used to disable certain (security) features in
TLS in order to maintain maximum compatibility with buggy
clients. It is equivalent to calling:
gnutls_record_disable_padding()
Normally only servers that require maximum compatibility with everything out there, need to call this function.
session: is a gnutls_session_t structure.
Return a pointer to the 32-byte client random field used in the session. The pointer must not be modified or deallocated.
If a client random value has not yet been established, the output
will be garbage; in particular, a NULL return value should not be
expected.
Returns: pointer to client random data.
session: is a gnutls_session_t structure.
Returns all session parameters, in order to support resuming.
The client should call this, and keep the returned session, if he wants to
resume that current version later by calling gnutls_session_set_data()
This function must be called after a successful handshake. The returned
datum must be freed with gnutls_free().
Resuming sessions is really useful and speedups connections after a succesful one.
Returns: On success, GNUTLS_E_SUCCESS (0) is returned, otherwise
an error code is returned.
session: is a gnutls_session_t structure.
session_data: is a pointer to space to hold the session.
session_data_size: is the session_data's size, or it will be set by the function.
Returns all session parameters, in order to support resuming. The
client should call this, and keep the returned session, if he
wants to resume that current version later by calling
gnutls_session_set_data() This function must be called after a
successful handshake.
Resuming sessions is really useful and speedups connections after a succesful one.
Returns: On success, GNUTLS_E_SUCCESS (0) is returned, otherwise
an error code is returned.
session: is a gnutls_session_t structure.
session_id: is a pointer to space to hold the session id.
session_id_size: is the session id's size, or it will be set by the function.
Returns the current session id. This can be used if you want to check if the next session you tried to resume was actually resumed. This is because resumed sessions have the same sessionID with the original session.
Session id is some data set by the server, that identify the current session. In TLS 1.0 and SSL 3.0 session id is always less than 32 bytes.
Returns: On success, GNUTLS_E_SUCCESS (0) is returned, otherwise
an error code is returned.
session: is a gnutls_session_t structure.
Return a pointer to the 48-byte master secret in the session. The pointer must not be modified or deallocated.
If a master secret value has not yet been established, the output
will be garbage; in particular, a NULL return value should not be
expected.
Consider using gnutls_prf() rather than extracting the master
secret and use it to derive further data.
Returns: pointer to master secret data.
session: is a gnutls_session_t structure.
Get user pointer for session. Useful in callbacks. This is the
pointer set with gnutls_session_set_ptr().
Returns: the user given pointer from the session structure, or
NULL if it was never set.
session: is a gnutls_session_t structure.
Return a pointer to the 32-byte server random field used in the session. The pointer must not be modified or deallocated.
If a server random value has not yet been established, the output
will be garbage; in particular, a NULL return value should not be
expected.
Returns: pointer to server random data.
session: is a gnutls_session_t structure.
Check whether session is resumed or not.
Returns: non zero if this session is resumed, or a zero if this is a new session.
session: is a gnutls_session_t structure.
session_data: is a pointer to space to hold the session.
session_data_size: is the session's size
Sets all session parameters, in order to resume a previously
established session. The session data given must be the one
returned by gnutls_session_get_data(). This function should be
called before gnutls_handshake().
Keep in mind that session resuming is advisory. The server may choose not to resume the session, thus a full handshake will be performed.
Returns: On success, GNUTLS_E_SUCCESS (0) is returned, otherwise
an error code is returned.
session: is a gnutls_session_t structure.
finished_func: a gnutls_finished_callback_func callback.
Register a callback function for the session that will be called when a TLS Finished message has been generated. The function is typically used to copy away the TLS finished message for later use as a channel binding or similar purpose.
The callback should follow this prototype: void callback (gnutls_session_t session, const void *finished, size_t len);
The finished parameter will contain the binary TLS finished
message, and len will contains its length. For SSLv3 connections,
the len parameter will be 36 and for TLS connections it will be
12.
It is recommended that the function returns quickly in order to not delay the handshake. Use the function to store a copy of the TLS finished message for later use.
Since: 2.6.0
session: is a gnutls_session_t structure.
ptr: is the user pointer
This function will set (associate) the user given pointer ptr to
the session structure. This is pointer can be accessed with
gnutls_session_get_ptr().
session: is a gnutls_session_t structure.
Sets some default priority on the ciphers, key exchange methods, macs and compression methods. This function also includes weak algorithms.
This is the same as calling: gnutls_priority_set_direct (session, "EXPORT", NULL);
This function is kept around for backwards compatibility, but
because of its wide use it is still fully supported. If you wish
to allow users to provide a string that specify which ciphers to
use (which is recommended), you should use
gnutls_priority_set_direct() or gnutls_priority_set() instead.
Returns: GNUTLS_E_SUCCESS on success, or an error code.
session: is a gnutls_session_t structure.
Sets some default priority on the ciphers, key exchange methods, macs and compression methods.
This is the same as calling: gnutls_priority_set_direct (session, "NORMAL", NULL);
This function is kept around for backwards compatibility, but
because of its wide use it is still fully supported. If you wish
to allow users to provide a string that specify which ciphers to
use (which is recommended), you should use
gnutls_priority_set_direct() or gnutls_priority_set() instead.
Returns: GNUTLS_E_SUCCESS on success, or an error code.
Convert a gnutls_sign_algorithm_t value to a string.
Returns: a string that contains the name of the specified sign
algorithm, or NULL.
session: is a gnutls session
userdata: if non-NULL, will be set to abstract callback pointer.
Retrieve the callback function, and its userdata pointer.
Returns: The function pointer set by gnutls_sign_callback_set(), or
if not set, NULL.
session: is a gnutls session
sign_func: function pointer to application's sign callback.
userdata: void pointer that will be passed to sign callback.
Set the callback function. The function must have this prototype:
typedef int (*gnutls_sign_func) (gnutls_session_t session, void *userdata, gnutls_certificate_type_t cert_type, const gnutls_datum_t * cert, const gnutls_datum_t * hash, gnutls_datum_t * signature);
The userdata parameter is passed to the sign_func verbatim, and
can be used to store application-specific data needed in the
callback function. See also gnutls_sign_callback_get().
name: is a MAC algorithm name
The names are compared in a case insensitive way.
Returns: return a gnutls_sign_algorithm_t value corresponding to
the specified cipher, or GNUTLS_SIGN_UNKNOWN on error.
algorithm: is a public key signature algorithm
Convert a gnutls_sign_algorithm_t value to a string.
Returns: a pointer to a string that contains the name of the
specified public key signature algorithm, or NULL.
Since: 2.6.0
Get a list of supported public key signature algorithms.
Returns: a zero-terminated list of gnutls_sign_algorithm_t
integers indicating the available ciphers.
sc: is a pointer to an gnutls_srp_server_credentials_t structure.
This structure is complex enough to manipulate directly thus this helper function is provided in order to allocate it.
Returns: On success, GNUTLS_E_SUCCESS (0) is returned, or an
error code.
sc: is a pointer to an gnutls_srp_server_credentials_t structure.
This structure is complex enough to manipulate directly thus this helper function is provided in order to allocate it.
Returns: On success, GNUTLS_E_SUCCESS (0) is returned, or an
error code.
b64_data: contains the encoded data
result: the place where decoded data lie
This function will decode the given encoded data. The decoded data will be allocated, and stored into result. It will decode using the base64 algorithm as used in libsrp.
You should use gnutls_free() to free the returned data.
Warning! This base64 encoding is not the "standard" encoding, so do not use it for non-SRP purposes.
Returns: 0 on success, or an error code.
b64_data: contain the encoded data
result: the place where decoded data will be copied
result_size: holds the size of the result
This function will decode the given encoded data, using the base64 encoding found in libsrp.
Note that b64_data should be null terminated.
Warning! This base64 encoding is not the "standard" encoding, so do not use it for non-SRP purposes.
Returns: GNUTLS_E_SHORT_MEMORY_BUFFER if the buffer given is not
long enough, or 0 on success.
data: contains the raw data
result: will hold the newly allocated encoded data
This function will convert the given data to printable data, using the base64 encoding. This is the encoding used in SRP password files. This function will allocate the required memory to hold the encoded data.
You should use gnutls_free() to free the returned data.
Warning! This base64 encoding is not the "standard" encoding, so do not use it for non-SRP purposes.
Returns: 0 on success, or an error code.
data: contain the raw data
result: the place where base64 data will be copied
result_size: holds the size of the result
This function will convert the given data to printable data, using the base64 encoding, as used in the libsrp. This is the encoding used in SRP password files. If the provided buffer is not long enough GNUTLS_E_SHORT_MEMORY_BUFFER is returned.
Warning! This base64 encoding is not the "standard" encoding, so do not use it for non-SRP purposes.
Returns: GNUTLS_E_SHORT_MEMORY_BUFFER if the buffer given is not
long enough, or 0 on success.
sc: is an gnutls_srp_client_credentials_t structure.
This structure is complex enough to manipulate directly thus this helper function is provided in order to free (deallocate) it.
sc: is an gnutls_srp_server_credentials_t structure.
This structure is complex enough to manipulate directly thus this helper function is provided in order to free (deallocate) it.
session: is a gnutls session
This function will return the username of the peer. This should only be called in case of SRP authentication and in case of a server. Returns NULL in case of an error.
Returns: SRP username of the peer, or NULL in case of error.
cred: is a gnutls_srp_server_credentials_t structure.
func: is the callback function
This function can be used to set a callback to retrieve the username and password for client SRP authentication.
The callback's function form is:
int (*callback)(gnutls_session_t, char** username, char**password);
The username and password must be allocated using
gnutls_malloc(). username and password should be ASCII strings
or UTF-8 strings prepared using the "SASLprep" profile of
"stringprep".
The callback function will be called once per handshake before the initial hello message is sent.
The callback should not return a negative error code the second time called, since the handshake procedure will be aborted.
The callback function should return 0 on success. -1 indicates an error.
res: is an gnutls_srp_client_credentials_t structure.
username: is the user's userid
password: is the user's password
This function sets the username and password, in a
gnutls_srp_client_credentials_t structure. Those will be used in
SRP authentication. username and password should be ASCII
strings or UTF-8 strings prepared using the "SASLprep" profile of
"stringprep".
Returns: On success, GNUTLS_E_SUCCESS (0) is returned, or an
error code.
session: is a gnutls_session_t structure.
bits: is the number of bits
This function sets the minimum accepted number of bits, for use in an SRP key exchange. If zero, the default 2048 bits will be used.
In the client side it sets the minimum accepted number of bits. If
a server sends a prime with less bits than that
GNUTLS_E_RECEIVED_ILLEGAL_PARAMETER will be returned by the
handshake.
Since: 2.6.0
res: is an gnutls_srp_server_credentials_t structure.
password_file: is the SRP password file (tpasswd)
password_conf_file: is the SRP password conf file (tpasswd.conf)
This function sets the password files, in a
gnutls_srp_server_credentials_t structure. Those password files
hold usernames and verifiers and will be used for SRP
authentication.
Returns: On success, GNUTLS_E_SUCCESS (0) is returned, or an
error code.
cred: is a gnutls_srp_server_credentials_t structure.
func: is the callback function
This function can be used to set a callback to retrieve the user's SRP credentials. The callback's function form is: int (*callback)(gnutls_session_t, const char* username, gnutls_datum_t* salt, gnutls_datum_t *verifier, gnutls_datum_t* g, gnutls_datum_t* n);
username contains the actual username.
The salt, verifier, generator and prime must be filled
in using the gnutls_malloc(). For convenience prime and generator
may also be one of the static parameters defined in extra.h.
In case the callback returned a negative number then gnutls will assume that the username does not exist.
In order to prevent attackers from guessing valid usernames, if a user does not exist, g and n values should be filled in using a random user's parameters. In that case the callback must return the special value (1).
The callback function will only be called once per handshake. The callback function should return 0 on success, while -1 indicates an error.
username: is the user's name
password: is the user's password
salt: should be some randomly generated bytes
generator: is the generator of the group
prime: is the group's prime
res: where the verifier will be stored.
This function will create an SRP verifier, as specified in
RFC2945. The prime and generator should be one of the static
parameters defined in gnutls/extra.h or may be generated using the
libgcrypt functions gcry_prime_generate() and
gcry_prime_group_generator().
The verifier will be allocated with malloc and will be stored in
res using binary format.
Returns: On success, GNUTLS_E_SUCCESS (0) is returned, or an
error code.
error: is an error returned by a gnutls function.
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".
Returns: A string corresponding to the symbol name of the error code.
Since: 2.6.0
error: is a GnuTLS error code, a negative value
This function is similar to strerror(). Differences: 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 value.
Returns: A string explaining the GnuTLS error message.
session: is a gnutls_session_t structure.
recv_ptr: will hold the value for the pull function
send_ptr: will hold the value for the push function
Used to get the arguments of the transport functions (like PUSH
and PULL). These should have been set using
gnutls_transport_set_ptr2().
session: is a gnutls_session_t structure.
Used to get the first argument of the transport function (like
PUSH and PULL). This must have been set using
gnutls_transport_set_ptr().
Returns: first argument of the transport function.
session: is a gnutls_session_t structure.
err: error value to store in session-specific errno variable.
Store err in the session-specific errno variable. Useful values
for err is EAGAIN and EINTR, other values are treated will be
treated as real errors in the push/pull function.
This function is useful in replacement push/pull functions set by
gnutls_transport_set_push_function and
gnutls_transport_set_pullpush_function under Windows, where the
replacement push/pull may not have access to the same errno
variable that is used by GnuTLS (e.g., the application is linked to
msvcr71.dll and gnutls is linked to msvcrt.dll).
If you don't have the session variable easily accessible from the
push/pull function, and don't worry about thread conflicts, you can
also use gnutls_transport_set_global_errno().
err: error value to store in global errno variable.
Store err in the global errno variable. Useful values for err is
EAGAIN and EINTR, other values are treated will be treated as real
errors in the push/pull function.
This function is useful in replacement push/pull functions set by
gnutls_transport_set_push_function and
gnutls_transport_set_pullpush_function under Windows, where the
replacement push/pull may not have access to the same errno
variable that is used by GnuTLS (e.g., the application is linked to
msvcr71.dll and gnutls is linked to msvcrt.dll).
Whether this function is thread safe or not depends on whether the
global variable errno is thread safe, some system libraries make it
a thread-local variable. When feasible, using the guaranteed
thread-safe gnutls_transport_set_errno() may be better.
session: is a gnutls_session_t structure.
num: is the low water value.
Used to set the lowat value in order for select to check if there are pending data to socket buffer. Used only if you have changed the default low water value (default is 1). Normally you will not need that function. This function is only useful if using berkeley style sockets. Otherwise it must be called and set lowat to zero.
session: is a gnutls_session_t structure.
recv_ptr: is the value for the pull function
send_ptr: is the value for the push function
Used to set the first argument of the transport function (like PUSH and PULL). In berkeley style sockets this function will set the connection handle. With this function you can use two different pointers for receiving and sending.
session: is a gnutls_session_t structure.
ptr: is the value.
Used to set the first argument of the transport function (like PUSH and PULL). In berkeley style sockets this function will set the connection handle.
session: gnutls session
pull_func: a callback function similar to read()
This is the function where you set a function for gnutls to receive data. Normally, if you use berkeley style sockets, do not need to use this function since the default (recv(2)) will probably be ok.
PULL_FUNC is of the form, ssize_t (*gnutls_pull_func)(gnutls_transport_ptr_t, void*, size_t);
session: gnutls session
push_func: a callback function similar to write()
This is the function where you set a push function for gnutls to use in order to send data. If you are going to use berkeley style sockets, you do not need to use this function since the default (send(2)) will probably be ok. Otherwise you should specify this function for gnutls to be able to send data.
PUSH_FUNC is of the form, ssize_t (*gnutls_push_func)(gnutls_transport_ptr_t, const void*, size_t);
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The following functions are to be used for X.509 certificate handling. Their prototypes lie in `gnutls/x509.h'.
bag: The bag
pass: The password used for encryption. This can only be ASCII.
This function will decrypt the given encrypted bag and return 0 on success.
bag: The structure to be initialized
This function will deinitialize a PKCS12 Bag structure.
bag: The bag
pass: The password used for encryption. This can only be ASCII.
flags: should be one of gnutls_pkcs_encrypt_flags_t elements bitwise or'd
This function will encrypt the given bag and return 0 on success.
bag: The bag
This function will return the number of the elements withing the bag.
bag: The bag
indx: The element of the bag to get the data from
data: where the bag's data will be. Should be treated as constant.
This function will return the bag's data. The data is a constant that is stored into the bag. Should not be accessed after the bag is deleted.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.and a negative error code on error.
bag: The bag
indx: The bag's element to add the id
name: will hold a pointer to the name (to be treated as const)
This function will return the friendly name, of the specified bag element. The key ID is usually used to distinguish the local private key and the certificate pair.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value. or a negative value on error.
bag: The bag
indx: The bag's element to add the id
id: where the ID will be copied (to be treated as const)
This function will return the key ID, of the specified bag element. The key ID is usually used to distinguish the local private key and the certificate pair.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value. or a negative value on error.
bag: The bag
indx: The element of the bag to get the type
This function will return the bag's type. One of the gnutls_pkcs12_bag_type_t enumerations.
bag: The structure to be initialized
This function will initialize a PKCS12 bag structure. PKCS12 Bags usually contain private keys, lists of X.509 Certificates and X.509 Certificate revocation lists.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
bag: The bag
crl: the CRL to be copied.
This function will insert the given CRL into the
bag. This is just a wrapper over gnutls_pkcs12_bag_set_data().
Returns: the index of the added bag on success, or a negative value on failure.
bag: The bag
crt: the certificate to be copied.
This function will insert the given certificate into the
bag. This is just a wrapper over gnutls_pkcs12_bag_set_data().
Returns: the index of the added bag on success, or a negative value on failure.
bag: The bag
type: The data's type
data: the data to be copied.
This function will insert the given data of the given type into the bag.
Returns: the index of the added bag on success, or a negative value on error.
bag: The bag
indx: The bag's element to add the id
name: the name
This function will add the given key friendly name, to the specified, by the index, bag element. The name will be encoded as a 'Friendly name' bag attribute, which is usually used to set a user name to the local private key and the certificate pair.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value. or a negative value on error.
bag: The bag
indx: The bag's element to add the id
id: the ID
This function will add the given key ID, to the specified, by the index, bag element. The key ID will be encoded as a 'Local key identifier' bag attribute, which is usually used to distinguish the local private key and the certificate pair.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value. or a negative value on error.
pkcs12: The structure to be initialized
This function will deinitialize a PKCS12 structure.
pkcs12: Holds the pkcs12 structure
format: the format of output params. One of PEM or DER.
output_data: will contain a structure PEM or DER encoded
output_data_size: holds the size of output_data (and will be replaced by the actual size of parameters)
This function will export the pkcs12 structure to DER or PEM format.
If the buffer provided is not long enough to hold the output, then *output_data_size will be updated and GNUTLS_E_SHORT_MEMORY_BUFFER will be returned.
If the structure is PEM encoded, it will have a header of "BEGIN PKCS12".
Return value: In case of failure a negative value will be returned, and 0 on success.
pkcs12: should contain a gnutls_pkcs12_t structure
pass: The password for the MAC
This function will generate a MAC for the PKCS12 structure.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
pkcs12: should contain a gnutls_pkcs12_t structure
indx: contains the index of the bag to extract
bag: An initialized bag, where the contents of the bag will be copied
This function will return a Bag from the PKCS12 structure.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
After the last Bag has been read GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE will be returned.
pkcs12: The structure to store the parsed PKCS12.
data: The DER or PEM encoded PKCS12.
format: One of DER or PEM
flags: an ORed sequence of gnutls_privkey_pkcs8_flags
This function will convert the given DER or PEM encoded PKCS12 to the native gnutls_pkcs12_t format. The output will be stored in 'pkcs12'.
If the PKCS12 is PEM encoded it should have a header of "PKCS12".
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
pkcs12: The structure to be initialized
This function will initialize a PKCS12 structure. PKCS12 structures usually contain lists of X.509 Certificates and X.509 Certificate revocation lists.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
pkcs12: should contain a gnutls_pkcs12_t structure
bag: An initialized bag
This function will insert a Bag into the PKCS12 structure.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
pkcs12: should contain a gnutls_pkcs12_t structure
pass: The password for the MAC
This function will verify the MAC for the PKCS12 structure.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
pkcs7: The structure to be initialized
This function will deinitialize a PKCS7 structure.
indx: the index of the crl to delete
This function will delete a crl from a PKCS7 or RFC2630 crl set. Index starts from 0. Returns 0 on success.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
indx: the index of the certificate to delete
This function will delete a certificate from a PKCS7 or RFC2630 certificate set. Index starts from 0. Returns 0 on success.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
pkcs7: Holds the pkcs7 structure
format: the format of output params. One of PEM or DER.
output_data: will contain a structure PEM or DER encoded
output_data_size: holds the size of output_data (and will be replaced by the actual size of parameters)
This function will export the pkcs7 structure to DER or PEM format.
If the buffer provided is not long enough to hold the output, then
*output_data_size is updated and GNUTLS_E_SHORT_MEMORY_BUFFER
will be returned.
If the structure is PEM encoded, it will have a header of "BEGIN PKCS7".
Return value: In case of failure a negative value will be returned, and 0 on success.
This function will return the number of certifcates in the PKCS7 or RFC2630 crl set.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
indx: contains the index of the crl to extract
crl: the contents of the crl will be copied there (may be null)
crl_size: should hold the size of the crl
This function will return a crl of the PKCS7 or RFC2630 crl set.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value. If the provided buffer is not long enough,
then crl_size is updated and GNUTLS_E_SHORT_MEMORY_BUFFER is
returned. After the last crl has been read
GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE will be returned.
This function will return the number of certifcates in the PKCS7 or RFC2630 certificate set.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
indx: contains the index of the certificate to extract
certificate: the contents of the certificate will be copied there (may be null)
certificate_size: should hold the size of the certificate
This function will return a certificate of the PKCS7 or RFC2630 certificate set.
After the last certificate has been read
GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE will be returned.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value. If the provided buffer is not long enough,
then certificate_size is updated and
GNUTLS_E_SHORT_MEMORY_BUFFER is returned.
pkcs7: The structure to store the parsed PKCS7.
data: The DER or PEM encoded PKCS7.
format: One of DER or PEM
This function will convert the given DER or PEM encoded PKCS7 to
the native gnutls_pkcs7_t format. The output will be stored in
'pkcs7'.
If the PKCS7 is PEM encoded it should have a header of "PKCS7".
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
pkcs7: The structure to be initialized
This function will initialize a PKCS7 structure. PKCS7 structures usually contain lists of X.509 Certificates and X.509 Certificate revocation lists.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
crl: the DER encoded crl to be added
This function will add a crl to the PKCS7 or RFC2630 crl set.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
crl: the DER encoded crl to be added
This function will add a parsed CRL to the PKCS7 or RFC2630 crl set.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
crt: the DER encoded certificate to be added
This function will add a certificate to the PKCS7 or RFC2630 certificate set.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
crt: the certificate to be copied.
This function will add a parsed certificate to the PKCS7 or
RFC2630 certificate set. This is a wrapper function over
gnutls_pkcs7_set_crt_raw() .
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
issuer: is the certificate of a possible issuer
This function will check if the given CRL was issued by the given issuer certificate. It will return true (1) if the given CRL was issued by the given issuer, and false (0) if not.
A negative value is returned in case of an error.
crl: The structure to be initialized
This function will deinitialize a CRL structure.
crl: Holds the revocation list
format: the format of output params. One of PEM or DER.
output_data: will contain a private key PEM or DER encoded
output_data_size: holds the size of output_data (and will be replaced by the actual size of parameters)
This function will export the revocation list to DER or PEM format.
If the buffer provided is not long enough to hold the output, then ¤GNUTLS_E_SHORT_MEMORY_BUFFER will be returned.
If the structure is PEM encoded, it will have a header of "BEGIN X509 CRL".
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value. and a negative value on failure.
crl: should contain a gnutls_x509_crl_t structure
This function will return the number of revoked certificates in the given CRL.
Returns: number of certificates, a negative value on failure.
crl: should contain a gnutls_x509_crl_t structure
indx: the index of the certificate to extract (starting from 0)
serial: where the serial number will be copied
serial_size: initially holds the size of serial
t: if non null, will hold the time this certificate was revoked
This function will retrieve the serial number of the specified, by the index, revoked certificate.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value. and a negative value on error.
crl: should contain a gnutls_x509_crl_t structure
indx: Specifies which DN OID to send. Use zero to get the first one.
oid: a pointer to a structure to hold the name (may be null)
sizeof_oid: initially holds the size of 'oid'
This function will extract the requested OID of the name of the CRL issuer, specified by the given index.
If oid is null then only the size will be filled.
Returns: GNUTLS_E_SHORT_MEMORY_BUFFER if the provided buffer is
not long enough, and in that case the sizeof_oid will be updated
with the required size. On success 0 is returned.
crl: should contain a gnutls_x509_crl_t structure
oid: holds an Object Identified in null terminated string
indx: In case multiple same OIDs exist in the RDN, this specifies which to send. Use zero to get the first one.
raw_flag: If non zero returns the raw DER data of the DN part.
buf: a pointer to a structure to hold the peer's name (may be null)
sizeof_buf: initially holds the size of buf
This function will extract the part of the name of the CRL issuer specified by the given OID. The output will be encoded as described in RFC2253. The output string will be ASCII or UTF-8 encoded, depending on the certificate data.
Some helper macros with popular OIDs can be found in gnutls/x509.h
If raw flag is zero, this function will only return known OIDs as
text. Other OIDs will be DER encoded, as described in RFC2253 - in
hex format with a '\#' prefix. You can check about known OIDs
using gnutls_x509_dn_oid_known().
If buf is null then only the size will be filled.
Returns: GNUTLS_E_SHORT_MEMORY_BUFFER if the provided buffer is
not long enough, and in that case the sizeof_buf will be updated
with the required size, and 0 on success.
crl: should contain a gnutls_x509_crl_t structure
buf: a pointer to a structure to hold the peer's name (may be null)
sizeof_buf: initially holds the size of buf
This function will copy the name of the CRL issuer in the provided buffer. The name will be in the form "C=xxxx,O=yyyy,CN=zzzz" as described in RFC2253. The output string will be ASCII or UTF-8 encoded, depending on the certificate data.
If buf is NULL then only the size will be filled.
Returns: GNUTLS_E_SHORT_MEMORY_BUFFER if the provided buffer is
not long enough, and in that case the sizeof_buf will be updated
with the required size, and 0 on success.
crl: should contain a gnutls_x509_crl_t structure
This function will return the time the next CRL will be issued. This field is optional in a CRL so it might be normal to get an error instead.
Returns: when the next CRL will be issued, or (time_t)-1 on error.
crl: should contain a gnutls_x509_crl_t structure
This function will return a value of the gnutls_sign_algorithm_t
enumeration that is the signature algorithm.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
crl: should contain a gnutls_x509_crl_t structure
sig: a pointer where the signature part will be copied (may be null).
sizeof_sig: initially holds the size of sig
This function will extract the signature field of a CRL.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value. and a negative value on error.
crl: should contain a gnutls_x509_crl_t structure
This function will return the time this CRL was issued.
Returns: when the CRL was issued, or (time_t)-1 on error.
crl: should contain a gnutls_x509_crl_t structure
This function will return the version of the specified CRL.
Returns: The version number, or a negative value on error.
crl: The structure to store the parsed CRL.
data: The DER or PEM encoded CRL.
format: One of DER or PEM
This function will convert the given DER or PEM encoded CRL
to the native gnutls_x509_crl_t format. The output will be stored in 'crl'.
If the CRL is PEM encoded it should have a header of "X509 CRL".
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
crl: The structure to be initialized
This function will initialize a CRL structure. CRL stands for Certificate Revocation List. A revocation list usually contains lists of certificate serial numbers that have been revoked by an Authority. The revocation lists are always signed with the authority's private key.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
crl: The structure to be printed
format: Indicate the format to use
out: Newly allocated datum with zero terminated string.
This function will pretty print a X.509 certificate revocation list, suitable for display to a human.
The output out needs to be deallocate using gnutls_free().
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
crl: should contain a gnutls_x509_crl_t structure
serial: The revoked certificate's serial number
serial_size: Holds the size of the serial field.
revocation_time: The time this certificate was revoked
This function will set a revoked certificate's serial number to the CRL.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
crl: should contain a gnutls_x509_crl_t structure
crt: a certificate of type gnutls_x509_crt_t with the revoked certificate
revocation_time: The time this certificate was revoked
This function will set a revoked certificate's serial number to the CRL.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
crl: should contain a gnutls_x509_crl_t structure
exp_time: The actual time
This function will set the time this CRL will be updated.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
crl: should contain a gnutls_x509_crl_t structure
act_time: The actual time
This function will set the time this CRL was issued.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
crl: should contain a gnutls_x509_crl_t structure
version: holds the version number. For CRLv1 crls must be 1.
This function will set the version of the CRL. This must be one for CRL version 1, and so on. The CRLs generated by gnutls should have a version number of 2.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
crl: should contain a gnutls_x509_crl_t structure
issuer: is the certificate of the certificate issuer
issuer_key: holds the issuer's private key
dig: The message digest to use. GNUTLS_DIG_SHA1 is the safe choice unless you know what you're doing.
flags: must be 0
This function will sign the CRL with the issuer's private key, and will copy the issuer's information into the CRL.
This must be the last step in a certificate CRL since all the previously set parameters are now signed.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
crl: should contain a gnutls_x509_crl_t structure
issuer: is the certificate of the certificate issuer
issuer_key: holds the issuer's private key
This function is the same a gnutls_x509_crl_sign2() with no flags, and
SHA1 as the hash algorithm.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
crl: is the crl to be verified
CA_list: is a certificate list that is considered to be trusted one
CA_list_length: holds the number of CA certificates in CA_list
flags: Flags that may be used to change the verification algorithm. Use OR of the gnutls_certificate_verify_flags enumerations.
verify: will hold the crl verification output.
This function will try to verify the given crl and return its status.
See gnutls_x509_crt_list_verify() for a detailed description of
return values.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.and a negative value in case of an error.
crq: The structure to be initialized
This function will deinitialize a CRL structure.
crq: Holds the request
format: the format of output params. One of PEM or DER.
output_data: will contain a certificate request PEM or DER encoded
output_data_size: holds the size of output_data (and will be replaced by the actual size of parameters)
This function will export the certificate request to a PKCS10
If the buffer provided is not long enough to hold the output, then GNUTLS_E_SHORT_MEMORY_BUFFER will be returned and *output_data_size will be updated.
If the structure is PEM encoded, it will have a header of "BEGIN NEW CERTIFICATE REQUEST".
Return value: In case of failure a negative value will be returned, and 0 on success.
crq: should contain a gnutls_x509_crq_t structure
oid: holds an Object Identified in null terminated string
indx: In case multiple same OIDs exist in the attribute list, this specifies which to send. Use zero to get the first one.
buf: a pointer to a structure to hold the attribute data (may be null)
sizeof_buf: initially holds the size of buf
This function will return the attribute in the certificate request specified by the given Object ID. The attribute will be DER encoded.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
crq: should contain a gnutls_x509_crq_t structure
pass: will hold a null terminated password
sizeof_pass: Initially holds the size of pass.
This function will return the challenge password in the request.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
crq: should contain a gnutls_x509_crq_t structure
oid: holds an Object Identified in null terminated string
indx: In case multiple same OIDs exist in the RDN, this specifies which to send. Use zero to get the first one.
raw_flag: If non zero returns the raw DER data of the DN part.
buf: a pointer to a structure to hold the name (may be null)
sizeof_buf: initially holds the size of buf
This function will extract the part of the name of the Certificate request subject, specified by the given OID. The output will be encoded as described in RFC2253. The output string will be ASCII or UTF-8 encoded, depending on the certificate data.
Some helper macros with popular OIDs can be found in gnutls/x509.h
If raw flag is zero, this function will only return known OIDs as
text. Other OIDs will be DER encoded, as described in RFC2253 -
in hex format with a '\#' prefix. You can check about known OIDs
using gnutls_x509_dn_oid_known().
If buf is null then only the size will be filled.
Returns: GNUTLS_E_SHORT_MEMORY_BUFFER if the provided buffer is not long enough, and in that case the *sizeof_buf will be updated with the required size. On success 0 is returned.
crq: should contain a gnutls_x509_crq_t structure
indx: Specifies which DN OID to send. Use zero to get the first one.
oid: a pointer to a structure to hold the name (may be null)
sizeof_oid: initially holds the size of oid
This function will extract the requested OID of the name of the Certificate request subject, specified by the given index.
If oid is null then only the size will be filled.
Returns: GNUTLS_E_SHORT_MEMORY_BUFFER if the provided buffer is not long enough, and in that case the *sizeof_oid will be updated with the required size. On success 0 is returned.
crq: should contain a gnutls_x509_crq_t structure
buf: a pointer to a structure to hold the name (may be null)
sizeof_buf: initially holds the size of buf
This function will copy the name of the Certificate request subject in the provided buffer. The name will be in the form "C=xxxx,O=yyyy,CN=zzzz" as described in RFC2253. The output string will be ASCII or UTF-8 encoded, depending on the certificate data.
If buf is null then only the size will be filled.
Returns: GNUTLS_E_SHORT_MEMORY_BUFFER if the provided buffer is not long enough, and in that case the *sizeof_buf will be updated with the required size. On success 0 is returned.
crq: should contain a gnutls_x509_crq_t structure
bits: if bits is non null it will hold the size of the parameters' in bits
This function will return the public key algorithm of a PKCS \10
certificate request.
If bits is non null, it should have enough size to hold the parameters size in bits. For RSA the bits returned is the modulus. For DSA the bits returned are of the public exponent.
Returns: a member of the gnutls_pk_algorithm_t enumeration on
success, or a negative value on error.
crq: should contain a gnutls_x509_crq_t structure
This function will return the version of the specified Certificate request.
Returns: version of certificate request, or a negative value on error.
crq: The structure to store the parsed certificate request.
data: The DER or PEM encoded certificate.
format: One of DER or PEM
This function will convert the given DER or PEM encoded Certificate
to the native gnutls_x509_crq_t format. The output will be stored in cert.
If the Certificate is PEM encoded it should have a header of "NEW CERTIFICATE REQUEST".
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
crq: The structure to be initialized
This function will initialize a PKCS10 certificate request structure.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
crq: should contain a gnutls_x509_crq_t structure
oid: holds an Object Identified in null terminated string
buf: a pointer to a structure that holds the attribute data
sizeof_buf: holds the size of buf
This function will set the attribute in the certificate request specified by the given Object ID. The attribute must be be DER encoded.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
crq: should contain a gnutls_x509_crq_t structure
pass: holds a null terminated password
This function will set a challenge password to be used when revoking the request.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
crq: should contain a gnutls_x509_crq_t structure
oid: holds an Object Identifier in a null terminated string
raw_flag: must be 0, or 1 if the data are DER encoded
data: a pointer to the input data
sizeof_data: holds the size of data
This function will set the part of the name of the Certificate request subject, specified by the given OID. The input string should be ASCII or UTF-8 encoded.
Some helper macros with popular OIDs can be found in gnutls/x509.h
With this function you can only set the known OIDs. You can test
for known OIDs using gnutls_x509_dn_oid_known(). For OIDs that are
not known (by gnutls) you should properly DER encode your data, and
call this function with raw_flag set.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
crq: should contain a gnutls_x509_crq_t structure
m: holds the modulus
e: holds the public exponent
This function will set the public parameters from the given private key to the request. Only RSA keys are currently supported.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
Since: 2.6.0
crq: should contain a gnutls_x509_crq_t structure
key: holds a private key
This function will set the public parameters from the given private key to the request. Only RSA keys are currently supported.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
crq: should contain a gnutls_x509_crq_t structure
version: holds the version number. For v1 Requests must be 1.
This function will set the version of the certificate request. For version 1 requests this must be one.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
crq: should contain a gnutls_x509_crq_t structure
key: holds a private key
dig: The message digest to use, GNUTLS_DIG_SHA1 is the safe choice unless you know what you're doing.
flags: must be 0
This function will sign the certificate request with a private key.
This must be the same key as the one used in
gnutls_x509_crt_set_key() since a certificate request is self
signed.
This must be the last step in a certificate request generation since all the previously set parameters are now signed.
Returns: GNUTLS_E_SUCCESS on success, otherwise an error.
GNUTLS_E_ASN1_VALUE_NOT_FOUND is returned if you didn't set all
information in the certificate request (e.g., the version using
gnutls_x509_crq_set_version()).
crq: should contain a gnutls_x509_crq_t structure
key: holds a private key
This function is the same a gnutls_x509_crq_sign2() with no flags, and
SHA1 as the hash algorithm.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
cert: should contain an gnutls_x509_crt_t structure
hostname: A null terminated string that contains a DNS name
This function will check if the given certificate's subject matches the given hostname. This is a basic implementation of the matching described in RFC2818 (HTTPS), which takes into account wildcards, and the DNSName/IPAddress subject alternative name PKIX extension.
Returns: non zero for a successful match, and zero on failure.
cert: is the certificate to be checked
issuer: is the certificate of a possible issuer
This function will check if the given certificate was issued by the given issuer. It will return true (1) if the given certificate is issued by the given issuer, and false (0) if not.
A negative value is returned in case of an error.
cert: should contain a gnutls_x509_crt_t structure
crl_list: should contain a list of gnutls_x509_crl_t structures
crl_list_length: the length of the crl_list
This function will return check if the given certificate is revoked. It is assumed that the CRLs have been verified before.
Returns: 0 if the certificate is NOT revoked, and 1 if it is. A negative value is returned on error.
dst: a certificate of type gnutls_x509_crt_t
src: the certificate where the dist points will be copied from
This function will copy the CRL distribution points certificate extension, from the source to the destination certificate. This may be useful to copy from a CA certificate to issued ones.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
cert: The structure to be initialized
This function will deinitialize a CRL structure.
cert: Holds the certificate
format: the format of output params. One of PEM or DER.
output_data: will contain a certificate PEM or DER encoded
output_data_size: holds the size of output_data (and will be replaced by the actual size of parameters)
This function will export the certificate to DER or PEM format.
If the buffer provided is not long enough to hold the output, then *output_data_size is updated and GNUTLS_E_SHORT_MEMORY_BUFFER will be returned.
If the structure is PEM encoded, it will have a header of "BEGIN CERTIFICATE".
Return value: In case of failure a negative value will be returned, and 0 on success.
cert: should contain a gnutls_x509_crt_t structure
This function will return the time this Certificate was or will be activated.
Returns: activation time, or (time_t)-1 on error.
cert: should contain a gnutls_x509_crt_t structure
critical: will be non zero if the extension is marked as critical (may be null)
This function will return the X.509v3 certificate authority's key identifier. This is obtained by the X.509 Authority Key identifier extension field (2.5.29.35). Note that this function only returns the keyIdentifier field of the extension.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.and a negative value in case of an error.
cert: should contain a gnutls_x509_crt_t structure
critical: will be non zero if the extension is marked as critical
ca: pointer to output integer indicating CA status, may be NULL, value is 1 if the certificate CA flag is set, 0 otherwise.
pathlen: pointer to output integer indicating path length (may be NULL), non-negative values indicate a present pathLenConstraint field and the actual value, -1 indicate that the field is absent.
This function will read the certificate's basic constraints, and return the certificates CA status. It reads the basicConstraints X.509 extension (2.5.29.19).
Return value: If the certificate is a CA a positive value will be returned, or zero if the certificate does not have CA flag set. A negative value may be returned in case of errors. If the certificate does not contain the basicConstraints extension GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE will be returned.
cert: should contain a gnutls_x509_crt_t structure
critical: will be non zero if the extension is marked as critical
This function will return certificates CA status, by reading the basicConstraints X.509 extension (2.5.29.19). If the certificate is a CA a positive value will be returned, or zero if the certificate does not have CA flag set.
Use gnutls_x509_crt_get_basic_constraints() if you want to read the
pathLenConstraint field too.
A negative value may be returned in case of parsing error. If the certificate does not contain the basicConstraints extension GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE will be returned.
cert: should contain a gnutls_x509_crt_t structure
seq: specifies the sequence number of the distribution point (0 for the first one, 1 for the second etc.)
ret: is the place where the distribution point will be copied to
ret_size: holds the size of ret.
reason_flags: Revocation reasons flags.
critical: will be non zero if the extension is marked as critical (may be null)
This function will return the CRL distribution points (2.5.29.31), contained in the given certificate.
reason_flags should be an ORed sequence of
GNUTLS_CRL_REASON_UNUSED, GNUTLS_CRL_REASON_KEY_COMPROMISE,
GNUTLS_CRL_REASON_CA_COMPROMISE,
GNUTLS_CRL_REASON_AFFILIATION_CHANGED,
GNUTLS_CRL_REASON_SUPERSEEDED,
GNUTLS_CRL_REASON_CESSATION_OF_OPERATION,
GNUTLS_CRL_REASON_CERTIFICATE_HOLD,
GNUTLS_CRL_REASON_PRIVILEGE_WITHDRAWN,
GNUTLS_CRL_REASON_AA_COMPROMISE, or zero for all possible reasons.
This is specified in X509v3 Certificate Extensions. GNUTLS will return the distribution point type, or a negative error code on error.
Returns: GNUTLS_E_SHORT_MEMORY_BUFFER and updates &ret_size if
&ret_size is not enough to hold the distribution point, or the
type of the distribution point if everything was ok. The type is
one of the enumerated gnutls_x509_subject_alt_name_t. If the
certificate does not have an Alternative name with the specified
sequence number then GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE is
returned.
cert: should contain a gnutls_x509_crt_t structure
oid: holds an Object Identified in null terminated string
indx: In case multiple same OIDs exist in the RDN, this specifies which to send. Use zero to get the first one.
raw_flag: If non zero returns the raw DER data of the DN part.
buf: a pointer where the DN part will be copied (may be null).
sizeof_buf: initially holds the size of buf
This function will extract the part of the name of the Certificate subject specified by the given OID. The output, if the raw flag is not used, will be encoded as described in RFC2253. Thus a string that is ASCII or UTF-8 encoded, depending on the certificate data.
Some helper macros with popular OIDs can be found in gnutls/x509.h
If raw flag is zero, this function will only return known OIDs as
text. Other OIDs will be DER encoded, as described in RFC2253 -
in hex format with a '\#' prefix. You can check about known OIDs
using gnutls_x509_dn_oid_known().
If buf is null then only the size will be filled.
Returns: GNUTLS_E_SHORT_MEMORY_BUFFER if the provided buffer is not long enough, and in that case the *sizeof_buf will be updated with the required size. On success 0 is returned.
cert: should contain a gnutls_x509_crt_t structure
indx: This specifies which OID to return. Use zero to get the first one.
oid: a pointer to a buffer to hold the OID (may be null)
sizeof_oid: initially holds the size of oid
This function will extract the OIDs of the name of the Certificate subject specified by the given index.
If oid is null then only the size will be filled.
Returns: GNUTLS_E_SHORT_MEMORY_BUFFER if the provided buffer is not long enough, and in that case the *sizeof_oid will be updated with the required size. On success 0 is returned.
cert: should contain a gnutls_x509_crt_t structure
buf: a pointer to a structure to hold the name (may be null)
sizeof_buf: initially holds the size of buf
This function will copy the name of the Certificate in the provided buffer. The name will be in the form "C=xxxx,O=yyyy,CN=zzzz" as described in RFC2253. The output string will be ASCII or UTF-8 encoded, depending on the certificate data.
If buf is null then only the size will be filled.
Returns: GNUTLS_E_SHORT_MEMORY_BUFFER if the provided buffer is not long enough, and in that case the *sizeof_buf will be updated with the required size. On success 0 is returned.
cert: should contain a gnutls_x509_crt_t structure
This function will return the time this Certificate was or will be expired.
Returns: expiration time, or (time_t)-1 on error.
cert: should contain a gnutls_x509_crt_t structure
oid: holds an Object Identified in null terminated string
indx: In case multiple same OIDs exist in the extensions, this specifies which to send. Use zero to get the first one.
buf: a pointer to a structure to hold the name (may be null)
sizeof_buf: initially holds the size of buf
critical: will be non zero if the extension is marked as critical
This function will return the extension specified by the OID in the certificate. The extensions will be returned as binary data DER encoded, in the provided buffer.
A negative value may be returned in case of parsing error. If the certificate does not contain the specified extension GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE will be returned.
cert: should contain a gnutls_x509_crt_t structure
indx: Specifies which extension OID to send. Use zero to get the first one.
data: a pointer to a structure to hold the data (may be null)
sizeof_data: initially holds the size of oid
This function will return the requested extension data in the certificate. The extension data will be stored as a string in the provided buffer.
Use gnutls_x509_crt_get_extension_info() to extract the OID and
critical flag. Use gnutls_x509_crt_get_extension_by_oid() instead,
if you want to get data indexed by the extension OID rather than
sequence.
Return 0 on success. A negative value may be returned in case of parsing error. If you have reached the last extension available GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE will be returned.
cert: should contain a gnutls_x509_crt_t structure
indx: Specifies which extension OID to send. Use zero to get the first one.
oid: a pointer to a structure to hold the OID
sizeof_oid: initially holds the maximum size of oid, on return
holds actual size of oid.
critical: output variable with critical flag, may be NULL.
This function will return the requested extension OID in the
certificate, and the critical flag for it. The extension OID will
be stored as a string in the provided buffer. Use
gnutls_x509_crt_get_extension_data() to extract the data.
If the buffer provided is not long enough to hold the output, then
*sizeof_oid is updated and GNUTLS_E_SHORT_MEMORY_BUFFER will be
returned.
Return 0 on success. A negative value may be returned in case of parsing error. If you have reached the last extension available GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE will be returned.
cert: should contain a gnutls_x509_crt_t structure
indx: Specifies which extension OID to send. Use zero to get the first one.
oid: a pointer to a structure to hold the OID (may be null)
sizeof_oid: initially holds the size of oid
This function will return the requested extension OID in the certificate. The extension OID will be stored as a string in the provided buffer.
A negative value may be returned in case of parsing error. If your have reached the last extension available GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE will be returned.
cert: should contain a gnutls_x509_crt_t structure
algo: is a digest algorithm
buf: a pointer to a structure to hold the fingerprint (may be null)
sizeof_buf: initially holds the size of buf
This function will calculate and copy the certificate's fingerprint in the provided buffer.
If the buffer is null then only the size will be filled.
Returns: GNUTLS_E_SHORT_MEMORY_BUFFER if the provided buffer is
not long enough, and in that case the *sizeof_buf will be updated
with the required size. On success 0 is returned.
cert: should contain a gnutls_x509_crt_t structure
oid: holds an Object Identified in null terminated string
indx: In case multiple same OIDs exist in the RDN, this specifies which to send. Use zero to get the first one.
raw_flag: If non zero returns the raw DER data of the DN part.
buf: a pointer to a structure to hold the name (may be null)
sizeof_buf: initially holds the size of buf
This function will extract the part of the name of the Certificate issuer specified by the given OID. The output, if the raw flag is not used, will be encoded as described in RFC2253. Thus a string that is ASCII or UTF-8 encoded, depending on the certificate data.
Some helper macros with popular OIDs can be found in gnutls/x509.h
If raw flag is zero, this function will only return known OIDs as
text. Other OIDs will be DER encoded, as described in RFC2253 -
in hex format with a '\#' prefix. You can check about known OIDs
using gnutls_x509_dn_oid_known().
If buf is null then only the size will be filled.
Returns: GNUTLS_E_SHORT_MEMORY_BUFFER if the provided buffer is not long enough, and in that case the *sizeof_buf will be updated with the required size. On success 0 is returned.
cert: should contain a gnutls_x509_crt_t structure
indx: This specifies which OID to return. Use zero to get the first one.
oid: a pointer to a buffer to hold the OID (may be null)
sizeof_oid: initially holds the size of oid
This function will extract the OIDs of the name of the Certificate issuer specified by the given index.
If oid is null then only the size will be filled.
Returns: GNUTLS_E_SHORT_MEMORY_BUFFER if the provided buffer is not long enough, and in that case the *sizeof_oid will be updated with the required size. On success 0 is returned.
cert: should contain a gnutls_x509_crt_t structure
buf: a pointer to a structure to hold the name (may be null)
sizeof_buf: initially holds the size of buf
This function will copy the name of the Certificate issuer in the provided buffer. The name will be in the form "C=xxxx,O=yyyy,CN=zzzz" as described in RFC2253. The output string will be ASCII or UTF-8 encoded, depending on the certificate data.
If buf is null then only the size will be filled.
Returns: GNUTLS_E_SHORT_MEMORY_BUFFER if the provided buffer is not long enough, and in that case the *sizeof_buf will be updated with the required size. On success 0 is returned.
cert: should contain a gnutls_x509_crt_t structure
dn: output variable with pointer to opaque DN
Return the Certificate's Issuer DN as an opaque data type. You may
use gnutls_x509_dn_get_rdn_ava() to decode the DN.
Note that dn should be treated as constant. Because points
into the cert object, you may not deallocate cert
and continue to access dn.
Returns: Returns 0 on success, or an error code.
crt: Holds the certificate
flags: should be 0 for now
output_data: will contain the key ID
output_data_size: holds the size of output_data (and will be replaced by the actual size of parameters)
This function will return a unique ID the depends on the public key parameters. This ID can be used in checking whether a certificate corresponds to the given private key.
If the buffer provided is not long enough to hold the output, then *output_data_size is updated and GNUTLS_E_SHORT_MEMORY_BUFFER will be returned. The output will normally be a SHA-1 hash output, which is 20 bytes.
Return value: In case of failure a negative value will be returned, and 0 on success.
cert: should contain a gnutls_x509_crt_t structure
indx: This specifies which OID to return. Use zero to get the first one.
oid: a pointer to a buffer to hold the OID (may be null)
sizeof_oid: initially holds the size of oid
This function will extract the key purpose OIDs of the Certificate specified by the given index. These are stored in the Extended Key Usage extension (2.5.29.37) See the GNUTLS_KP_* definitions for human readable names.
If oid is null then only the size will be filled.
Returns: GNUTLS_E_SHORT_MEMORY_BUFFER if the provided buffer is
not long enough, and in that case the *sizeof_oid will be updated
with the required size. On success 0 is returned.
cert: should contain a gnutls_x509_crt_t structure
key_usage: where the key usage bits will be stored
critical: will be non zero if the extension is marked as critical
This function will return certificate's key usage, by reading the keyUsage X.509 extension (2.5.29.15). The key usage value will
ORed values of the: GNUTLS_KEY_DIGITAL_SIGNATURE,
GNUTLS_KEY_NON_REPUDIATION, GNUTLS_KEY_KEY_ENCIPHERMENT,
GNUTLS_KEY_DATA_ENCIPHERMENT, GNUTLS_KEY_KEY_AGREEMENT,
GNUTLS_KEY_KEY_CERT_SIGN, GNUTLS_KEY_CRL_SIGN,
GNUTLS_KEY_ENCIPHER_ONLY, GNUTLS_KEY_DECIPHER_ONLY.
Returns: the certificate key usage, or a negative value in case of
parsing error. If the certificate does not contain the keyUsage
extension GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE will be returned.
cert: should contain a gnutls_x509_crt_t structure
bits: if bits is non null it will hold the size of the parameters' in bits
This function will return the public key algorithm of an X.509 certificate.
If bits is non null, it should have enough size to hold the parameters size in bits. For RSA the bits returned is the modulus. For DSA the bits returned are of the public exponent.
Returns: a member of the gnutls_pk_algorithm_t enumeration on
success, or a negative value on error.
crt: Holds the certificate
p: will hold the p
q: will hold the q
g: will hold the g
y: will hold the y
This function will export the DSA public key's parameters found in
the given certificate. The new parameters will be allocated using
gnutls_malloc() and will be stored in the appropriate datum.
Returns: GNUTLS_E_SUCCESS on success, otherwise an error.
crt: Holds the certificate
m: will hold the modulus
e: will hold the public exponent
This function will export the RSA public key's parameters found in
the given structure. The new parameters will be allocated using
gnutls_malloc() and will be stored in the appropriate datum.
Returns: GNUTLS_E_SUCCESS on success, otherwise an error.
cert: should contain a gnutls_x509_crt_t structure
critical: will be non zero if the extension is marked as critical
pathlen: pointer to output integer indicating path length (may be NULL), non-negative values indicate a present pCPathLenConstraint field and the actual value, -1 indicate that the field is absent.
This function will read the certificate's basic constraints, and return the certificates CA status. It reads the basicConstraints X.509 extension (2.5.29.19).
Return value: If the certificate is a CA a positive value will be returned, or zero if the certificate does not have CA flag set. A negative value may be returned in case of errors. If the certificate does not contain the basicConstraints extension GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE will be returned.
cert: should contain a gnutls_x509_crt_t structure
start: will hold the starting point of the DN
This function will return a pointer to the DER encoded DN structure and the length.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value. or a negative value on error.
cert: should contain a gnutls_x509_crt_t structure
start: will hold the starting point of the DN
This function will return a pointer to the DER encoded DN structure and the length.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.or a negative value on error.
cert: should contain a gnutls_x509_crt_t structure
result: The place where the serial number will be copied
result_size: Holds the size of the result field.
This function will return the X.509 certificate's serial number. This is obtained by the X509 Certificate serialNumber field. Serial is not always a 32 or 64bit number. Some CAs use large serial numbers, thus it may be wise to handle it as something opaque.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.and a negative value in case of an error.
cert: should contain a gnutls_x509_crt_t structure
This function will return a value of the gnutls_sign_algorithm_t
enumeration that is the signature algorithm.
Returns: a gnutls_sign_algorithm_t value, or a negative value on
error.
cert: should contain a gnutls_x509_crt_t structure
sig: a pointer where the signature part will be copied (may be null).
sizeof_sig: initially holds the size of sig
This function will extract the signature field of a certificate.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value. and a negative value on error.
cert: should contain a gnutls_x509_crt_t structure
seq: specifies the sequence number of the alt name (0 for the first one, 1 for the second etc.)
ret: is the place where the alternative name will be copied to
ret_size: holds the size of ret.
ret_type: holds the type of the alternative name (one of gnutls_x509_subject_alt_name_t).
critical: will be non zero if the extension is marked as critical (may be null)
This function will return the alternative names, contained in the
given certificate. It is the same as gnutls_x509_crt_get_subject_alt_name()
except for the fact that it will return the type of the alternative
name in ret_type even if the function fails for some reason (i.e.
the buffer provided is not enough).
The return values are the same as with gnutls_x509_crt_get_subject_alt_name().
cert: should contain a gnutls_x509_crt_t structure
seq: specifies the sequence number of the alt name (0 for the first one, 1 for the second etc.)
ret: is the place where the alternative name will be copied to
ret_size: holds the size of ret.
critical: will be non zero if the extension is marked as critical (may be null)
This function will return the alternative names, contained in the given certificate.
This is specified in X509v3 Certificate Extensions. GNUTLS will return the Alternative name (2.5.29.17), or a negative error code.
When the SAN type is otherName, it will extract the data in the
otherName's value field, and GNUTLS_SAN_OTHERNAME is returned.
You may use gnutls_x509_crt_get_subject_alt_othername_oid() to get
the corresponding OID and the "virtual" SAN types (e.g.,
GNUTLS_SAN_OTHERNAME_XMPP).
If an otherName OID is known, the data will be decoded. Otherwise the returned data will be DER encoded, and you will have to decode it yourself. Currently, only the RFC 3920 id-on-xmppAddr SAN is recognized.
Returns: the alternative subject name type on success, one of the
enumerated gnutls_x509_subject_alt_name_t. It will return
GNUTLS_E_SHORT_MEMORY_BUFFER if ret_size is not large enough to
hold the value. In that case ret_size will be updated with the
required size. If the certificate does not have an Alternative
name with the specified sequence number then
GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE is returned.
cert: should contain a gnutls_x509_crt_t structure
seq: specifies the sequence number of the alt name (0 for the first one, 1 for the second etc.)
ret: is the place where the otherName OID will be copied to
ret_size: holds the size of ret.
This function will extract the type OID of an otherName Subject Alternative Name, contained in the given certificate, and return the type as an enumerated element.
This function is only useful if
gnutls_x509_crt_get_subject_alt_name() returned
GNUTLS_SAN_OTHERNAME.
Returns: the alternative subject name type on success, one of the
enumerated gnutls_x509_subject_alt_name_t. For supported OIDs, it
will return one of the virtual (GNUTLS_SAN_OTHERNAME_*) types,
e.g. GNUTLS_SAN_OTHERNAME_XMPP, and GNUTLS_SAN_OTHERNAME for
unknown OIDs. It will return GNUTLS_E_SHORT_MEMORY_BUFFER if
ret_size is not large enough to hold the value. In that case
ret_size will be updated with the required size. If the
certificate does not have an Alternative name with the specified
sequence number and with the otherName type then
GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE is returned.
cert: should contain a gnutls_x509_crt_t structure
ret: The place where the identifier will be copied
ret_size: Holds the size of the result field.
critical: will be non zero if the extension is marked as critical (may be null)
This function will return the X.509v3 certificate's subject key identifier. This is obtained by the X.509 Subject Key identifier extension field (2.5.29.14).
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.and a negative value in case of an error.
cert: should contain a gnutls_x509_crt_t structure
dn: output variable with pointer to opaque DN.
Return the Certificate's Subject DN as an opaque data type. You
may use gnutls_x509_dn_get_rdn_ava() to decode the DN.
Note that dn should be treated as constant. Because points
into the cert object, you may not deallocate cert
and continue to access dn.
Returns: Returns 0 on success, or an error code.
cert: should contain a gnutls_x509_crt_t structure
This function will return the version of the specified Certificate.
Returns: version of certificate, or a negative value on error.
cert: The structure to store the parsed certificate.
data: The DER or PEM encoded certificate.
format: One of DER or PEM
This function will convert the given DER or PEM encoded Certificate
to the native gnutls_x509_crt_t format. The output will be stored in cert.
If the Certificate is PEM encoded it should have a header of "X509 CERTIFICATE", or "CERTIFICATE".
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
cert: The structure to be initialized
This function will initialize an X.509 certificate structure.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
certs: The structures to store the parsed certificate. Must not be initialized.
cert_max: Initially must hold the maximum number of certs. It will be updated with the number of certs available.
data: The PEM encoded certificate.
format: One of DER or PEM.
flags: must be zero or an OR'd sequence of gnutls_certificate_import_flags.
This function will convert the given PEM encoded certificate list
to the native gnutls_x509_crt_t format. The output will be stored
in certs. They will be automatically initialized.
If the Certificate is PEM encoded it should have a header of "X509 CERTIFICATE", or "CERTIFICATE".
Returns: the number of certificates read or a negative error value.
cert_list: is the certificate list to be verified
cert_list_length: holds the number of certificate in cert_list
CA_list: is the CA list which will be used in verification
CA_list_length: holds the number of CA certificate in CA_list
CRL_list: holds a list of CRLs.
CRL_list_length: the length of CRL list.
flags: Flags that may be used to change the verification algorithm. Use OR of the gnutls_certificate_verify_flags enumerations.
verify: will hold the certificate verification output.
This function will try to verify the given certificate list and return its status. If no flags are specified (0), this function will use the basicConstraints (2.5.29.19) PKIX extension. This means that only a certificate authority is allowed to sign a certificate.
You must also check the peer's name in order to check if the verified certificate belongs to the actual peer.
The certificate verification output will be put in verify and will be
one or more of the gnutls_certificate_status_t enumerated elements bitwise or'd.
For a more detailed verification status use gnutls_x509_crt_verify() per list
element.
GNUTLS_CERT_INVALID: the certificate chain is not valid.
GNUTLS_CERT_REVOKED: a certificate in the chain has been revoked.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.and a negative value in case of an error.
cert: The structure to be printed
format: Indicate the format to use
out: Newly allocated datum with zero terminated string.
This function will pretty print a X.509 certificate, suitable for display to a human.
If the format is GNUTLS_CRT_PRINT_FULL then all fields of the
certificate will be output, on multiple lines. The
GNUTLS_CRT_PRINT_ONELINE format will generate one line with some
selected fields, which is useful for logging purposes.
The output out needs to be deallocate using gnutls_free().
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
cert: a certificate of type gnutls_x509_crt_t
act_time: The actual time
This function will set the time this Certificate was or will be activated.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
cert: a certificate of type gnutls_x509_crt_t
id: The key ID
id_size: Holds the size of the serial field.
This function will set the X.509 certificate's authority key ID extension. Only the keyIdentifier field can be set with this function.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
crt: a certificate of type gnutls_x509_crt_t
ca: true(1) or false(0). Depending on the Certificate authority status.
pathLenConstraint: non-negative values indicate maximum length of path, and negative values indicate that the pathLenConstraints field should not be present.
This function will set the basicConstraints certificate extension.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
crt: a certificate of type gnutls_x509_crt_t
ca: true(1) or false(0). Depending on the Certificate authority status.
This function will set the basicConstraints certificate extension.
Use gnutls_x509_crt_set_basic_constraints() if you want to control
the pathLenConstraint field too.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
crt: a certificate of type gnutls_x509_crt_t
type: is one of the gnutls_x509_subject_alt_name_t enumerations
data: The data to be set
data_size: The data size
reason_flags: revocation reasons
This function will set the CRL distribution points certificate extension.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
Since: 2.6.0
crt: a certificate of type gnutls_x509_crt_t
type: is one of the gnutls_x509_subject_alt_name_t enumerations
data_string: The data to be set
reason_flags: revocation reasons
This function will set the CRL distribution points certificate extension.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
crt: a certificate of type gnutls_x509_crt_t
crq: holds a certificate request
This function will set the name and public parameters from the given certificate request to the certificate. Only RSA keys are currently supported.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
crt: a certificate of type gnutls_x509_crt_t
oid: holds an Object Identifier in a null terminated string
raw_flag: must be 0, or 1 if the data are DER encoded
name: a pointer to the name
sizeof_name: holds the size of name
This function will set the part of the name of the Certificate subject, specified by the given OID. The input string should be ASCII or UTF-8 encoded.
Some helper macros with popular OIDs can be found in gnutls/x509.h
With this function you can only set the known OIDs. You can test
for known OIDs using gnutls_x509_dn_oid_known(). For OIDs that are
not known (by gnutls) you should properly DER encode your data,
and call this function with raw_flag set.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
cert: a certificate of type gnutls_x509_crt_t
exp_time: The actual time
This function will set the time this Certificate will expire.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
crt: a certificate of type gnutls_x509_crt_t
oid: holds an Object Identified in null terminated string
buf: a pointer to a DER encoded data
sizeof_buf: holds the size of buf
critical: should be non zero if the extension is to be marked as critical
This function will set an the extension, by the specified OID, in the certificate. The extension data should be binary data DER encoded.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.and a negative value in case of an error.
crt: a certificate of type gnutls_x509_crt_t
oid: holds an Object Identifier in a null terminated string
raw_flag: must be 0, or 1 if the data are DER encoded
name: a pointer to the name
sizeof_name: holds the size of name
This function will set the part of the name of the Certificate issuer, specified by the given OID. The input string should be ASCII or UTF-8 encoded.
Some helper macros with popular OIDs can be found in gnutls/x509.h
With this function you can only set the known OIDs. You can test
for known OIDs using gnutls_x509_dn_oid_known(). For OIDs that are
not known (by gnutls) you should properly DER encode your data,
and call this function with raw_flag set.
Normally you do not need to call this function, since the signing operation will copy the signer's name as the issuer of the certificate.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
cert: a certificate of type gnutls_x509_crt_t
oid: a pointer to a null terminated string that holds the OID
critical: Whether this extension will be critical or not
This function will set the key purpose OIDs of the Certificate. These are stored in the Extended Key Usage extension (2.5.29.37) See the GNUTLS_KP_* definitions for human readable names.
Subsequent calls to this function will append OIDs to the OID list.
On success 0 is returned.
crt: a certificate of type gnutls_x509_crt_t
usage: an ORed sequence of the GNUTLS_KEY_* elements.
This function will set the keyUsage certificate extension.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
crt: a certificate of type gnutls_x509_crt_t
key: holds a private key
This function will set the public parameters from the given private key to the certificate. Only RSA keys are currently supported.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
crt: a gnutls_x509_crt_t structure with the new proxy cert
eecrt: the end entity certificate that will be issuing the proxy
raw_flag: must be 0, or 1 if the CN is DER encoded
name: a pointer to the CN name, may be NULL (but MUST then be added later)
sizeof_name: holds the size of name
This function will set the subject in crt to the end entity's
eecrt subject name, and add a single Common Name component name
of size sizeof_name. This corresponds to the required proxy
certificate naming style. Note that if name is NULL, you MUST
set it later by using gnutls_x509_crt_set_dn_by_oid() or similar.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
crt: a certificate of type gnutls_x509_crt_t
pathLenConstraint: non-negative values indicate maximum length of path, and negative values indicate that the pathLenConstraints field should not be present.
policyLanguage: OID describing the language of policy.
policy: opaque byte array with policy language, can be NULL
sizeof_policy: size of policy.
This function will set the proxyCertInfo extension.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
cert: a certificate of type gnutls_x509_crt_t
serial: The serial number
serial_size: Holds the size of the serial field.
This function will set the X.509 certificate's serial number. Serial is not always a 32 or 64bit number. Some CAs use large serial numbers, thus it may be wise to handle it as something opaque.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
crt: a certificate of type gnutls_x509_crt_t
type: is one of the gnutls_x509_subject_alt_name_t enumerations
data: The data to be set
data_size: The size of data to be set
flags: GNUTLS_FSAN_SET to clear previous data or GNUTLS_FSAN_APPEND to append.
This function will set the subject alternative name certificate extension. It can set the following types:
&GNUTLS_SAN_DNSNAME: as a text string
&GNUTLS_SAN_RFC822NAME: as a text string
&GNUTLS_SAN_URI: as a text string
&GNUTLS_SAN_IPADDRESS: as a binary IP address (4 or 16 bytes)
Other values can be set as binary values with the proper DER encoding.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
Since: 2.6.0
crt: a certificate of type gnutls_x509_crt_t
type: is one of the gnutls_x509_subject_alt_name_t enumerations
data_string: The data to be set, a zero terminated string
This function will set the subject alternative name certificate extension. This function assumes that data can be expressed as a null terminated string.
The name of the function is unfortunate since it is incosistent with
gnutls_x509_crt_get_subject_alt_name().
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
cert: a certificate of type gnutls_x509_crt_t
id: The key ID
id_size: Holds the size of the serial field.
This function will set the X.509 certificate's subject key ID extension.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
crt: a certificate of type gnutls_x509_crt_t
version: holds the version number. For X.509v1 certificates must be 1.
This function will set the version of the certificate. This must be one for X.509 version 1, and so on. Plain certificates without extensions must have version set to one.
To create well-formed certificates, you must specify version 3 if
you use any certificate extensions. Extensions are created by
functions such as gnutls_x509_crt_set_subject_alt_name()
or gnutls_x509_crt_set_key_usage().
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
crt: a certificate of type gnutls_x509_crt_t
issuer: is the certificate of the certificate issuer
issuer_key: holds the issuer's private key
dig: The message digest to use, GNUTLS_DIG_SHA1 is a safe choice
flags: must be 0
This function will sign the certificate with the issuer's private key, and will copy the issuer's information into the certificate.
This must be the last step in a certificate generation since all the previously set parameters are now signed.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
crt: a certificate of type gnutls_x509_crt_t
issuer: is the certificate of the certificate issuer
issuer_key: holds the issuer's private key
This function is the same a gnutls_x509_crt_sign2() with no flags,
and SHA1 as the hash algorithm.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
crt: Holds the certificate
flags: should be 0 for now
data: holds the data to be signed
signature: contains the signature
This function will verify the given signed data, using the parameters from the certificate.
Returns: In case of a verification failure 0 is returned, and 1 on success.
cert: is the certificate to be verified
CA_list: is one certificate that is considered to be trusted one
CA_list_length: holds the number of CA certificate in CA_list
flags: Flags that may be used to change the verification algorithm. Use OR of the gnutls_certificate_verify_flags enumerations.
verify: will hold the certificate verification output.
This function will try to verify the given certificate and return its status. The verification output in this functions cannot be GNUTLS_CERT_NOT_VALID.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.and a negative value in case of an error.
idn: a DN opaque object pointer.
This function deallocates the DN object as returned by
gnutls_x509_dn_import().
Since: 2.4.0
dn: Holds the opaque DN object
format: the format of output params. One of PEM or DER.
output_data: will contain a DN PEM or DER encoded
output_data_size: holds the size of output_data (and will be replaced by the actual size of parameters)
This function will export the DN to DER or PEM format.
If the buffer provided is not long enough to hold the output, then
*output_data_size is updated and GNUTLS_E_SHORT_MEMORY_BUFFER
will be returned.
If the structure is PEM encoded, it will have a header of "BEGIN NAME".
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
dn: input variable with opaque DN pointer
irdn: index of RDN
iava: index of AVA.
ava: Pointer to structure which will hold output information.
Get pointers to data within the DN.
Note that ava will contain pointers into the dn structure, so you
should not modify any data or deallocate it. Note also that the DN
in turn points into the original certificate structure, and thus
you may not deallocate the certificate and continue to access dn.
Returns: Returns 0 on success, or an error code.
odn: the structure that will hold the imported DN
data: should contain a DER encoded RDN sequence
This function parses an RDN sequence and stores the result to a
gnutls_x509_dn_t structure. The structure must have been initialized
with gnutls_x509_dn_init(). You may use gnutls_x509_dn_get_rdn_ava() to
decode the DN.
This function parses an RDN sequence and stores the result to a
gnutls_x509_dn_t structure. The structure must have been initialized
with gnutls_x509_dn_init(). You may use gnutls_x509_dn_get_rdn_ava() to
decode the DN.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
Since: 2.4.0
odn: the object to be initialized
This function initializes a gnutls_x509_dn_t structure.
The object returned must be deallocated using
gnutls_x509_dn_deinit().
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
Since: 2.4.0
oid: holds an Object Identifier in a null terminated string
This function will inform about known DN OIDs. This is useful since
functions like gnutls_x509_crt_set_dn_by_oid() use the information
on known OIDs to properly encode their input. Object Identifiers
that are not known are not encoded by these functions, and their
input is stored directly into the ASN.1 structure. In that case of
unknown OIDs, you have the responsibility of DER encoding your
data.
Returns: 1 on known OIDs and 0 otherwise.
dst: The destination key, which should be initialized.
src: The source key
This function will copy a private key from source to destination key.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
key: The structure to be initialized
This function will deinitialize a private key structure.
p: will hold the p
q: will hold the q
g: will hold the g
y: will hold the y
x: will hold the x
This function will export the DSA private key's parameters found
in the given structure. The new parameters will be allocated using
gnutls_malloc() and will be stored in the appropriate datum.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
key: Holds the key
format: the format of output params. One of PEM or DER.
password: the password that will be used to encrypt the key.
flags: an ORed sequence of gnutls_pkcs_encrypt_flags_t
output_data: will contain a private key PEM or DER encoded
output_data_size: holds the size of output_data (and will be replaced by the actual size of parameters)
This function will export the private key to a PKCS8 structure.
Both RSA and DSA keys can be exported. For DSA keys we use
PKCS 11 definitions. If the flags do not specify the encryption
cipher, then the default 3DES (PBES2) will be used.
The password can be either ASCII or UTF-8 in the default PBES2
encryption schemas, or ASCII for the PKCS12 schemas.
If the buffer provided is not long enough to hold the output, then *output_data_size is updated and GNUTLS_E_SHORT_MEMORY_BUFFER will be returned.
If the structure is PEM encoded, it will have a header of "BEGIN ENCRYPTED PRIVATE KEY" or "BEGIN PRIVATE KEY" if encryption is not used.
Return value: In case of failure a negative value will be returned, and 0 on success.
key: a structure that holds the rsa parameters
m: will hold the modulus
e: will hold the public exponent
d: will hold the private exponent
p: will hold the first prime (p)
q: will hold the second prime (q)
u: will hold the coefficient
This function will export the RSA private key's parameters found
in the given structure. The new parameters will be allocated using
gnutls_malloc() and will be stored in the appropriate datum.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
key: Holds the key
format: the format of output params. One of PEM or DER.
output_data: will contain a private key PEM or DER encoded
output_data_size: holds the size of output_data (and will be replaced by the actual size of parameters)
This function will export the private key to a PKCS1 structure for RSA keys, or an integer sequence for DSA keys. The DSA keys are in the same format with the parameters used by openssl.
If the buffer provided is not long enough to hold the output, then
*output_data_size is updated and GNUTLS_E_SHORT_MEMORY_BUFFER
will be returned.
If the structure is PEM encoded, it will have a header of "BEGIN RSA PRIVATE KEY".
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
key: Holds the key
This function will recalculate the secondary parameters in a key. In RSA keys, this can be the coefficient and exponent1,2.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
key: should contain a gnutls_x509_privkey_t structure
algo: is one of RSA or DSA.
bits: the size of the modulus
flags: unused for now. Must be 0.
This function will generate a random private key. Note that this function must be called on an empty private key.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
key: Holds the key
flags: should be 0 for now
output_data: will contain the key ID
output_data_size: holds the size of output_data (and will be replaced by the actual size of parameters)
This function will return a unique ID the depends on the public key parameters. This ID can be used in checking whether a certificate corresponds to the given key.
If the buffer provided is not long enough to hold the output, then
*output_data_size is updated and GNUTLS_E_SHORT_MEMORY_BUFFER will
be returned. The output will normally be a SHA-1 hash output,
which is 20 bytes.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
key: should contain a gnutls_x509_privkey_t structure
This function will return the public key algorithm of a private key.
Returns: a member of the gnutls_pk_algorithm_t enumeration on
success, or a negative value on error.
key: The structure to store the parsed key
p: holds the p
q: holds the q
g: holds the g
y: holds the y
x: holds the x
This function will convert the given DSA raw parameters to the
native gnutls_x509_privkey_t format. The output will be stored
in key.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
key: The structure to store the parsed key
data: The DER or PEM encoded key.
format: One of DER or PEM
password: the password to decrypt the key (if it is encrypted).
flags: 0 if encrypted or GNUTLS_PKCS_PLAIN if not encrypted.
This function will convert the given DER or PEM encoded PKCS8 2.0 encrypted key
to the native gnutls_x509_privkey_t format. The output will be stored in key.
Both RSA and DSA keys can be imported, and flags can only be used to indicate
an unencrypted key.
The password can be either ASCII or UTF-8 in the default PBES2
encryption schemas, or ASCII for the PKCS12 schemas.
If the Certificate is PEM encoded it should have a header of "ENCRYPTED PRIVATE KEY", or "PRIVATE KEY". You only need to specify the flags if the key is DER encoded, since in that case the encryption status cannot be auto-detected.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
key: The structure to store the parsed key
m: holds the modulus
e: holds the public exponent
d: holds the private exponent
p: holds the first prime (p)
q: holds the second prime (q)
u: holds the coefficient
This function will convert the given RSA raw parameters to the
native gnutls_x509_privkey_t format. The output will be stored in
key.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
key: The structure to store the parsed key
data: The DER or PEM encoded certificate.
format: One of DER or PEM
This function will convert the given DER or PEM encoded key to the
native gnutls_x509_privkey_t format. The output will be stored in
key .
If the key is PEM encoded it should have a header of "RSA PRIVATE KEY", or "DSA PRIVATE KEY".
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
key: The structure to be initialized
This function will initialize an private key structure.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
key: Holds the key
digest: should be MD5 or SHA1
flags: should be 0 for now
data: holds the data to be signed
signature: will contain the signature
signature_size: holds the size of signature (and will be replaced by the new size)
This function will sign the given data using a signature algorithm supported by the private key. Signature algorithms are always used together with a hash functions. Different hash functions may be used for the RSA algorithm, but only SHA-1 for the DSA keys.
If the buffer provided is not long enough to hold the output, then
*signature_size is updated and GNUTLS_E_SHORT_MEMORY_BUFFER will
be returned.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
key: Holds the key
hash: holds the data to be signed
signature: will contain newly allocated signature
This function will sign the given hash using the private key.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
key: Holds the key
flags: should be 0 for now
data: holds the data to be signed
signature: contains the signature
This function will verify the given signed data, using the parameters in the private key.
Returns: In case of a verification failure 0 is returned, and 1 on success.
idn: should contain a DER encoded RDN sequence
oid: an Object Identifier
indx: In case multiple same OIDs exist in the RDN indicates which to send. Use 0 for the first one.
raw_flag: If non zero then the raw DER data are returned.
buf: a pointer to a structure to hold the peer's name
sizeof_buf: holds the size of buf
This function will return the name of the given Object identifier, of the RDN sequence. The name will be encoded using the rules from RFC2253.
Returns: On success, GNUTLS_E_SUCCESS is returned, or
GNUTLS_E_SHORT_MEMORY_BUFFER is returned and *sizeof_buf is
updated if the provided buffer is not long enough, otherwise a
negative error value.
idn: should contain a DER encoded RDN sequence
indx: Indicates which OID to return. Use 0 for the first one.
This function will return the specified Object identifier, of the RDN sequence.
Returns: On success, GNUTLS_E_SUCCESS is returned, or
GNUTLS_E_SHORT_MEMORY_BUFFER is returned and *sizeof_buf is
updated if the provided buffer is not long enough, otherwise a
negative error value.
Since: 2.4.0
idn: should contain a DER encoded RDN sequence
buf: a pointer to a structure to hold the peer's name
sizeof_buf: holds the size of buf
This function will return the name of the given RDN sequence. The name will be in the form "C=xxxx,O=yyyy,CN=zzzz" as described in RFC2253.
Returns: On success, GNUTLS_E_SUCCESS is returned, or
GNUTLS_E_SHORT_MEMORY_BUFFER is returned and *sizeof_buf is
updated if the provided buffer is not long enough, otherwise a
negative error value.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These functions are only available in the GPLv3+ version of the
library called gnutls-extra. The prototypes for this library
lie in `gnutls/extra.h'.
req_version: the version to check
Check that the version of the gnutls-extra library is at minimum the requested one and return the version string; return NULL if the condition is not satisfied. If a NULL is passed to this function, no check is done, but the version string is simply returned.
This function initializes the global state of gnutls-extra library to defaults. Returns zero on success.
Note that gnutls_global_init() has to be called before this
function. If this function is not called then the gnutls-extra
library will not be usable.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The following functions are to be used for OpenPGP certificate handling. Their prototypes lie in `gnutls/openpgp.h'.
res: the destination context to save the data.
certfile: the file that contains the public key.
keyfile: the file that contains the secret key.
subkey_id: a hex encoded subkey id
format: the format of the keys
This funtion is used to load OpenPGP keys into the GnuTLS credential structure. The files should contain non encrypted keys.
The special keyword "auto" is also accepted as &subkey_id. In that case
the gnutls_openpgp_crt_get_auth_subkey() will be used to retrieve the subkey.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
Since: 2.4.0
res: the destination context to save the data.
certfile: the file that contains the public key.
keyfile: the file that contains the secret key.
format: the format of the keys
This funtion is used to load OpenPGP keys into the GnuTLS credentials structure. The files should only contain one key which is not encrypted.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
res: the destination context to save the data.
subkey_id: a hex encoded subkey id
format: the format of the keys
This funtion is used to load OpenPGP keys into the GnuTLS credentials structure. The files should only contain one key which is not encrypted.
The special keyword "auto" is also accepted as &subkey_id. In that
case the gnutls_openpgp_crt_get_auth_subkey() will be used to
retrieve the subkey.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
Since: 2.4.0
res: the destination context to save the data.
format: the format of the keys
This funtion is used to load OpenPGP keys into the GnuTLS credential structure. The files should contain non encrypted keys.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
c: A certificate credentials structure
file: filename of the keyring.
The function is used to set keyrings that will be used internally by various OpenPGP functions. For example to find a key when it is needed for an operations. The keyring will also be used at the verification functions.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
c: A certificate credentials structure
data: buffer with keyring data.
dlen: length of data buffer.
The function is used to set keyrings that will be used internally by various OpenPGP functions. For example to find a key when it is needed for an operations. The keyring will also be used at the verification functions.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
res: is an gnutls_certificate_credentials_t structure.
pkey: is an openpgp private key
This function sets a certificate/private key pair in the gnutls_certificate_credentials_t structure. This function may be called more than once (in case multiple keys/certificates exist for the server).
With this function the subkeys of the certificate are not used.
key: should contain an gnutls_openpgp_crt_t structure
hostname: A null terminated string that contains a DNS name
This function will check if the given key's owner matches the given hostname. This is a basic implementation of the matching described in RFC2818 (HTTPS), which takes into account wildcards.
Returns: GNUTLS_E_SUCCESS on success, or an error code.
key: The structure to be initialized
This function will deinitialize a key structure.
key: Holds the key.
format: One of gnutls_openpgp_crt_fmt_t elements.
output_data: will contain the key base64 encoded or raw
output_data_size: holds the size of output_data (and will be replaced by the actual size of parameters)
This function will convert the given key to RAW or Base64 format.
If the buffer provided is not long enough to hold the output, then
GNUTLS_E_SHORT_MEMORY_BUFFER will be returned.
Returns: GNUTLS_E_SUCCESS on success, or an error code.
keyid: the struct to save the keyid.
flag: Non zero indicates that a valid subkey is always returned.
Returns the 64-bit keyID of the first valid OpenPGP subkey marked for authentication. If flag is non zero and no authentication subkey exists, then a valid subkey will be returned even if it is not marked for authentication. Returns the 64-bit keyID of the first valid OpenPGP subkey marked for authentication. If flag is non zero and no authentication subkey exists, then a valid subkey will be returned even if it is not marked for authentication.
Returns: GNUTLS_E_SUCCESS on success, or an error code.
key: the structure that contains the OpenPGP public key.
Get key creation time.
Returns: the timestamp when the OpenPGP key was created.
key: the structure that contains the OpenPGP public key.
Get key expiration time. A value of '0' means that the key doesn't expire at all.
Returns: the time when the OpenPGP key expires.
key: the raw data that contains the OpenPGP public key.
fpr: the buffer to save the fingerprint, must hold at least 20 bytes.
fprlen: the integer to save the length of the fingerprint.
Get key fingerprint. Depending on the algorithm, the fingerprint can be 16 or 20 bytes.
Returns: On success, 0 is returned. Otherwise, an error code.
key: the structure that contains the OpenPGP public key.
keyid: the buffer to save the keyid.
Get key id string.
Returns: the 64-bit keyID of the OpenPGP key.
Since: 2.4.0
key: should contain a gnutls_openpgp_crt_t structure
key_usage: where the key usage bits will be stored
This function will return certificate's key usage, by checking the
key algorithm. The key usage value will ORed values of the:
GNUTLS_KEY_DIGITAL_SIGNATURE, GNUTLS_KEY_KEY_ENCIPHERMENT.
Returns: GNUTLS_E_SUCCESS on success, or an error code.
key: the structure that contains the OpenPGP public key.
idx: the index of the ID to extract
buf: a pointer to a structure to hold the name
sizeof_buf: holds the maximum size of buf, on return hold the
actual/required size of buf.
Extracts the userID from the parsed OpenPGP key.
Returns: GNUTLS_E_SUCCESS on success, and if the index of the ID
does not exist GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE, or an
error code.
key: is an OpenPGP key
bits: if bits is non null it will hold the size of the parameters' in bits
This function will return the public key algorithm of an OpenPGP certificate.
If bits is non null, it should have enough size to hold the parameters size in bits. For RSA the bits returned is the modulus. For DSA the bits returned are of the public exponent.
Returns: a member of the gnutls_pk_algorithm_t enumeration on
success, or a negative value on error.
crt: Holds the certificate
p: will hold the p
q: will hold the q
g: will hold the g
y: will hold the y
This function will export the DSA public key's parameters found in
the given certificate. The new parameters will be allocated using
gnutls_malloc() and will be stored in the appropriate datum.
Returns: GNUTLS_E_SUCCESS on success, otherwise an error.
Since: 2.4.0
crt: Holds the certificate
m: will hold the modulus
e: will hold the public exponent
This function will export the RSA public key's parameters found in
the given structure. The new parameters will be allocated using
gnutls_malloc() and will be stored in the appropriate datum.
Returns: GNUTLS_E_SUCCESS on success, otherwise an error.
Since: 2.4.0
key: the structure that contains the OpenPGP public key.
keyid: the struct to save the keyid.
Get preferred key id. If it hasn't been set it returns
GNUTLS_E_INVALID_REQUEST.
Returns: the 64-bit preferred keyID of the OpenPGP key.
key: the structure that contains the OpenPGP public key.
Get revocation status of key.
Returns: true (1) if the key has been revoked, or false (0) if it has not.
Since: 2.4.0
key: is an OpenPGP key
This function will return the number of subkeys present in the given OpenPGP certificate.
Returns: the number of subkeys, or a negative value on error.
Since: 2.4.0
key: the structure that contains the OpenPGP public key.
idx: the subkey index
Get subkey creation time.
Returns: the timestamp when the OpenPGP sub-key was created.
Since: 2.4.0
key: the structure that contains the OpenPGP public key.
idx: the subkey index
Get subkey expiration time. A value of '0' means that the key doesn't expire at all.
Returns: the time when the OpenPGP key expires.
Since: 2.4.0
key: the raw data that contains the OpenPGP public key.
idx: the subkey index
fpr: the buffer to save the fingerprint, must hold at least 20 bytes.
fprlen: the integer to save the length of the fingerprint.
Get key fingerprint of a subkey. Depending on the algorithm, the fingerprint can be 16 or 20 bytes.
Returns: On success, 0 is returned. Otherwise, an error code.
Since: 2.4.0
key: the structure that contains the OpenPGP public key.
keyid: the keyid.
Get subkey's index.
Returns: the index of the subkey or a negative error value.
Since: 2.4.0
key: the structure that contains the OpenPGP public key.
idx: the subkey index
keyid: the buffer to save the keyid.
Get the subkey's key-id.
Returns: the 64-bit keyID of the OpenPGP key.
key: is an OpenPGP key
idx: is the subkey index
bits: if bits is non null it will hold the size of the parameters' in bits
This function will return the public key algorithm of a subkey of an OpenPGP certificate.
If bits is non null, it should have enough size to hold the parameters size in bits. For RSA the bits returned is the modulus. For DSA the bits returned are of the public exponent.
Returns: a member of the gnutls_pk_algorithm_t enumeration on
success, or a negative value on error.
Since: 2.4.0
crt: Holds the certificate
idx: Is the subkey index
p: will hold the p
q: will hold the q
g: will hold the g
y: will hold the y
This function will export the DSA public key's parameters found in
the given certificate. The new parameters will be allocated using
gnutls_malloc() and will be stored in the appropriate datum.
Returns: GNUTLS_E_SUCCESS on success, otherwise an error.
Since: 2.4.0
crt: Holds the certificate
idx: Is the subkey index
m: will hold the modulus
e: will hold the public exponent
This function will export the RSA public key's parameters found in
the given structure. The new parameters will be allocated using
gnutls_malloc() and will be stored in the appropriate datum.
Returns: GNUTLS_E_SUCCESS on success, otherwise an error.
Since: 2.4.0
key: the structure that contains the OpenPGP public key.
idx: is the subkey index
Get subkey revocation status. A negative value indicates an error.
Returns: true (1) if the key has been revoked, or false (0) if it has not.
Since: 2.4.0
key: should contain a gnutls_openpgp_crt_t structure
idx: the subkey index
key_usage: where the key usage bits will be stored
This function will return certificate's key usage, by checking the
key algorithm. The key usage value will ORed values of
GNUTLS_KEY_DIGITAL_SIGNATURE or GNUTLS_KEY_KEY_ENCIPHERMENT.
A negative value may be returned in case of parsing error.
Returns: key usage value.
Since: 2.4.0
key: the structure that contains the OpenPGP public key.
Extract the version of the OpenPGP key.
Returns: the version number is returned, or a negative value on errors.
key: The structure to store the parsed key.
data: The RAW or BASE64 encoded key.
format: One of gnutls_openpgp_crt_fmt_t elements.
This function will convert the given RAW or Base64 encoded key to
the native gnutls_openpgp_crt_t format. The output will be stored
in 'key'.
Returns: GNUTLS_E_SUCCESS on success, or an error code.
key: The structure to be initialized
This function will initialize an OpenPGP key structure.
Returns: GNUTLS_E_SUCCESS on success, or an error code.
cert: The structure to be printed
format: Indicate the format to use
out: Newly allocated datum with zero terminated string.
This function will pretty print an OpenPGP certificate, suitable for display to a human.
The format should be zero for future compatibility.
The output out needs to be deallocate using gnutls_free().
Returns: GNUTLS_E_SUCCESS on success, or an error code.
key: the structure that contains the OpenPGP public key.
keyid: the selected keyid
This allows setting a preferred key id for the given certificate. This key will be used by functions that involve key handling.
key: the structure that holds the key.
keyring: holds the keyring to check against
flags: unused (should be 0)
verify: will hold the certificate verification output.
Verify all signatures in the key, using the given set of keys (keyring).
The key verification output will be put in verify and will be one
or more of the gnutls_certificate_status_t enumerated elements
bitwise or'd.
Returns: GNUTLS_E_SUCCESS on success, or an error code.
key: the structure that holds the key.
flags: unused (should be 0)
verify: will hold the key verification output.
Verifies the self signature in the key. The key verification
output will be put in verify and will be one or more of the
gnutls_certificate_status_t enumerated elements bitwise or'd.
Returns: GNUTLS_E_SUCCESS on success, or an error code.
ring: holds the keyring to check against
keyid: will hold the keyid to check for.
flags: unused (should be 0)
Check if a given key ID exists in the keyring.
Returns: GNUTLS_E_SUCCESS on success (if keyid exists) and a
negative error code on failure.
keyring: The structure to be initialized
This function will deinitialize a keyring structure.
ring: is an OpenPGP key ring
This function will return the number of OpenPGP certificates present in the given keyring.
Returns: the number of subkeys, or a negative value on error.
idx: the index of the certificate to export
This function will extract an OpenPGP certificate from the given
keyring. If the index given is out of range
GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE will be returned. The
returned structure needs to be deinited.
Returns: GNUTLS_E_SUCCESS on success, or an error code.
keyring: The structure to store the parsed key.
data: The RAW or BASE64 encoded keyring.
format: One of gnutls_openpgp_keyring_fmt elements.
This function will convert the given RAW or Base64 encoded keyring
to the native gnutls_openpgp_keyring_t format. The output will be
stored in 'keyring'.
Returns: GNUTLS_E_SUCCESS on success, or an error code.
keyring: The structure to be initialized
This function will initialize an keyring structure.
Returns: GNUTLS_E_SUCCESS on success, or an error code.
key: The structure to be initialized
This function will deinitialize a key structure.
pkey: Holds the certificate
p: will hold the p
q: will hold the q
g: will hold the g
y: will hold the y
x: will hold the x
This function will export the DSA private key's parameters found in
the given certificate. The new parameters will be allocated using
gnutls_malloc() and will be stored in the appropriate datum.
Returns: GNUTLS_E_SUCCESS on success, otherwise an error.
Since: 2.4.0
pkey: Holds the certificate
m: will hold the modulus
e: will hold the public exponent
d: will hold the private exponent
p: will hold the first prime (p)
q: will hold the second prime (q)
u: will hold the coefficient
This function will export the RSA private key's parameters found in
the given structure. The new parameters will be allocated using
gnutls_malloc() and will be stored in the appropriate datum.
Returns: GNUTLS_E_SUCCESS on success, otherwise an error.
Since: 2.4.0
pkey: Holds the certificate
idx: Is the subkey index
p: will hold the p
q: will hold the q
g: will hold the g
y: will hold the y
x: will hold the x
This function will export the DSA private key's parameters found
in the given certificate. The new parameters will be allocated
using gnutls_malloc() and will be stored in the appropriate datum.
Returns: GNUTLS_E_SUCCESS on success, otherwise an error.
Since: 2.4.0
pkey: Holds the certificate
idx: Is the subkey index
m: will hold the modulus
e: will hold the public exponent
d: will hold the private exponent
p: will hold the first prime (p)
q: will hold the second prime (q)
u: will hold the coefficient
This function will export the RSA private key's parameters found in
the given structure. The new parameters will be allocated using
gnutls_malloc() and will be stored in the appropriate datum.
Returns: GNUTLS_E_SUCCESS on success, otherwise an error.
Since: 2.4.0
key: Holds the key.
format: One of gnutls_openpgp_crt_fmt_t elements.
password: the password that will be used to encrypt the key. (unused for now)
flags: zero for future compatibility
output_data: will contain the key base64 encoded or raw
output_data_size: holds the size of output_data (and will be replaced by the actual size of parameters)
This function will convert the given key to RAW or Base64 format. If the buffer provided is not long enough to hold the output, then GNUTLS_E_SHORT_MEMORY_BUFFER will be returned.
Returns: GNUTLS_E_SUCCESS on success, or an error code.
Since: 2.4.0
key: the raw data that contains the OpenPGP secret key.
fpr: the buffer to save the fingerprint, must hold at least 20 bytes.
fprlen: the integer to save the length of the fingerprint.
Get the fingerprint of the OpenPGP key. Depends on the algorithm, the fingerprint can be 16 or 20 bytes.
Returns: On success, 0 is returned, or an error code.
Since: 2.4.0
key: the structure that contains the OpenPGP secret key.
keyid: the buffer to save the keyid.
Get key-id.
Returns: the 64-bit keyID of the OpenPGP key.
Since: 2.4.0
key: is an OpenPGP key
bits: if bits is non null it will hold the size of the parameters' in bits
This function will return the public key algorithm of an OpenPGP certificate.
If bits is non null, it should have enough size to hold the parameters size in bits. For RSA the bits returned is the modulus. For DSA the bits returned are of the public exponent.
Returns: a member of the gnutls_pk_algorithm_t enumeration on
success, or a negative value on error.
Since: 2.4.0
key: the structure that contains the OpenPGP public key.
keyid: the struct to save the keyid.
Get the preferred key-id for the key.
Returns: the 64-bit preferred keyID of the OpenPGP key, or if it
hasn't been set it returns GNUTLS_E_INVALID_REQUEST.
key: the structure that contains the OpenPGP private key.
Get revocation status of key.
Returns: true (1) if the key has been revoked, or false (0) if it has not, or a negative value indicates an error.
Since: 2.4.0
key: is an OpenPGP key
This function will return the number of subkeys present in the given OpenPGP certificate.
Returns: the number of subkeys, or a negative value on error.
Since: 2.4.0
key: the structure that contains the OpenPGP private key.
idx: the subkey index
Get subkey creation time.
Returns: the timestamp when the OpenPGP key was created.
Since: 2.4.0
key: the structure that contains the OpenPGP private key.
idx: the subkey index
Get subkey expiration time. A value of '0' means that the key doesn't expire at all.
Returns: the time when the OpenPGP key expires.
Since: 2.4.0
key: the raw data that contains the OpenPGP secret key.
idx: the subkey index
fpr: the buffer to save the fingerprint, must hold at least 20 bytes.
fprlen: the integer to save the length of the fingerprint.
Get the fingerprint of an OpenPGP subkey. Depends on the algorithm, the fingerprint can be 16 or 20 bytes.
Returns: On success, 0 is returned, or an error code.
Since: 2.4.0
key: the structure that contains the OpenPGP private key.
keyid: the keyid.
Get index of subkey.
Returns: the index of the subkey or a negative error value.
Since: 2.4.0
key: the structure that contains the OpenPGP secret key.
idx: the subkey index
keyid: the buffer to save the keyid.
Get the key-id for the subkey.
Returns: the 64-bit keyID of the OpenPGP key.
Since: 2.4.0
key: is an OpenPGP key
idx: is the subkey index
bits: if bits is non null it will hold the size of the parameters' in bits
This function will return the public key algorithm of a subkey of an OpenPGP certificate.
If bits is non null, it should have enough size to hold the parameters size in bits. For RSA the bits returned is the modulus. For DSA the bits returned are of the public exponent.
Returns: a member of the gnutls_pk_algorithm_t enumeration on
success, or a negative value on error.
Since: 2.4.0
key: the structure that contains the OpenPGP private key.
idx: is the subkey index
Get revocation status of key.
Returns: true (1) if the key has been revoked, or false (0) if it has not, or a negative value indicates an error.
Since: 2.4.0
key: The structure to store the parsed key.
data: The RAW or BASE64 encoded key.
format: One of gnutls_openpgp_crt_fmt_t elements.
password: (unused for now)
flags: should be zero
This function will convert the given RAW or Base64 encoded key to the native gnutls_openpgp_privkey_t format. The output will be stored in 'key'.
Returns: GNUTLS_E_SUCCESS on success, or an error code.
key: The structure to be initialized
This function will initialize an OpenPGP key structure.
Returns: GNUTLS_E_SUCCESS on success, or an error code.
key: the structure that contains the OpenPGP public key.
keyid: the selected keyid
This allows setting a preferred key id for the given certificate. This key will be used by functions that involve key handling.
Returns: On success, 0 is returned, or an error code.
key: Holds the key
hash: holds the data to be signed
signature: will contain newly allocated signature
This function will sign the given hash using the private key. You
should use gnutls_openpgp_privkey_set_subkey() before calling this
function to set the subkey to use.
Returns: On success, GNUTLS_E_SUCCESS is returned, otherwise a
negative error value.
session: a TLS session
func: the callback
This funtion will set a key retrieval function for OpenPGP keys. This callback is only useful in server side, and will be used if the peer sent a key fingerprint instead of a full key.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The following functions are used for TLS Inner Application (TLS/IA). Their prototypes lie in `gnutls/extra.h'. You need to link with `libgnutls-extra' to be able to use these functions (see section GnuTLS-extra Functions).
The typical control flow in an TLS/IA client (that would not require an Application Phase for resumed sessions) would be similar to the following:
int client_avp (gnuls_session_t *session, void *ptr,
const char *last, size_t lastlen,
char **new, size_t *newlen)
{
...
}
...
int main ()
{
gnutls_ia_client_credentials_t iacred;
...
gnutls_init (&session, GNUTLS_CLIENT);
...
/* Enable TLS/IA. */
gnutls_ia_allocate_client_credentials(&iacred);
gnutls_ia_set_client_avp_function(iacred, client_avp);
gnutls_credentials_set (session, GNUTLS_CRD_IA, iacred);
...
ret = gnutls_handshake (session);
// Error handling...
...
if (gnutls_ia_handshake_p (session))
{
ret = gnutls_ia_handshake (session);
// Error handling...
...
|
See below for detailed descriptions of all the functions used above.
The function client_avp would have to be implemented by your
application. The function is responsible for handling the AVP data.
See gnutls_ia_set_client_avp_function below for more
information on how that function should be implemented.
The control flow in a typical server is similar to the above, use
gnutls_ia_server_credentials_t instead of
gnutls_ia_client_credentials_t, and replace the call to the
client functions with the corresponding server functions.
sc: is a pointer to an gnutls_ia_server_credentials_t structure.
This structure is complex enough to manipulate directly thus this helper function is provided in order to allocate it.
Adding this credential to a session will enable TLS/IA, and will
require an Application Phase after the TLS handshake (if the server
support TLS/IA). Use gnutls_ia_require_inner_phase() to toggle the
TLS/IA mode.
Returns: On success, GNUTLS_E_SUCCESS (0) is returned, otherwise
an error code is returned.
sc: is a pointer to an gnutls_ia_server_credentials_t structure.
This structure is complex enough to manipulate directly thus this helper function is provided in order to allocate it.
Adding this credential to a session will enable TLS/IA, and will
require an Application Phase after the TLS handshake (if the client
support TLS/IA). Use gnutls_ia_require_inner_phase() to toggle the
TLS/IA mode.
Returns: On success, GNUTLS_E_SUCCESS (0) is returned, otherwise
an error code is returned.
session: is a gnutls_session_t structure.
allow_skip_on_resume: non-zero if local party allows to skip the TLS/IA application phases for a resumed session.
Specify whether we must advertise support for the TLS/IA extension during the handshake.
At the client side, we always advertise TLS/IA if gnutls_ia_enable was called before the handshake; at the server side, we also require that the client has advertised that it wants to run TLS/IA before including the advertisement, as required by the protocol.
Similarly, at the client side we always advertise that we allow
TLS/IA to be skipped for resumed sessions if allow_skip_on_resume
is non-zero; at the server side, we also require that the session
is indeed resumable and that the client has also advertised that it
allows TLS/IA to be skipped for resumed sessions.
After the TLS handshake, call gnutls_ia_handshake_p() to find out
whether both parties agreed to do a TLS/IA handshake, before
calling gnutls_ia_handshake() or one of the lower level gnutls_ia_*
functions.
session: is a gnutls_session_t structure.
final_p: Set iff this should signal the final phase.
Send a TLS/IA end phase message.
In the client, this should only be used to acknowledge an end phase message sent by the server.
In the server, this can be called instead of gnutls_ia_send() if
the server wishes to end an application phase.
Return value: Return 0 on success, or an error code.
session: is a gnutls_session_t structure.
buffer: pre-allocated buffer to hold 48 bytes of inner secret.
Copy the 48 bytes large inner secret into the specified buffer
This function is typically used after the TLS/IA handshake has concluded. The TLS/IA inner secret can be used as input to a PRF to derive session keys. Do not use the inner secret directly as a session key, because for a resumed session that does not include an application phase, the inner secret will be identical to the inner secret in the original session. It is important to include, for example, the client and server randomness when deriving a sesssion key from the inner secret.
sc: is an gnutls_ia_client_credentials_t structure.
This structure is complex enough to manipulate directly thus this helper function is provided in order to free (deallocate) it.
sc: is an gnutls_ia_server_credentials_t structure.
This structure is complex enough to manipulate directly thus this helper function is provided in order to free (deallocate) it.
session: is a gnutls_session_t structure.
buffer_size: size of output buffer.
buffer: pre-allocated buffer to contain buffer_size bytes of output.
Generate an application challenge that the client cannot control or predict, based on the TLS/IA inner secret.
Return value: Returns 0 on success, or an negative error code.
cred: is a gnutls_ia_client_credentials_t structure.
Returns the pointer that will be provided to the TLS/IA callback function as the first argument.
Returns: The client callback data pointer.
cred: is a gnutls_ia_client_credentials_t structure.
Returns the pointer that will be provided to the TLS/IA callback function as the first argument.
Returns: The server callback data pointer.
session: is a gnutls_session_t structure.
Predicate to be used after gnutls_handshake() to decide whether to
invoke gnutls_ia_handshake(). Usable by both clients and servers.
Return value: non-zero if TLS/IA handshake is expected, zero otherwise.
session: is a gnutls_session_t structure.
Perform a TLS/IA handshake. This should be called after
gnutls_handshake() iff gnutls_ia_handshake_p().
Return 0 on success, or an error code.
session: is a gnutls_session_t structure.
session_keys_size: Size of generated session keys (0 if none).
session_keys: Generated session keys, used to permute inner secret (NULL if none).
Permute the inner secret using the generated session keys.
This can be called in the TLS/IA AVP callback to mix any generated session keys with the TLS/IA inner secret.
Return value: Return zero on success, or a negative error code.
session: is a gnutls_session_t structure.
data: the buffer that the data will be read into, must hold >= 12 bytes.
sizeofdata: the number of requested bytes, must be >= 12.
Receive TLS/IA data. This function has the similar semantics with
recv(). The only difference is that is accepts a GNUTLS session,
and uses different error codes.
If the server attempt to finish an application phase, this function
will return GNUTLS_E_WARNING_IA_IPHF_RECEIVED or
GNUTLS_E_WARNING_IA_FPHF_RECEIVED. The caller should then invoke
gnutls_ia_verify_endphase(), and if it runs the client side, also
send an endphase message of its own using gnutls_ia_endphase_send.
If EINTR is returned by the internal push function (the default is
code{recv()}) then GNUTLS_E_INTERRUPTED will be returned. If
GNUTLS_E_INTERRUPTED or GNUTLS_E_AGAIN is returned, you must call
this function again, with the same parameters; alternatively you
could provide a NULL pointer for data, and 0 for size.
Returns: The number of bytes received. A negative error code is
returned in case of an error. The
GNUTLS_E_WARNING_IA_IPHF_RECEIVED and
GNUTLS_E_WARNING_IA_FPHF_RECEIVED errors are returned when an
application phase finished message has been sent by the server.
session: is a gnutls_session_t structure.
data: contains the data to send
sizeofdata: is the length of the data
Send TLS/IA application payload data. This function has the
similar semantics with send(). The only difference is that is
accepts a GNUTLS session, and uses different error codes.
The TLS/IA protocol is synchronous, so you cannot send more than one packet at a time. The client always send the first packet.
To finish an application phase in the server, use
gnutls_ia_endphase_send(). The client cannot end an application
phase unilaterally; rather, a client is required to respond with an
endphase of its own if gnutls_ia_recv indicates that the server has
sent one.
If the EINTR is returned by the internal push function (the default
is send()} then GNUTLS_E_INTERRUPTED will be returned. If
GNUTLS_E_INTERRUPTED or GNUTLS_E_AGAIN is returned, you must call
this function again, with the same parameters; alternatively you
could provide a NULL pointer for data, and 0 for size.
Returns: The number of bytes sent, or a negative error code.
cred: is a gnutls_ia_client_credentials_t structure.
avp_func: is the callback function
Set the TLS/IA AVP callback handler used for the session.
The AVP callback is called to process AVPs received from the server, and to get a new AVP to send to the server.
The callback's function form is: int (*avp_func) (gnutls_session_t session, void *ptr, const char *last, size_t lastlen, char **next, size_t *nextlen);
The session parameter is the gnutls_session_t structure
corresponding to the current session. The ptr parameter is the
application hook pointer, set through
gnutls_ia_set_client_avp_ptr(). The AVP received from the server
is present in last of lastlen size, which will be NULL on the
first invocation. The newly allocated output AVP to send to the
server should be placed in *next of *nextlen size.
The callback may invoke gnutls_ia_permute_inner_secret() to mix any
generated session keys with the TLS/IA inner secret.
Return 0 (GNUTLS_IA_APPLICATION_PAYLOAD) on success, or a negative
error code to abort the TLS/IA handshake.
Note that the callback must use allocate the next parameter using
gnutls_malloc(), because it is released via gnutls_free() by the
TLS/IA handshake function.
cred: is a gnutls_ia_client_credentials_t structure.
ptr: is the pointer
Sets the pointer that will be provided to the TLS/IA callback function as the first argument.
cred: is a gnutls_ia_server_credentials_t structure.
Set the TLS/IA AVP callback handler used for the session.
The callback's function form is: int (*avp_func) (gnutls_session_t session, void *ptr, const char *last, size_t lastlen, char **next, size_t *nextlen);
The session parameter is the gnutls_session_t structure
corresponding to the current session. The ptr parameter is the
application hook pointer, set through
gnutls_ia_set_server_avp_ptr(). The AVP received from the client
is present in last of lastlen size. The newly allocated output
AVP to send to the client should be placed in *next of *nextlen
size.
The AVP callback is called to process incoming AVPs from the
client, and to get a new AVP to send to the client. It can also be
used to instruct the TLS/IA handshake to do go into the
Intermediate or Final phases. It return a negative error code, or
an gnutls_ia_apptype_t message type.
The callback may invoke gnutls_ia_permute_inner_secret() to mix any
generated session keys with the TLS/IA inner secret.
Specifically, return GNUTLS_IA_APPLICATION_PAYLOAD (0) to send
another AVP to the client, return
GNUTLS_IA_INTERMEDIATE_PHASE_FINISHED (1) to indicate that an
IntermediatePhaseFinished message should be sent, and return
GNUTLS_IA_FINAL_PHASE_FINISHED (2) to indicate that an
FinalPhaseFinished message should be sent. In the last two cases,
the contents of the next and nextlen parameter is not used.
Note that the callback must use allocate the next parameter using
gnutls_malloc(), because it is released via gnutls_free() by the
TLS/IA handshake function.
cred: is a gnutls_ia_client_credentials_t structure.
ptr: is the pointer
Sets the pointer that will be provided to the TLS/IA callback function as the first argument.
session: is a gnutls_session_t structure.
checksum: 12-byte checksum data, received from gnutls_ia_recv().
Verify TLS/IA end phase checksum data. If verification fails, the
GNUTLS_A_INNER_APPLICATION_VERIFICATION alert is sent to the other
sie.
This function is called when gnutls_ia_recv() return
GNUTLS_E_WARNING_IA_IPHF_RECEIVED or
GNUTLS_E_WARNING_IA_FPHF_RECEIVED.
Return value: Return 0 on successful verification, or an error
code. If the checksum verification of the end phase message fails,
GNUTLS_E_IA_VERIFY_FAILED is returned.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The error codes used throughout the library are described below. The
return code GNUTLS_E_SUCCESS indicate successful operation, and
is guaranteed to have the value 0, so you can use it in logical
expressions.
GNUTLS_E_AGAIN:Function was interrupted.
GNUTLS_E_ASN1_DER_ERROR:ASN1 parser: Error in DER parsing.
GNUTLS_E_ASN1_DER_OVERFLOW:ASN1 parser: Overflow in DER parsing.
GNUTLS_E_ASN1_ELEMENT_NOT_FOUND:ASN1 parser: Element was not found.
GNUTLS_E_ASN1_GENERIC_ERROR:ASN1 parser: Generic parsing error.
GNUTLS_E_ASN1_IDENTIFIER_NOT_FOUND:ASN1 parser: Identifier was not found
GNUTLS_E_ASN1_SYNTAX_ERROR:ASN1 parser: Syntax error.
GNUTLS_E_ASN1_TAG_ERROR:ASN1 parser: Error in TAG.
GNUTLS_E_ASN1_TAG_IMPLICIT:ASN1 parser: error in implicit tag
GNUTLS_E_ASN1_TYPE_ANY_ERROR:ASN1 parser: Error in type 'ANY'.
GNUTLS_E_ASN1_VALUE_NOT_FOUND:ASN1 parser: Value was not found.
GNUTLS_E_ASN1_VALUE_NOT_VALID:ASN1 parser: Value is not valid.
GNUTLS_E_BASE64_DECODING_ERROR:Base64 decoding error.
GNUTLS_E_BASE64_ENCODING_ERROR:Base64 encoding error.
GNUTLS_E_BASE64_UNEXPECTED_HEADER_ERROR:Base64 unexpected header error.
GNUTLS_E_CERTIFICATE_ERROR:Error in the certificate.
GNUTLS_E_CERTIFICATE_KEY_MISMATCH:The certificate and the given key do not match.
GNUTLS_E_COMPRESSION_FAILED:Compression of the TLS record packet has failed.
GNUTLS_E_CONSTRAINT_ERROR:Some constraint limits were reached.
GNUTLS_E_CRYPTO_ALREADY_REGISTERED:There is already a crypto algorithm with lower priority.
GNUTLS_E_DB_ERROR:Error in Database backend.
GNUTLS_E_DECOMPRESSION_FAILED:Decompression of the TLS record packet has failed.
GNUTLS_E_DECRYPTION_FAILED:Decryption has failed.
GNUTLS_E_DH_PRIME_UNACCEPTABLE:The Diffie Hellman prime sent by the server is not acceptable (not long enough).
GNUTLS_E_ENCRYPTION_FAILED:Encryption has failed.
GNUTLS_E_ERROR_IN_FINISHED_PACKET:An error was encountered at the TLS Finished packet calculation.
GNUTLS_E_EXPIRED:The requested session has expired.
GNUTLS_E_FATAL_ALERT_RECEIVED:A TLS fatal alert has been received.
GNUTLS_E_FILE_ERROR:Error while reading file.
GNUTLS_E_GOT_APPLICATION_DATA:TLS Application data were received, while expecting handshake data.
GNUTLS_E_HANDSHAKE_TOO_LARGE:The handshake data size is too large (DoS?), check gnutls_handshake_set_max_packet_length().
GNUTLS_E_HASH_FAILED:Hashing has failed.
GNUTLS_E_IA_VERIFY_FAILED:Verifying TLS/IA phase checksum failed
GNUTLS_E_ILLEGAL_SRP_USERNAME:The SRP username supplied is illegal.
GNUTLS_E_INCOMPATIBLE_GCRYPT_LIBRARY:The gcrypt library version is too old.
GNUTLS_E_INCOMPATIBLE_LIBTASN1_LIBRARY:The tasn1 library version is too old.
GNUTLS_E_INIT_LIBEXTRA:The initialization of GnuTLS-extra has failed.
GNUTLS_E_INSUFFICIENT_CREDENTIALS:Insufficient credentials for that request.
GNUTLS_E_INTERNAL_ERROR:GnuTLS internal error.
GNUTLS_E_INTERRUPTED:Function was interrupted.
GNUTLS_E_INVALID_PASSWORD:The given password contains invalid characters.
GNUTLS_E_INVALID_REQUEST:The request is invalid.
GNUTLS_E_INVALID_SESSION:The specified session has been invalidated for some reason.
GNUTLS_E_KEY_USAGE_VIOLATION:Key usage violation in certificate has been detected.
GNUTLS_E_LARGE_PACKET:A large TLS record packet was received.
GNUTLS_E_LIBRARY_VERSION_MISMATCH:The GnuTLS library version does not match the GnuTLS-extra library version.
GNUTLS_E_LZO_INIT_FAILED:The initialization of LZO has failed.
GNUTLS_E_MAC_VERIFY_FAILED:The Message Authentication Code verification failed.
GNUTLS_E_MEMORY_ERROR:Internal error in memory allocation.
GNUTLS_E_MPI_PRINT_FAILED:Could not export a large integer.
GNUTLS_E_MPI_SCAN_FAILED:The scanning of a large integer has failed.
GNUTLS_E_NO_CERTIFICATE_FOUND:The peer did not send any certificate.
GNUTLS_E_NO_CIPHER_SUITES:No supported cipher suites have been found.
GNUTLS_E_NO_COMPRESSION_ALGORITHMS:No supported compression algorithms have been found.
GNUTLS_E_NO_TEMPORARY_DH_PARAMS:No temporary DH parameters were found.
GNUTLS_E_NO_TEMPORARY_RSA_PARAMS:No temporary RSA parameters were found.
GNUTLS_E_OPENPGP_FINGERPRINT_UNSUPPORTED:The OpenPGP fingerprint is not supported.
GNUTLS_E_OPENPGP_GETKEY_FAILED:Could not get OpenPGP key.
GNUTLS_E_OPENPGP_KEYRING_ERROR:Error loading the keyring.
GNUTLS_E_OPENPGP_SUBKEY_ERROR:Could not find OpenPGP subkey.
GNUTLS_E_OPENPGP_UID_REVOKED:The OpenPGP User ID is revoked.
GNUTLS_E_PKCS1_WRONG_PAD:Wrong padding in PKCS1 packet.
GNUTLS_E_PK_DECRYPTION_FAILED:Public key decryption has failed.
GNUTLS_E_PK_ENCRYPTION_FAILED:Public key encryption has failed.
GNUTLS_E_PK_SIGN_FAILED:Public key signing has failed.
GNUTLS_E_PK_SIG_VERIFY_FAILED:Public key signature verification has failed.
GNUTLS_E_PULL_ERROR:Error in the pull function.
GNUTLS_E_PUSH_ERROR:Error in the push function.
GNUTLS_E_RANDOM_FAILED:Failed to acquire random data.
GNUTLS_E_RECEIVED_ILLEGAL_EXTENSION:An illegal TLS extension was received.
GNUTLS_E_RECEIVED_ILLEGAL_PARAMETER:An illegal parameter has been received.
GNUTLS_E_RECORD_LIMIT_REACHED:The upper limit of record packet sequence numbers has been reached. Wow!
GNUTLS_E_REHANDSHAKE:Rehandshake was requested by the peer.
GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE:The requested data were not available.
GNUTLS_E_SHORT_MEMORY_BUFFER:The given memory buffer is too short to hold parameters.
GNUTLS_E_SRP_PWD_ERROR:Error in password file.
GNUTLS_E_SRP_PWD_PARSING_ERROR:Parsing error in password file.
GNUTLS_E_SUCCESS:Success.
GNUTLS_E_TOO_MANY_EMPTY_PACKETS:Too many empty record packets have been received.
GNUTLS_E_UNEXPECTED_HANDSHAKE_PACKET:An unexpected TLS handshake packet was received.
GNUTLS_E_UNEXPECTED_PACKET:An unexpected TLS packet was received.
GNUTLS_E_UNEXPECTED_PACKET_LENGTH:A TLS packet with unexpected length was received.
GNUTLS_E_UNKNOWN_ALGORITHM:The specified algorithm or protocol is unknown.
GNUTLS_E_UNKNOWN_CIPHER_SUITE:Could not negotiate a supported cipher suite.
GNUTLS_E_UNKNOWN_CIPHER_TYPE:The cipher type is unsupported.
GNUTLS_E_UNKNOWN_COMPRESSION_ALGORITHM:Could not negotiate a supported compression method.
GNUTLS_E_UNKNOWN_HASH_ALGORITHM:The hash algorithm is unknown.
GNUTLS_E_UNKNOWN_PKCS_BAG_TYPE:The PKCS structure's bag type is unknown.
GNUTLS_E_UNKNOWN_PKCS_CONTENT_TYPE:The PKCS structure's content type is unknown.
GNUTLS_E_UNKNOWN_PK_ALGORITHM:An unknown public key algorithm was encountered.
GNUTLS_E_UNSUPPORTED_CERTIFICATE_TYPE:The certificate type is not supported.
GNUTLS_E_UNSUPPORTED_VERSION_PACKET:A record packet with illegal version was received.
GNUTLS_E_UNWANTED_ALGORITHM:An algorithm that is not enabled was negotiated.
GNUTLS_E_WARNING_ALERT_RECEIVED:A TLS warning alert has been received.
GNUTLS_E_WARNING_IA_FPHF_RECEIVED:Received a TLS/IA Final Phase Finished message
GNUTLS_E_WARNING_IA_IPHF_RECEIVED:Received a TLS/IA Intermediate Phase Finished message
GNUTLS_E_X509_UNKNOWN_SAN:Unknown Subject Alternative name in X.509 certificate.
GNUTLS_E_X509_UNSUPPORTED_ATTRIBUTE:The certificate has unsupported attributes.
GNUTLS_E_X509_UNSUPPORTED_CRITICAL_EXTENSION:Unsupported critical extension in X.509 certificate.
GNUTLS_E_X509_UNSUPPORTED_OID:The OID is not supported.
| [ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on July, 20 2009 using texi2html 1.76.