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
- Host: GitHub
- URL: https://github.com/edgio/ectoken
- Owner: Edgio
- Created: 2016-09-08T16:48:44.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2022-06-23T02:56:11.000Z (almost 4 years ago)
- Last Synced: 2025-06-22T05:17:50.807Z (9 months ago)
- Language: C
- Homepage:
- Size: 3.28 MB
- Stars: 22
- Watchers: 19
- Forks: 41
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE-2.0.txt
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.