# Themis Erlang NIF
<img src="https://img.shields.io/hexpm/v/themis_nif.svg" />
The Themis Erlang NIF module provides an interface to the [Themis](https://github.com/cossacklabs/themis) cryptographic framework.
## Installation
```bash
{:themis_nif, "~> 0.0.2"}
```
## Module Overview
The `themis_nif` module exports several functions for generating keys and encrypting/decrypting messages.
### Available Functions
| Function Name | Description |
|------------------------------|------------------------------------------------------------|
| `gen_ec_key_pair` | Generates an ECC (Elliptic Curve Cryptography) key pair. |
| `gen_rsa_key_pair` | Generates an RSA key pair. |
| `gen_sym_key` | Generates a symmetric key (default length 32). |
| `is_valid_key` | Checks if the provided key is valid. |
| `is_private_key` | Checks if the provided key is a private key. |
| `is_public_key` | Checks if the provided key is a public key. |
| `cell_seal_encrypt` | Encrypts a message using a key (optional context). | |
| `cell_seal_decrypt` | Decrypts a message using a key (optional context). |
### Missing Functions
The following functions from the Themis API are currently not included in the `themis_nif` module:
- [secure_session.c](https://github.com/cossacklabs/themis/blob/master/src/themis/secure_session.c "secure_session.c"): Handles secure session management.
- [secure_comparator.c](https://github.com/cossacklabs/themis/blob/master/src/themis/secure_comparator.c "secure_comparator.c"): Provides functionalities for secure comparisons.
- [secure_message.c](https://github.com/cossacklabs/themis/blob/master/src/themis/secure_message.c "secure_message.c"): Implements secure message exchange mechanisms.
### Example Usage
```erlang
% Generate an EC key pair
{PublicKey, PrivateKey} = themis_nif:gen_ec_key_pair(),
% Validate a key
isValid = themis_nif:is_valid_key(PublicKey),
% Encrypt a message
EncryptedMessage = themis_nif:cell_seal_encrypt(PrivateKey, <<"Hello, World!">>),
% Decrypt the message
DecryptedMessage = themis_nif:cell_seal_decrypt(PrivateKey, EncryptedMessage).
```
## Contributing
Feel free to contribute by forking the repository and making pull requests for enhancements, bug fixes, or new features.