84 hcs_random *hr,
unsigned long s,
unsigned long bits);
int djcs_import_public_key(djcs_public_key *pk, const char *json)
Import a public key from a string.
Provides secure random state for use in functions which require random values.
Public key for use in the Paillier system.
Definition: djcs.h:23
void djcs_free_private_key(djcs_private_key *vk)
Frees a djcs_private_key and all associated memory.
Private key for use in the Paillier system.
Definition: djcs.h:32
char * djcs_export_public_key(djcs_public_key *pk)
Export a public key as a string.
mpz_t g
Precomputation: n + 1.
Definition: djcs.h:26
int djcs_import_private_key(djcs_private_key *vk, const char *json)
Import a private key from a string.
int djcs_verify_key_pair(djcs_public_key *pk, djcs_private_key *vk)
Check certain values shared between public and private keys to ensure they indeed are pairs...
void djcs_free_public_key(djcs_public_key *pk)
Frees a djcs_public_key and all associated memory.
void djcs_reencrypt(djcs_public_key *pk, hcs_random *hr, mpz_t rop, mpz_t op)
Reencrypt an encrypted value op.
void djcs_clear_public_key(djcs_public_key *pk)
Clears all data in a djcs_public_key.
void djcs_decrypt(djcs_private_key *vk, mpz_t rop, mpz_t cipher1)
Decrypt a value cipher1, and set rop to the decrypted result.
void djcs_encrypt(djcs_public_key *pk, hcs_random *hr, mpz_t rop, mpz_t plain1)
Encrypt a value plain1, and set rop to the encrypted result.
unsigned long s
Ciphertext space exponent.
Definition: djcs.h:33
char * djcs_export_private_key(djcs_private_key *vk)
Export a private key as a string.
unsigned long s
Ciphertext space exponent.
Definition: djcs.h:24
void djcs_ep_add(djcs_public_key *pk, mpz_t rop, mpz_t cipher1, mpz_t plain1)
Add a plaintext value plain1 to an encrypted value cipher1, storing the result in rop...
void djcs_ee_add(djcs_public_key *pk, mpz_t rop, mpz_t cipher1, mpz_t cipher2)
Add an encrypted value cipher2 to an encrypted value cipher1, storing the result in rop...
mpz_t d
lcm(p, q) where n = p * q
Definition: djcs.h:35
int djcs_generate_key_pair(djcs_public_key *pk, djcs_private_key *vk, hcs_random *hr, unsigned long s, unsigned long bits)
Initialise a key pair with modulus size bits.
djcs_private_key * djcs_init_private_key(void)
Initialise a djcs_private_key and return a pointer to the newly created structure.
void djcs_clear_private_key(djcs_private_key *vk)
Clears all data in a djcs_private_key.
djcs_public_key * djcs_init_public_key(void)
Initialise a djcs_public_key and return a pointer to the newly created structure. ...
Random state used by a number of cryptographic functions.
Definition: hcs_random.h:39
void djcs_ep_mul(djcs_public_key *pk, mpz_t rop, mpz_t cipher1, mpz_t plain1)
Multiply a plaintext value plain1 with an encrypted value cipher1, storing the result in rop...
mpz_t * n
Modulus.
Definition: djcs.h:25
mpz_t * n
Modulus; Higher powers are precomputed.
Definition: djcs.h:34
mpz_t mu
g^d (mod n^(s+1))
Definition: djcs.h:36