---
name: "Eet_Cipher_Group"
section: "3"
platform: "linux"
package: "libeet-doc"
version: "1.3.2-1"
release: "Debian 6.0 (Squeeze)"
platforms: ["linux"]
url: "https://new.carta.tech/Eet_Cipher_Group"
---

# Eet\_Cipher\_Group(3)

Eet allows one to protect entries of an Eet\_File individually.

## NAME

Cipher, Identity and Protection Mechanisms -

Eet allows one to protect entries of an **Eet\_File** individually.

### Typedefs

typedef struct \_Eet\_Key **Eet\_Key**\
 *Opaque handle that defines an identity (also known as key) in Eet's cipher system.*  typedef int(\* **Eet\_Key\_Password\_Callback** )(char \*buffer, int size, int rwflag, void \*data)\
 *Callback used to request if needed the password of a private key.*

### Functions

EAPI **Eet\_Key** \* **eet\_identity\_open** (const char \*certificate\_file, const char \*private\_key\_file, **Eet\_Key\_Password\_Callback** cb)\
 *Create an Eet\_Key needed for signing an eet file.*  EAPI void **eet\_identity\_close** (**Eet\_Key** \*key)\
 *Close and release all ressource used by an Eet\_Key.*  EAPI **Eet\_Error** **eet\_identity\_set** (**Eet\_File** \*ef, **Eet\_Key** \*key)\
 *Set a key to sign a file.*  EAPI void **eet\_identity\_print** (**Eet\_Key** \*key, FILE \*out)\
 *Display both private and public key of an Eet\_Key.*  EAPI const void \* **eet\_identity\_x509** (**Eet\_File** \*ef, int \*der\_length)\
 *Get the x509 der certificate associated with an Eet\_File.*  EAPI const void \* **eet\_identity\_signature** (**Eet\_File** \*ef, int \*signature\_length)\
 *Get the raw signature associated with an Eet\_File.*  EAPI const void \* **eet\_identity\_sha1** (**Eet\_File** \*ef, int \*sha1\_length)\
 *Get the SHA1 associated with a file.*  EAPI void **eet\_identity\_certificate\_print** (const unsigned char \*certificate, int der\_length, FILE \*out)\
 *Display the x509 der certificate to out.*

## Detailed Description

Eet allows one to protect entries of an **Eet\_File** individually.

This may be used to ensure data was not tampered or that third party does not read your data.

**See also:**

**Eet File Ciphered Main Functions**

**Image Store and Load using a Cipher**

## Typedef Documentation

### typedef int(\* Eet\_Key\_Password\_Callback)(char \*buffer, int size, int rwflag, void \*data)

Callback used to request if needed the password of a private key. **Parameters:**

*buffer* the buffer where to store the password. \
 *size* the maximum password size (size of buffer, including '\\0'). \
 *rwflag* if the buffer is also readable or just writable. \
 *data* currently unused, may contain some context in future.

**Returns:**

1 on success and password was set to `buffer`, 0 on failure.

**Since:**

1\.2.0

## Function Documentation

### EAPI void eet\_identity\_certificate\_print (const unsigned char \* certificate, int der\_length, FILE \* out)

Display the x509 der certificate to out. **Parameters:**

*certificate* the x509 certificate to print \
 *der\_length* The length the certificate. \
 *out* where to print.

**Since:**

1\.2.0

### EAPI void eet\_identity\_close (Eet\_Key \* key)

Close and release all ressource used by an Eet\_Key. An reference counter prevent it from being freed until all file using it are also closed.

**Parameters:**

*key* the key handle to close and free resources.

**Since:**

1\.2.0

### EAPI Eet\_Key\* eet\_identity\_open (const char \* certificate\_file, const char \* private\_key\_file, Eet\_Key\_Password\_Callback cb)

Create an Eet\_Key needed for signing an eet file. The certificate should provide the public that match the private key. No verification is done to ensure that.

**Parameters:**

*certificate\_file* The file where to find the certificate. \
 *private\_key\_file* The file that contains the private key. \
 *cb* Function to callback if password is required to unlock private key.

**Returns:**

A key handle to use, or `NULL` on failure.

**See also:**

**eet\_identity\_close()**

**Since:**

1\.2.0

### EAPI void eet\_identity\_print (Eet\_Key \* key, FILE \* out)

Display both private and public key of an Eet\_Key. **Parameters:**

*key* the handle to print. \
 *out* where to print.

**Since:**

1\.2.0

### EAPI Eet\_Error eet\_identity\_set (Eet\_File \* ef, Eet\_Key \* key)

Set a key to sign a file. **Parameters:**

*ef* the file to set the identity. \
 *key* the key handle to set as identity.

**Returns:**

**EET\_ERROR\_BAD\_OBJECT** if `ef` is invalid or **EET\_ERROR\_NONE** on success.

**Since:**

1\.2.0

### EAPI const void\* eet\_identity\_sha1 (Eet\_File \* ef, int \* sha1\_length)

Get the SHA1 associated with a file. Could be the one used to sign the data or if the data where not signed, it will be the SHA1 of the file.

**Parameters:**

*ef* The file handle to query. \
 *sha1\_length* The length of returned data, may be `NULL`.

**Returns:**

the associated SHA1 or `NULL` on error.

**Since:**

1\.2.0

### EAPI const void\* eet\_identity\_signature (Eet\_File \* ef, int \* signature\_length)

Get the raw signature associated with an Eet\_File. Will return NULL if the file is not signed.

**Parameters:**

*ef* The file handle to query. \
 *signature\_length* The length of returned data, may be `NULL`.

**Returns:**

the raw signature or `NULL` on error.

### EAPI const void\* eet\_identity\_x509 (Eet\_File \* ef, int \* der\_length)

Get the x509 der certificate associated with an Eet\_File. Will return NULL if the file is not signed.

**Parameters:**

*ef* The file handle to query. \
 *der\_length* The length of returned data, may be `NULL`.

**Returns:**

the x509 certificate or `NULL` on error.

**Since:**

1\.2.0

## Author

Generated automatically by Doxygen for Eet from the source code.
