Top level functions

Function that allow ciphering content. More...

## Typedefs

typedef enum _Emile_Cipher_Backend | Emile_Cipher_Backend
| Flags describing the implemented backend.
typedef enum _Emile_Cipher_Algorithm | Emile_Cipher_Algorithm
| Flags describing known cipher algorithm.
typedef struct _Emile_SSL | Emile_SSL

## Enumerations

enum | _Emile_Cipher_Backend { EMILE_NONE , EMILE_OPENSSL , EMILE_GNUTLS }
enum | _Emile_Cipher_Algorithm { EMILE_AES256_CBC }
enum | Emile_Cipher_Type { EMILE_SSLv23 , EMILE_TLSv1 }
enum | Emile_Want_Type { EMILE_WANT_NOTHING = 0 , EMILE_WANT_READ = 1 , EMILE_WANT_WRITE = 3 }

## Functions

Eina_Bool | emile_cipher_init (void)
| Force the initialization of the underlying cipher library.
Emile_Cipher_Backend | emile_cipher_module_get (void)
| Get the name of the current used backend.
Eina_Binbuf * | emile_binbuf_cipher (Emile_Cipher_Algorithm algo, const Eina_Binbuf *in, const char *key, unsigned int length)
| Cipher a buffer with a defined algorithm and key.
Eina_Binbuf * | emile_binbuf_decipher (Emile_Cipher_Algorithm algo, const Eina_Binbuf *in, const char *key, unsigned int length)
| Decipher a buffer with a defined algorithm and key.
Eina_Bool | emile_binbuf_hmac_sha1 (const char *key, unsigned int key_len, const Eina_Binbuf *data, unsigned char digest[20])
Eina_Bool | emile_binbuf_sha1 (const Eina_Binbuf *data, unsigned char digest[20])
Emile_SSL * | emile_cipher_server_listen (Emile_Cipher_Type t)
Emile_SSL * | emile_cipher_client_connect (Emile_SSL *server, int fd)
Emile_SSL * | emile_cipher_server_connect (Emile_Cipher_Type t)
Eina_Bool | emile_cipher_free (Emile_SSL *emile)
Eina_Bool | emile_cipher_cafile_add (Emile_SSL *emile, const char *file)
Eina_Bool | emile_cipher_cert_add (Emile_SSL *emile, const char *file)
Eina_Bool | emile_cipher_privkey_add (Emile_SSL *emile, const char *file)
Eina_Bool | emile_cipher_crl_add (Emile_SSL *emile, const char *file)
int | emile_cipher_read (Emile_SSL *emile, Eina_Binbuf *buffer)
int | emile_cipher_write (Emile_SSL *emile, const Eina_Binbuf *buffer)
const char * | emile_cipher_error_get (const Emile_SSL *emile)
Eina_Bool | emile_cipher_verify_name_set (Emile_SSL *emile, const char *name)
const char * | emile_cipher_verify_name_get (const Emile_SSL *emile)
void | emile_cipher_verify_set (Emile_SSL *emile, Eina_Bool verify)
void | emile_cipher_verify_basic_set (Emile_SSL *emile, Eina_Bool verify_basic)
Eina_Bool | emile_cipher_verify_get (const Emile_SSL *emile)
Eina_Bool | emile_cipher_verify_basic_get (const Emile_SSL *emile)

## Detailed Description

Function that allow ciphering content.

## Typedef Documentation

## Emile_Cipher_Backend

typedef enum _Emile_Cipher_Backend Emile_Cipher_Backend

Flags describing the implemented backend.

Since
  1.14

## Emile_Cipher_Algorithm

typedef enum _Emile_Cipher_Algorithm Emile_Cipher_Algorithm

Flags describing known cipher algorithm.

Since
  1.14

## Function Documentation

## emile_cipher_init()

Eina_Bool emile_cipher_init | ( | void |  | ) |

Force the initialization of the underlying cipher library.

This call force the initialisation of OpenSSL, so that you get the same setup for everyone.

Returns
  EINA_TRUE on success, EINA_FALSE otherwise.

See also
  emile_cipher_module_get

Since
  1.14

References EINA_FALSE, and EINA_TRUE.

Referenced by ecore_con_url_init(), eet_identity_certificate_print(), eet_identity_close(), eet_identity_open(), eet_identity_print(), emile_binbuf_cipher(), and emile_binbuf_decipher().

## emile_cipher_module_get()

Emile_Cipher_Backend emile_cipher_module_get | ( | void |  | ) |

Get the name of the current used backend.

Returns
  the name of the current cipher backend.

Since
  1.14

## emile_binbuf_cipher()

Eina_Binbuf * emile_binbuf_cipher | ( | Emile_Cipher_Algorithm | algo,
|  | const Eina_Binbuf * | in,
|  | const char * | key,
|  | unsigned int | length )

Cipher a buffer with a defined algorithm and key.

Parameters

  algo | The algorithm to use to cipher the buffer.
  in | The buffer to cipher.
  key | The symetric key to use for ciphering.
  length | The length of the symetric key to be used.

Returns
  the ciphered buffer or NULL on error.

Since
  1.14

References eina_binbuf_append_length(), eina_binbuf_free(), eina_binbuf_length_get(), eina_binbuf_new(), eina_binbuf_string_get(), EINA_UNUSED, and emile_cipher_init().

Referenced by eet_write_cipher().

## emile_binbuf_decipher()

Eina_Binbuf * emile_binbuf_decipher | ( | Emile_Cipher_Algorithm | algo,
|  | const Eina_Binbuf * | in,
|  | const char * | key,
|  | unsigned int | length )

Decipher a buffer with a defined algorithm and key.

Parameters

  algo | The algorithm to use to decipher the buffer.
  in | The ciphered buffer to decipher.
  key | The symetric key used to cipher the buffer.
  length | The length of the symetric key used to cipher the buffer.

Returns
  the clear buffer or NULL on error.

Note
  This won't detect if the given key is the correct one or not. You have to check that the returned data make sense. You should also not treat them as safe.

Since
  1.14

References eina_binbuf_append_length(), eina_binbuf_free(), eina_binbuf_length_get(), eina_binbuf_new(), eina_binbuf_remove(), eina_binbuf_string_get(), EINA_UNUSED, and emile_cipher_init().

Referenced by eet_read_cipher().