An open API service indexing awesome lists of open source software.

https://github.com/edgio/ectoken

Token Generator for Edgio Token-Based Authentication from Edgio
https://github.com/edgio/ectoken

Last synced: 3 months ago
JSON representation

Token Generator for Edgio Token-Based Authentication from Edgio

Awesome Lists containing this project

README

          

# ectoken
> _C implementation of Edgio token (`ectoken`)_

## Table of Contents

- [Background](#background)
- [Install](#install)
- [Usage](#usage)
- [Contribute](#contribute)
- [License](#license)

## Background

C implementation of the "Edgio Token" (`ectoken`), an [AES-GCM](https://tools.ietf.org/html/rfc5288) token.

## Install

The C implementation requires [`gcc`](https://gcc.gnu.org/) to build and [OpenSSL](https://www.openssl.org/) `libcrypto`to link.

### Building with Make

To build, run the `make` command.

```sh
ectoken>make
gcc -O2 -Wall -Werror -std=gnu99 util/ectoken_cmd.c -I. ectoken.c base64.c -o ectoken -lcrypto -lm
cc -c -o ectoken.o ectoken.c
cc -c -o base64.o base64.c
ar rcs libectoken.a ectoken.o base64.o
```

This will build a library and an executable (`ectoken`) for command line usage.

### Running tests

Run `make test` from the project directory.

```sh
ectoken>make test
gcc -O2 -Wall -Werror -std=gnu99 util/ectoken_cmd.c -I. ectoken.c base64.c -o ectoken -lcrypto -lm
cc -c -o ectoken.o ectoken.c
cc -c -o base64.o base64.c
ar rcs libectoken.a ectoken.o base64.o
gcc -std=c99 -I. tests/ectoken_test.c -lcrypto -lm -o ectoken_test
./ectoken_test
test_short_size_calculations
success
...
test_full_flow
success

test_full_flow
success
```

## Usage

### Help
```sh
>./ectoken
Error wrong number of arguments specified
Usage:
To Encrypt:
ectoken
or:
ectoken encrypt
To Decrypt:
ectoken decrypt
```

### Encrypt

Encrypt clear text token `` with key: ``:
```sh
>./ectoken encrypt MY_SECRET_KEY MY_COOL_TOKEN
fVSYBBTynMkvQECGV-Kdfp333R-MGY2fsrrpVyuqd7OiuAUsQ8ITrL0
```

### Decrypt

Decrypt ciphertext token `` with key: ``:
```sh
>./ectoken decrypt MY_SECRET_KEY fVSYBBTynMkvQECGV-Kdfp333R-MGY2fsrrpVyuqd7OiuAUsQ8ITrL0
MY_COOL_TOKEN
```

## Contribute

- We welcome issues, questions and pull requests.

## License

This project is licensed under the terms of the Apache 2.0 open source license. Please refer to the `LICENSE-2.0.txt` file for the full terms.