Skip to content

CLI Reference

Claudio Lucisano edited this page Sep 22, 2026 · 1 revision

CLI Reference

make builds four command-line tools in cli/; make install also copies them to $INSTALL_PREFIX/bin. On Windows they are named oabe_*.exe. They always use the CCA-secure version of each scheme.

Tool Does
oabe_setup Generates the master public and secret parameters for CP-ABE or KP-ABE
oabe_keygen Generates a user key (ABE) or a key pair (PK)
oabe_enc Encrypts a file
oabe_dec Decrypts a file

All tools accept -v for verbose output. Parameters and keys are read from and written to the current working directory.

oabe_setup

oabe_setup -s CP|KP [-p prefix] [-v]
Option Meaning
-s Scheme: CP or KP
-p Prefix for the parameter files (optional). Use it to keep several authorities in one directory: -p org1, -p org2.

oabe_keygen

oabe_keygen -s PK|CP|KP [-p prefix] -i input [-o output] [-v]
Option Meaning
-s Scheme: PK, CP or KP
-i PK: the user's key ID · CP: an attribute list · KP: a policy
-o Output name for the secret key. .key is appended, so -o alice writes alice.key
-p Parameter prefix used at setup

oabe_enc

oabe_enc -s PK|CP|KP [-p prefix] -e enc_input [-r recipient] -i input -o output [-v]
Option Meaning
-s Scheme: PK, CP or KP
-e PK: sender key ID · CP: a policy · KP: an attribute list
-r PK only: recipient key ID
-i Input (plaintext) file
-o Output (ciphertext) file
-p Parameter prefix used at setup

oabe_dec

oabe_dec -s PK|CP|KP [-p prefix] -k key | -e sender -r recipient -i ciphertext -o output [-v]
Option Meaning
-s Scheme: PK, CP or KP
-k CP/KP: the secret key file (e.g. alice.key)
-e / -r PK: sender and recipient key IDs
-i Ciphertext file
-o Output (plaintext) file
-p Parameter prefix used at setup

Exit codes

0 means success. On failure, the tools exit with the library's OpenABE_ERROR code. For example, 32 (DECRYPTION_FAILED) is returned when a key does not satisfy the policy, which is exactly what the test scripts check for. Argument errors return -1, which shells show as 255. See Error Codes for the full list.

Full examples

Test scripts

cli/ also contains the scripts used by make test:

Script Covers
runTest.sh Used by make test: PK, CP and KP round trips, including expected failures (exit 32)
runBasicTest.sh Same scenarios as runTest.sh with simple attribute names
runComplexTest.sh Same flow with numeric comparisons and type:value attributes
fuzzTest.sh Fuzzes the CLI tools with AFL; requires afl-fuzz, afl-clang and afl-clang++

Run them from cli/ with an input file, e.g. ./runBasicTest.sh input.txt. fuzzTest.sh also needs the scheme: ./fuzzTest.sh input.txt CP.

Clone this wiki locally