Soletta™ Framework
Framework for making IoT devices

Full online documentation | C API Index
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Typedefs | Functions
Certificate

Typedefs

typedef struct sol_cert sol_cert
 Certificate handler. More...
 

Functions

struct sol_blobsol_cert_get_contents (const struct sol_cert *cert)
 Get the certificate contents. More...
 
struct sol_certsol_cert_load_from_id (const char *id)
 Load a certificate from an id. More...
 
struct sol_certsol_cert_ref (struct sol_cert *cert)
 Increments the reference counter of the given sol_cert. More...
 
void sol_cert_unref (struct sol_cert *cert)
 Free the resources a sol_cert object and the object itself. More...
 
ssize_t sol_cert_write_contents (const char *file_name, struct sol_str_slice contents)
 Write contents to cert. More...
 

Detailed Description

Typedef Documentation

Certificate handler.

This object is the abstraction of certificate.

Function Documentation

struct sol_blob* sol_cert_get_contents ( const struct sol_cert cert)

Get the certificate contents.

Parameters
certCertificate object.
Returns
the contents of the certificate cert on success, NULL otherwise
struct sol_cert* sol_cert_load_from_id ( const char *  id)

Load a certificate from an id.

Parameters
idThe id of the certificate to be loaded.

In systems where file system is supported, the id is the name of the certificate file. The id can be a relative or an absolute path to the certificat file. If relative, function will look for it at user home config directory (${HOME}/.config/{$APPNAME}/certs/), in default system directories ($SYSCONF/ssl/certs, $SYSCONF/ssl/private, $SYSCONF/tls/certs and $SYSCONF/tls/private), and in a directory specified by SSL_CERT_DIR

Returns
sol_cert object on success, NULL otherwise
Examples:
/src/samples/http/server-https.c.

Referenced by startup_server().

struct sol_cert* sol_cert_ref ( struct sol_cert cert)

Increments the reference counter of the given sol_cert.

Parameters
certThe certificate to increase the references
Returns
Pointer to the referenced certificate.
void sol_cert_unref ( struct sol_cert cert)

Free the resources a sol_cert object and the object itself.

Parameters
certThe object to be freed
Examples:
/src/samples/http/server-https.c.

Referenced by startup_server().

ssize_t sol_cert_write_contents ( const char *  file_name,
struct sol_str_slice  contents 
)

Write contents to cert.

Certificates are always saved in user context.

Parameters
file_nameThe name of the certificate file. The certificate file name must be relative. File name with full path is not supported.
contentsA blob containing the contents to be written to the certificate.
Returns
The number of written characters, if an error is encountered a negative value with the error code.