Wednesday, December 16, 2020

Install Charm Crypto in Mac OS Catalina 10.15.7

Charm Crypto
Developed by Akinyele, Joseph A, Charm Crypto is a simplified Python wrapper of PBC Library. There are many researchers using this library to build prototypes for their cryptographic protocols. In fact, its performance is comparable to the original C version of PBC (I also did some experiments and found that it is actually faster than JPBC, the Java wrapper of PBC). 

Dependencies Installation
To use Charm Crypto in Mac OS Catalina, you need to have the following items preinstalled:

1. Homebrew
It is for running the subsequent commands below.
To install the latest version of homebrew, check the script in the official brew website.

2. GMP Library
Install command: brew install gmp

3. PBC Library
Install command: brew install pbc

4. OpenSSL
Install command: brew install openssl@1.1

Install command: brew install wget

Charm Crypto Installation
After installing the dependencies above, run the following steps:

1. Download the latest source code
Command: git clone ; cd charm

2. Run the configure in root privileges and with the brew-installed version of openssl
Command: sudo ./ --extra-cflags="-I/usr/local/opt/openssl/include" --extra-ldflags="-L/usr/local/opt/openssl/lib

(Extra CFLAGS and LDFLAGS are required because brew will not install the openssl into /usr/lib)

3. Run the compilation and installation
Command: sudo make install

4. Run the post-installation testing
Command: sudo make test

After installation, you should be able to import schemes.* and charm.* freely in Python3 freely.

Once you see most of the items are passed, you can start programming with Charm Crypto.
Some example schemes can be found in charm/schemes directory.