ABY Framework
1.0
Arithmetic Bool Yao Framework
|
A library implementing the DGK crypto system with full decryption Thanks to Marina Blanton for sharing her Miracl DGK implementation from M. Blanton and P. Gasti, "Secure and efficient protocols for iris and fingerprint identification" (ESORICS’11) with us. We used it as a template for this GMP version. More...
#include <gmp.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include "powmod.h"
Go to the source code of this file.
Classes | |
struct | dgk_pubkey_t |
struct | dgk_prvkey_t |
Functions | |
void | dgk_keygen (unsigned int modulusbits, unsigned int lbits, dgk_pubkey_t **pub, dgk_prvkey_t **prv) |
void | dgk_encrypt_fb (mpz_t res, dgk_pubkey_t *pub, mpz_t pt, gmp_randstate_t rnd) |
void | dgk_encrypt_plain (mpz_t res, dgk_pubkey_t *pub, mpz_t pt, gmp_randstate_t rnd) |
void | dgk_encrypt_crt (mpz_t res, dgk_pubkey_t *pub, dgk_prvkey_t *prv, mpz_t pt, gmp_randstate_t rnd) |
void | dgk_decrypt (mpz_t res, dgk_pubkey_t *pub, dgk_prvkey_t *prv, mpz_t ct) |
void | dgk_storekey (unsigned int modulusbits, unsigned int lbits, dgk_pubkey_t *pub, dgk_prvkey_t *prv) |
void | dgk_readkey (unsigned int modulusbits, unsigned int lbits, dgk_pubkey_t **pub, dgk_prvkey_t **prv) |
void | dgk_freepubkey (dgk_pubkey_t *pub) |
void | dgk_freeprvkey (dgk_prvkey_t *prv) |
void | dgk_complete_pubkey (unsigned int modulusbits, unsigned int lbits, dgk_pubkey_t **pub, mpz_t n, mpz_t g, mpz_t h) |
Variables | |
mpz_t * | powtwo |
mpz_t * | gvpvqp |
A library implementing the DGK crypto system with full decryption Thanks to Marina Blanton for sharing her Miracl DGK implementation from M. Blanton and P. Gasti, "Secure and efficient protocols for iris and fingerprint identification" (ESORICS’11) with us. We used it as a template for this GMP version.
The implementation structure was inspired by libpailler - A library implementing the Paillier crypto system. (http://hms.isi.jhu.edu/acsc/libpaillier/)
void dgk_complete_pubkey | ( | unsigned int | modulusbits, |
unsigned int | lbits, | ||
dgk_pubkey_t ** | pub, | ||
mpz_t | n, | ||
mpz_t | g, | ||
mpz_t | h | ||
) |
create the full public key struct type given only n, g and h (e.g. after key exchange)
void dgk_decrypt | ( | mpz_t | res, |
dgk_pubkey_t * | pub, | ||
dgk_prvkey_t * | prv, | ||
mpz_t | ct | ||
) |
use CRT and double base combined - unfortunately not efficient due to different sized exponents, therefore deactivated DGK decryption
void dgk_encrypt_crt | ( | mpz_t | res, |
dgk_pubkey_t * | pub, | ||
dgk_prvkey_t * | prv, | ||
mpz_t | pt, | ||
gmp_randstate_t | rnd | ||
) |
encrypt using CRT if we have the private key for efficiency
void dgk_encrypt_fb | ( | mpz_t | res, |
dgk_pubkey_t * | pub, | ||
mpz_t | pt, | ||
gmp_randstate_t | rnd | ||
) |
encrypt with public key only and double-base encryption - unfortunately not efficient due to different sized exponents, therefore deactivated encrypt with public key only, fixed-base encryption (must be initialized before first use!)
void dgk_encrypt_plain | ( | mpz_t | res, |
dgk_pubkey_t * | pub, | ||
mpz_t | pt, | ||
gmp_randstate_t | rnd | ||
) |
encrypt with public key only, no further optimization (slower than fixed-base encryption)
void dgk_keygen | ( | unsigned int | modulusbits, |
unsigned int | lbits, | ||
dgk_pubkey_t ** | pub, | ||
dgk_prvkey_t ** | prv | ||
) |
create a DGK key pair. This will take some time, depending on the size (up to several minutes!) modulusbits is the size of the modulus n, e.g. 1024 or 2048 bit lbits is equal to the share length, e.g. 16 or 32 bit (We use 2*lbits+2 internally) the parameter t is internally fixed to 160, as recommended in the paper
void dgk_readkey | ( | unsigned int | modulusbits, |
unsigned int | lbits, | ||
dgk_pubkey_t ** | pub, | ||
dgk_prvkey_t ** | prv | ||
) |
reads a previously stored key pair from disc
void dgk_storekey | ( | unsigned int | modulusbits, |
unsigned int | lbits, | ||
dgk_pubkey_t * | pub, | ||
dgk_prvkey_t * | prv | ||
) |
stores a generated key pair to disc