MIRACL & PBC Yung-Hsiang Liu
Outline Why we use the libraries? MIRACL (http://www.certivox.com/miracl/) Elliptic curves cryptography ECDSA, ECIES, ECDH, ECMQV, … https://github.com/CertiVox/MIRACL PBC (http://crypto.stanford.edu/pbc/) Pairing-based cryptography IBE, IBNIKE, 3-party KE, IBS, BLS, PEKS, BE, ABE, … https://github.com/blynn/pbc
Why we use the libraries? Security Big number and finite field arithmetic Group law Extension field arithmetic Bilinear pairing: Miller’s algorithm, polynomial evaluation Symmetric Key Size (bits) RSA and Diffie-Hellman Key Size (bits) Elliptic Curve Key Size (bits) 80 1024 160 112 2048 224 128 3072 256 192 7680 384 15360 521 Table 1: NIST Recommended Key Sizes
Libraries C/C++ Libraries MIRACL PBC Multiprecision Integer and Rational Arithmetic Cryptographic Library https://github.com/CertiVox/MIRACL/blob/master/README.md PBC Pairing-Based Crypto library https://github.com/blynn/pbc/blob/master/README
MIRACL Yung-Hsiang Liu ECC 2014
ECC Protocols http://people.cs.nctu.edu.tw/~rjchen/ECC2014S/31_ECCProtocols.pdf ECDSA ECDH/ECMQV ECIES ECIES-DEM ECIES-KEM ECIES-KEM-DEM
ECDSA Parameters: 𝐸( 𝔽 𝑝 ) of prime order 𝑛, and a base point 𝑃 Key pair: private key 𝑑 𝐴 ∈ ℤ 𝑛 , public key 𝑄 𝐴 = 𝑑 𝐴 𝑃 Sign message 𝑚: 𝑧=𝐻𝑎𝑠ℎ 𝑚 mod 𝑛 𝑘 ∈ 𝑅 ℤ 𝑛 , and 𝑅=𝑘𝑃 𝑟=𝑥 𝑅 mod 𝑛 * 𝑠= 𝑘 −1 𝑧+𝑟 𝑑 𝐴 mod 𝑛 * Signature: (𝑟,𝑠) Verify the signature (𝑟,𝑠): 𝑧=𝐻𝑎𝑠ℎ 𝑚 mod 𝑛 𝑤= 𝑠 −1 mod 𝑛 𝑅=𝑧𝑤𝑃+𝑟𝑤 𝑄 𝐴 Check if 𝑥 𝑅 =𝑟
What MIRACL Provides – (1) Big number Finite field arithmetic Elliptic curve group law 𝐸 𝔽 𝑝 : 𝑦 2 = 𝑥 3 +𝑎𝑥+𝑏 𝑃( 𝑥 1 , 𝑦 1 ), 𝑄( 𝑥 2 , 𝑦 2 ) 𝑅 𝑥 3 , 𝑦 3 =𝑃+𝑄 𝑥 3 = 𝜆 2 − 𝑥 1 − 𝑥 2 𝑦 3 =𝜆 𝑥 1 − 𝑥 3 − 𝑦 1 𝜆= 𝑦 2 − 𝑦 1 𝑥 2 − 𝑥 1 , if 𝑃≠𝑄 3 𝑥 1 2 +𝑎 2 𝑦 1 , if 𝑃=𝑄
What MIRACL Provides – (2) Efficient scalar multiplication Use “double and add” to calculate 𝑘𝑃 Random number generator Pick a random big number Random point on elliptic curves Choose 𝑥, and test if there is a suitable 𝑦
Download MIRACL https://github.com/CertiVox/MIRACL
Build MIRACL File architecture To build the library https://github.com/CertiVox/MIRACL/blob/master/readme.txt https://github.com/CertiVox/MIRACL/blob/master/update.txt To build the library https://github.com/CertiVox/MIRACL/blob/master/first.txt Visual Studio https://github.com/CertiVox/MIRACL/blob/master/vc2005.txt Unix-like https://github.com/CertiVox/MIRACL/blob/master/linux.txt MAC https://github.com/CertiVox/MIRACL/blob/master/mac.txt
Build MIRACL on Ubuntu Download from GitHub Save as MIRACL-master.zip unzip -j -aa -L MIRACL-master.zip –d miracl -j ignores the directory structure inside the zip file -aa converts all text files to Unix format -L ensures that all filenames are lower-case -d specify the directory to extract into bash linux64
Examples genprime schoof ecdsa_sign ecdsa_verify
Further Reading Sample codes provided by MIRACL *.cpp Header files *.h
PBC Yung-Hsiang Liu ECC 2014
Pairing-based Cryptography http://people.cs.nctu.edu.tw/~rjchen/ECC2014S/PairingBasedCrypto.pdf Identity-based encryption Identity-based non-interactive key distribution 3-party key distribution Identity-based signature BLS short signature
What PBC Provides Big number Finite field arithmetic Extension field arithmetic Elliptic curve group law Bilinear pairings Tate pairing Miller’s algorithm Polynomial evaluation
Download MIRACL http://crypto.stanford.edu/pbc/download.html
Build MIRACL To build the library Windows binaries and DLL https://github.com/blynn/pbc/blob/master/INSTALL Windows binaries and DLL http://crypto.stanford.edu/pbc/files/pbc-0.5.14-win32-bin.zip
Build MIRACL on Ubuntu Download from official website Save as pbc-0.5.14.tar.gz tar xf pbc-0.5.14.tar.gz ./configure make .libs/libpbc.* make install
Examples BLS short signature Identity-based non-interactive key distribution 3-party key distribution Identity-based encryption Identity-based signature
More Applications Searchable encryption Broadcast encryption Attribute-based encryption
Further Reading http://crypto.stanford.edu/pbc/manual/ 1. Installing PBC 2. Tutorial 3. Pairing functions 4. Element functions 5. Param functions 6. Other functions 7. Bundled programs 8. PBC internals 9. Security issues