Queries on Encrypted Data Library

Setup has two steps: Format HVE_t, and run QED_Setup.
An example is presented at the end.

  1. Format the HVE_t

    An array of HVE_FORMAT_t variables are used to format our HVE_t. An HVE_FORMAT_t represents the query properties of a sector of the HVE_t.

    • Format a Comparison Query:
      	HVE_FORMAT_t comp = {COMPARISON, value}
      
      • COMPARISON is a predefined keyword
      • value is a positive integer; query will be run on the interval [1, value]

    • Format an Equality Query:
      	HVE_FORMAT_t eq = {EQUALITY}
      
      • EQUALITY is a predefined keyword

    • Format a Subset Query:
      	HVE_FORMAT_T sub = {SUBSET, prob, sub_size}
      
      • SUBSET is a predefined keyword
      • prob takes one of the predefined values: EPS_PT1, EPS_PT01, EPS_PT001
      • (Please see Param Description Section for more information on the EPS_PT values)
      • sub_size is a positive integer representing the size of the set the query is ran on.

    • Format a Raw Query:
      	HVE_FORMAT_T raw = {RAW}
      
      • RAW is a predefined keyword

    The arary of HVE_FORMAT_t must be terminated with a triple END. This terminating HVE_FORMAT_t entry should be considered in the length of the HVE_FORMAT_t array.

            { END, END, END };
    

    After the HVE_FORMAT_t array is fully specified, call HVE_Format:

    QED_Return HVE_Format(
    			HVE_t *HVE, 
    			HVE_FORMAT_t *array, 
    			size_t array_len)
    


  2. Run QED_Setup

  3. Setup will be used to generate the private and public keys. These keys will generated with a security parameter used to generate primes p and q in the composite order elliptic curve group (n=pq). (See QED Internals for more information.) The security parameter takes three values:
    The formated HVE and the security parameter will be used to generate public and private keys.
    QEDPrivateKey_t PrivKey;
    QEDPublicKey_t PubKey;
    

    Call QED_Setup with the formated HVE and the security parameter to populate the two keys.
    int QED_Setup(
            	QEDPrivateKey_t *PrivKey,
    	        QEDPublicKey_t *PubKey,
           		HVE_t *HVE,
                    STANDARD,
           		QED_CTX *c)
    



Example

First, declare a context, a private key, a public key and an HVE variable.

	QED_CTX c;
	QEDPrivateKey_t PrivKey;
	QEDPublicKey_t PubKey;
	HVE_t HVE;


Second, initialize the context variable to use TYPE1 algorithm.
	QED_Init(&c, TYPE1);


Third, format the HVE to the following query:

  • Sector 1: Comparison Query, in the interval [1,5].
  • Sector 2: Equality Query.
  • Sector 3: Subset Query, with probability .1, a subset of 3 elements.
  • Sector 4: Raw Query.


  • Note: For more information on the meaning of probability for a subset query please see Param Description Section


    The following code will format the declared HVE to the above specifications:
    	HVE_FORMAT_t format[5] = {
           		{COMPARISON, 5},
    	        {EQUALITY},
    	        {SUBSET, EPS_PT1, 3},
    		{RAW},
    	        {END, END, END}};
    
    	HVE_Format(&HVE, format, 5);
    	


    And finnaly use the formated HVE to generate the public/private pair key, with security parameter STANDARD:
    	QED_Setup(&PrivKey, &PubKey, &HVE, STANDARD, &c);